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


C# LocationCollection.Add方法代码示例

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


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

示例1: SetTreePins

        public void SetTreePins(List<Tree> trees, string name)
        {
            map.Children.Clear();

            foreach (Tree tree in trees)
            {
                MapPolygon point = new MapPolygon();
                point.Stroke = new SolidColorBrush(Colors.White);
                point.Fill = new SolidColorBrush(Colors.Green);
                point.Opacity = 0.7f;
                Location location1 = new Location() { Latitude = tree.Coordinates.X - 0.0001, Longitude = tree.Coordinates.Y - 0.00006 };
                Location location2 = new Location() { Latitude = tree.Coordinates.X + 0.0001, Longitude = tree.Coordinates.Y - 0.00006 };
                Location location3 = new Location() { Latitude = tree.Coordinates.X + 0.0001, Longitude = tree.Coordinates.Y + 0.00006 };
                Location location4 = new Location() { Latitude = tree.Coordinates.X - 0.0001, Longitude = tree.Coordinates.Y + 0.00006 };
                LocationCollection locations = new LocationCollection();
                locations.Add(location1);
                locations.Add(location2);
                locations.Add(location3);
                locations.Add(location4);
                point.Locations = locations;

                map.Children.Add(point);

                /*
                Pushpin pin = new Pushpin();
                pin.Location = new GeoCoordinate(tree.Coordinates.X, tree.Coordinates.Y);
                pin.Content = name;
                map.Children.Add(pin);
                 * */
            }

            NavigationService.GoBack();
        }
开发者ID:TryCatch22,项目名称:Project-Beaver,代码行数:33,代码来源:MainPage.xaml.cs

示例2: Favorites

        public Favorites()
        {
            InitializeComponent();
            LoadWatcher();
            map1.LogoVisibility = Visibility.Collapsed;
            map1.CopyrightVisibility = Visibility.Collapsed;
            map1.Mode = new AerialMode();
            map1.ZoomLevel = 5;
            map1.ZoomBarVisibility = System.Windows.Visibility.Visible;

            var settings = IsolatedStorageSettings.ApplicationSettings;
            if (settings.Contains("favorites"))
            {
                var location = settings["favorites"].ToString();
                latitude = double.Parse(location.Substring(0, location.IndexOf(",") - 1));
                longtitude =  double.Parse(location.Substring(location.IndexOf(",") + 1));
                var locationsList = new LocationCollection();
                //locationsList.Add(new GeoCoordinate(56.5845698,40.5489514));
                //locationsList.Add(new GeoCoordinate(60.4885213, 80.785426));
                locationsList.Add(new GeoCoordinate(latitude,longtitude));
                locationsList.Add(new GeoCoordinate(latitude+0.85412, longtitude+0.12564));
                MapPolyline polyline = new MapPolyline();
                polyline.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black);
                polyline.StrokeThickness = 5;
                polyline.Opacity = 0.8;
                polyline.Locations = locationsList;

                //Pushpin pin = new Pushpin();

                //MessageBox.Show(location.Substring(0, location.IndexOf(",") - 1) + " \n  " + location.Substring(location.IndexOf(",") + 1));
                ////---set the location for the pushpin---
                //pin.Location = new GeoCoordinate(double.Parse(location.Substring(0, location.IndexOf(",") - 1)), double.Parse(location.Substring(location.IndexOf(",") + 1)));
                //pin.Name = "tmp";

                ////---add the pushpin to the map---

                //pin.Content = new Ellipse()
                //{
                //    //Fill = image,

                //    StrokeThickness = 10,
                //    Height = 100,
                //    Width = 100
                //};
                //pin.MouseLeftButtonUp += new MouseButtonEventHandler(Pushpin_MouseLeftButtonUp);

                //---add the pushpin to the map---
                map1.Children.Add(polyline);

                MessageBox.Show(location.ToString());
            }

            // settings["myemail"] = "[email protected]";
        }
开发者ID:marcin-owoc,项目名称:TouristGuide,代码行数:54,代码来源:Favorites.xaml.cs

示例3: Edge

        public Edge(ListeningStation from, ListeningStation to, double value)
        {
            ID = from.ID + " - " + to.ID;
            Name = from.Name + " - " + to.Name;

            LocationCollection vertices = new LocationCollection();
            vertices.Add(from.Location);
            vertices.Add(to.Location);
            Vertices = vertices;

            Value = value;
        }
