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


C# LocationCollection.Clear方法代码示例

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


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

示例1: DrawAreas

        private void DrawAreas(XAMLResponse e)
        {
            CenterRectAreas = new LocationRect();
            AllPointsInLayer = new LocationCollection();
            int resultCnt = e.OutputFields.Count;
            if (resultCnt > 0)
            {
                if (resultCnt < recordLimit)
                {
                    if (Layers.Count > 0)
                    {
                        MapLayer currentLayer = Layers[0];
                        MapLayer newLayer = (MapLayer)XamlReader.Load(e.XAML);
                        currentLayer.Children.Clear();
                        Layers[2].Children.Clear();

                        currentLayer.Children.Add(newLayer);

                        foreach (XAMLFields shp in e.OutputFields)
                        {
                            UIElement el = (UIElement)newLayer.FindName(shp.ID);

                            if (el != null)
                            {
                                el.MouseLeftButtonUp += new MouseButtonEventHandler(el_MouseLeftButtonUp);
                                el.MouseEnter += polygon_MouseEnter;
                                el.MouseLeave += polygon_MouseLeave;

                                Area newArea = new Area();

                                newArea.Name = shp.Fields["name"];
                                newArea.Country = shp.Fields["country"].ToString();
                                newArea.DesignationType = shp.Fields["desig_type"];
                                newArea.Designation = shp.Fields["desig_eng"];
                                newArea.RepArea = shp.Fields["rep_area"];

                                int year = 0;
                                int.TryParse(shp.Fields["status_yr"], out year);
                                if (year != 0)
                                    newArea.StatusYear = year;
                                newArea.Wdpaid = int.Parse(shp.Fields["wdpaid"]);
                                newArea.Iucncat = shp.Fields["iucncat"];

                                StringBuilder label = new StringBuilder("\n");
                                label.Append("Name :" + shp.Fields["name"] + "\n");
                                label.Append("Country :" + shp.Fields["country"] + "\n");
                                label.Append("Designation :" + shp.Fields["desig_eng"] + "\n");
                                label.Append("Type :" + shp.Fields["desig_type"] + "\n");
                                label.Append("Total Area :" + shp.Fields["rep_area"] + "\n");
                                label.Append("Iucncat :" + shp.Fields["iucncat"] + "\n");
                                label.Append("Continent :" + shp.Fields["continent"] + "\n");

                                (el as FrameworkElement).Tag = newArea;

                                ToolTip tt = AddToolTip(label.ToString());
                                ToolTipService.SetToolTip(el, tt);

                                if (el.GetType().Equals(typeof(Pushpin)))
                                {
                                    Pushpin p = (Pushpin)el;

                                    AllPointsInLayer.Add(p.Location);

                                    Pin pin = new Pin { ShowCustomPin = true };
                                    pin.MouseLeftButtonUp += new MouseButtonEventHandler(el_MouseLeftButtonUp);
                                    pin.Cursor = Cursors.Hand;
                                    newLayer.AddChild(pin, p.Location, PositionOrigin.BottomCenter);

                                    ToolTip tt1 = AddToolTip(label.ToString());
                                    ToolTipService.SetToolTip(pin, tt1);
                                    newLayer.Children.Remove(p);

                                }

                                if (el.GetType().Equals(typeof(MapLayer)))
                                {
                                    MapLayer p = (MapLayer)el;
                                    p.Cursor = Cursors.Hand;
                                    foreach (MapPolygon mp in p.Children)
                                    {
                                        for (int i = 0; i < mp.Locations.Count; i++)
                                        {
                                            AllPointsInLayer.Add(mp.Locations[i]);
                                        }

                                        mp.Fill = new SolidColorBrush(MiscFunctions.ColorFromInt(LayerStyle[Layers[0].Name].fill));
                                        mp.Stroke = new SolidColorBrush(MiscFunctions.ColorFromInt(LayerStyle[Layers[0].Name].stroke));
                                        mp.Opacity = LayerStyle[Layers[0].Name].opacity;

                                        LocationRect rect = new LocationRect(mp.Locations);

                                        Pin pin = new Pin { ShowCustomTree = true };
                                        pin.Tag = (el as MapLayer);
                                        ToolTip tt1 = AddToolTip(label.ToString());
                                        pin.Cursor = Cursors.Hand;
                                        ToolTipService.SetToolTip(pin, tt1);
                                        pin.MouseLeftButtonUp += new MouseButtonEventHandler(el_MouseLeftButtonUp);

                                        newLayer.AddChild(pin, rect.Center, PositionOrigin.BottomCenter);

//.........这里部分代码省略.........
开发者ID:rmarinho,项目名称:ForestFindr,代码行数:101,代码来源:HomeViewModel.cs


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