开发者ID:seanmcleod,项目名称:SharkViz,代码行数:12,代码来源:Edge.cs

示例4: BuildPolyline

        private void BuildPolyline()
        {
            LocationCollection points = new LocationCollection();
            points.Add(new Location(40, -100));
            points.Add(new Location(41, -101));
            points.Add(new Location(40, -102));
            points.Add(new Location(43, -103));
            points.Add(new Location(45, -97));

            MapPolyline polyline = new MapPolyline();
            polyline.Points = points;

            this.polylineLayer.Items.Add(polyline);
            this.BuildPoints(polyline);
        }
开发者ID:jigjosh,项目名称:xaml-sdk,代码行数:15,代码来源:MainWindow.xaml.cs

示例5: AddPinsToLayer

        public override void AddPinsToLayer()
        {
            foreach (PointOfInterest poi in Points)
            {
                MapPolygon polygon = new MapPolygon();
                polygon.Fill = new SolidColorBrush(_Colors[colorIndex++ % _Colors.Length]); 
                polygon.Opacity = 0.25;
                
                LocationCollection locCol = new LocationCollection();

                foreach( string line in  poi.Coordinates.Split('\n') )
                {
                    if (!string.IsNullOrEmpty(line))
                    {
                        string[] vals = line.Split(',');
                        locCol.Add(
                            new Location()
                            {
                                Latitude = double.Parse(vals[1]),
                                Longitude = double.Parse(vals[0]),
                                Altitude = 0
                            });
                    }
                }
                polygon.Locations = locCol;
                MapLayer.Children.Add(polygon);
            }

        }
开发者ID:FaisalNahian,项目名称:311NYC,代码行数:29,代码来源:RegionGroup.cs

示例6: ParseXMLToRoad

        public static TravelData ParseXMLToRoad(XmlDocument data)
        {
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(data.NameTable);
            nsmgr.AddNamespace("rest", "http://schemas.microsoft.com/search/local/ws/rest/v1");
            XmlNodeList roadElements = data.SelectNodes("//rest:Line", nsmgr);
            if (roadElements.Count == 0)
            {
                MessageBox.Show("No road found :(", "Highway to hell", MessageBoxButton.OK, MessageBoxImage.Error);
                return null;
            }
            else
            {
                LocationCollection locations = new LocationCollection();
                XmlNodeList points = roadElements[0].SelectNodes(".//rest:Point", nsmgr);
                foreach (XmlNode point in points)
                {
                    string latitude = point.SelectSingleNode(".//rest:Latitude", nsmgr).InnerText;
                    string longitude = point.SelectSingleNode(".//rest:Longitude", nsmgr).InnerText;

                    locations.Add(XML.SetGeographicInfo(latitude, longitude));
                }
                TravelData travelData = new TravelData();
                travelData.StringDistance = data.SelectSingleNode(".//rest:TravelDistance", nsmgr).InnerText;
                travelData.StringTravelTime = data.SelectSingleNode(".//rest:TravelDuration", nsmgr).InnerText;
                travelData.Locations = locations;
                return travelData;
            }
        }
开发者ID:Andrusza,项目名称:TaxiApp,代码行数:28,代码来源:XML.cs

示例7: RouteModel

 /// <summary>
 /// Initializes a new instance of this type.
 /// </summary>
 /// <param name="locations">A collection of locations.</param>
 public RouteModel(ICollection<Location> locations)
 {
     _locations = new LocationCollection();
     foreach (Location location in locations)
     {
         _locations.Add(location);
     }
 }
开发者ID:ProjPossibility,项目名称:CSUN-MobileMapMagnifier,代码行数:12,代码来源:RouteModel.cs

示例8: RouteModel

 public RouteModel(IEnumerable<GeoCoordinate> locations)
 {
     _locations = new LocationCollection();
     foreach (var location in locations)
     {
         _locations.Add(location);
     }
 }
开发者ID:aruxa,项目名称:Runner,代码行数:8,代码来源:RouteModel.cs

示例9: CoordinatesToLocationCollection

 public static LocationCollection CoordinatesToLocationCollection(ICoordinate[] coordinates)
 {
     var locations = new LocationCollection();
     foreach (var coordinate in coordinates)
     {
         locations.Add(ConvertBack(coordinate));
     }
     return locations;
 }
开发者ID:HogwartsRico,项目名称:AGS-PgRouting,代码行数:9,代码来源:CoordinateConvertor.cs

示例10: ToLocationCollection

 public static LocationCollection ToLocationCollection (this IList<BasicGeoposition>PointList)
 {
     var locations = new LocationCollection();
     foreach (var p in PointList)
    	{
    		   locations.Add(p.ToLocation());                             
    	}
     return locations;
 }
开发者ID:mohamedemam0,项目名称:Data-Binding---Maps,代码行数:9,代码来源:Extensions.cs

示例11: MainWindowViewModel

		public MainWindowViewModel() 
		{
			Locations = new LocationCollection();
			TestContent = "Wahaha";
			Locations.Add(new Location(0, 0));
			Locations.Add(new Location(101, 110));
			Locations.Add(new Location(390, 450));
			Person person = new Person();
			person.Name = "Steve Ballmer";
			person.Image = new BitmapImage(new Uri("image/photo.png", UriKind.Relative));
			Location loc = new Location(500, 583);
			loc.PersonInfo = person;
			Locations.Add(loc);

			string dataPath = Environment.CurrentDirectory;
			CallRecordData = new XmlDataProvider();
			CallRecordData.Source = new Uri(dataPath + "/data/2013-03-16.xml");
			CallRecordData.InitialLoad();
		}
开发者ID:bm776688,项目名称:Televic.Controls,代码行数:19,代码来源:MainWindowViewModel.cs

示例12: MapPointsToLocations

        public static LocationCollection MapPointsToLocations(IEnumerable<MapPoint> mapPoints)
        {
            var locations = new LocationCollection();

            foreach (var mapPoint in mapPoints)
            {
                locations.Add(new Location(mapPoint.Lat, mapPoint.Lng));
            }
            return locations;
        }
开发者ID:jaccus,项目名称:CitySimulator,代码行数:10,代码来源:GeoUtilities.cs

示例13: Convert

 /// <summary>
 /// Converts a value.
 /// </summary>
 /// <param name="value">The value produced by the binding source.</param>
 /// <param name="targetType">The type of the binding target property.</param>
 /// <param name="parameter">The converter parameter to use.</param>
 /// <param name="culture">The culture to use in the converter.</param>
 /// <returns>
 /// A converted value. If the method returns null, the valid null value is used.
 /// </returns>
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     List<Coordinate> coordinates = value as List<Coordinate>;
       LocationCollection collection = new LocationCollection();
       foreach (Coordinate coord in coordinates)
       {
     collection.Add(new GeoCoordinate(coord.Latitude,coord.Longitude));
       }
       return collection;
 }
开发者ID:hoonzis,项目名称:bikeincity,代码行数:20,代码来源:LocationsConverter.cs

示例14: Convert

 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is IEnumerable<Location>)
     {
         var collection = new LocationCollection();
         foreach (var l in ((IEnumerable<Location>)value))
             collection.Add(l);
         return collection;
     }
     return null;
 }
开发者ID:soleon,项目名称:BingleMaps,代码行数:11,代码来源:RouteLocationCollectionConverter.cs

示例15: SetUpMap

        private async void SetUpMap()
        {
            LocationCollection locations = new LocationCollection();
            foreach (var station in this.Stations)
            {
                Location location = new Location() { 
                    Latitude = station.Latitude,
                    Longitude = station.Longitude
                };

                locations.Add(location);
                DrawPin.SetStationPin(location, this.Map, station);
            }

            try
            {
                Data.LocationProvider.Location locator = new Data.LocationProvider.Location();
                Point currentLocation = await locator.CurrentPosition;

                if (currentLocation != null)
                {
                    Location myLocation = new Location(currentLocation.Latitude, currentLocation.Longitude);
                    string myCity = await GetCityByLocation(myLocation);
                    DrawPin.SetMyLocationPin(myLocation, this.Map);
                    if (myCity.Contains("London"))
                    {
                        locations.Add(myLocation);
                    }
                    LocationRect mapRectangle = new LocationRect(locations);
                    this.Map.SetView(mapRectangle);
                }
                else
                {
                    Notification.ShowMessage("Sorry! Couldn't get your position! No relevant information can be provided!");
                }
            }
            catch (Exception)
            {
                Notification.ShowMessage("Sorry! Could not load data! Try to reconnect to Internet and then press Refresh!");
            }
        }
开发者ID:stamo,项目名称:LondonBicycles,代码行数:41,代码来源:MapViewModel.cs


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