• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LocationCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: MoveToShipAtRange

 public MoveToShipAtRange(Ship targetShip, int range, LocationCollection locations)
 {
     this.OrderValues = new object[3];
     this.OrderValues[0] = targetShip;
     this.OrderValues[1] = range;
     this.OrderValues[2] = locations;
 }
开发者ID:NevermoreDCE,项目名称:Dalek,代码行数:7,代码来源:MoveToShipAtRange.cs


示例4: GenerateMapScriptCore

        /// <summary>
        /// Registers the JavaScript to display the map.
        /// </summary>
        /// <param name="scriptManager">The page's script manager.</param>
        /// <param name="mapType">Type of the map.</param>
        /// <param name="mapSectionId">The ID of the section (div) on the page in which the map should be created.</param>
        /// <param name="currentLocationSpanId">The ID of the span showing the current location text.</param>
        /// <param name="noLocationSpanId">The ID of the span shown when no location is selected.</param>
        /// <param name="instructionSpanId">The ID of the span with driving directions, etc.</param>
        /// <param name="directionsLinkId">The ID of the link to driving directions.</param>
        /// <param name="directionsSectionId">The ID of the section (div) with driving directions text.</param>
        /// <param name="locations">The list of locations to display.</param>
        /// <param name="showAllLocationsOnLoad">if set to <c>true</c> shows the map with all locations on it by default.</param>
        public override void GenerateMapScriptCore(ScriptManager scriptManager, MapType mapType, string mapSectionId, string currentLocationSpanId, string noLocationSpanId, string instructionSpanId, string directionsLinkId, string directionsSectionId, LocationCollection locations, bool showAllLocationsOnLoad)
        {
            ICollection<JavaScript.Location> locationsAsJson = locations.AsJson();
            string mapParameters = String.Format(CultureInfo.InvariantCulture, "currentLocationSpan: {0}, noLocationSpan: {1}, instructionSpan: {2}, directionsLink: {3}, directionsSection: {4}, mapType: {5}, locationsArray: {6}", GetElementJavaScript(currentLocationSpanId), GetElementJavaScript(noLocationSpanId), GetElementJavaScript(instructionSpanId), GetElementJavaScript(directionsLinkId), GetElementJavaScript(directionsSectionId), ConvertMapType(mapType), new JavaScriptSerializer().Serialize(locationsAsJson));

            scriptManager.Scripts.Add(new ScriptReference(GetLoaderUrl(this.ApiKey)));
            scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.BaseLocator.js", "EngageLocator"));
            scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.GoogleLocator.js", "EngageLocator"));
            ScriptManager.RegisterStartupScript(
                    scriptManager.Page,
                    typeof(GoogleProvider),
                    "Initialize",
                    "google.setOnLoadCallback(jQuery(function(){ jQuery.noConflict(); $create(Engage.Dnn.Locator.GoogleMap, {" + mapParameters + "}, {}, {}, $get('" + mapSectionId + "')); }));",
                    true);

            if (showAllLocationsOnLoad)
            {
                ScriptManager.RegisterStartupScript(
                        scriptManager.Page,
                        typeof(GoogleProvider),
                        "showAllLocations",
                        "google.setOnLoadCallback(jQuery(function(){ $find('" + mapSectionId + "$GoogleMap').showAllLocations(); }));",
                        true);
            }
        }
开发者ID:EngageSoftware,项目名称:Engage-Locator,代码行数:38,代码来源:GoogleProvider.cs


示例5: start

        public void start(MainPage mainPage)
        {
            mainPage.drawALineButton.Content = "Turn off drawing line mode";
            this.locationCollection = new LocationCollection();

            Debug.WriteLine("Start drawing a line");
        }
开发者ID:gdgkyoto,项目名称:kyoto-gtug,代码行数:7,代码来源:MapLineMode.cs


示例6: Unit

 /// <summary>Creates a new <see cref="Unit"/> instance.
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="power">Power.</param>
 /// <param name="location">Location.</param>
 public Unit(UnitType type, Power power, Location location)
 {
     this.type = type;
     this.power = power;
     this.location = location;
     this.retreatLocations = new LocationCollection();
 }
开发者ID:evandrix,项目名称:DAIDE10,代码行数:12,代码来源:Unit.cs


示例7: AddPath

        public void AddPath(LocationCollection polyPoints, SolidColorBrush brush, PathDirectionType direction)
        {
            MapPolygon poly = new MapPolygon();
            poly.Opacity = 0.8;
            poly.StrokeThickness = 3;
            poly.Stroke = brush;
            poly.Locations = polyPoints;
            Children.Add(poly);

            int numPoints = 1;
            while (numPoints * 10 < polyPoints.Count)
                numPoints *= 2;

            for (int i = 0; i < numPoints; i++)
            {
                int j = i * (polyPoints.Count / numPoints);

                if (j < polyPoints.Count)
                {
                    Location loc = polyPoints[j];

                    BountyPushpin pin = new BountyPushpin();
                    pin.ToolTip = string.Format("{0} ({1}Path)", BountyName,
                            (direction == PathDirectionType.Invalid ? string.Empty : Enum.GetName(typeof(PathDirectionType), direction) + " "));
                    pin.PopupContent = new PopupContentFactory()
                            .AppendWikiLink(BountyName)
                            .AppendDulfyLink(BountyName)
                            .Content;
                    pin.Location = loc;
                    Children.Add(pin);
                }
            }
        }
开发者ID:nexaddo,项目名称:GuildWars2,代码行数:33,代码来源:BountyMapLayer.cs


示例8: 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


示例9: 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


示例10: RouteModel

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


示例11: LocationCollectionToCoordinates

 public static ICoordinate[] LocationCollectionToCoordinates(LocationCollection locations)
 {
     var coordinates = new Coordinate[locations.Count];
     for (var x = 0; x < locations.Count; x++)
     {
         coordinates[x] = (Coordinate)Convert(locations[x]);
     }
     return (ICoordinate[])coordinates;
 }
开发者ID:HogwartsRico,项目名称:AGS-PgRouting,代码行数:9,代码来源:CoordinateConvertor.cs


示例12: 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


示例13: 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


示例14: Game

 public Game(SerializationInfo info, StreamingContext context)
 {
     CombatLocations = (LocationCollection)info.GetValue("CombatLocations", typeof(LocationCollection));
     StarSystems = (StarSystemCollection)info.GetValue("StarSystems", typeof(StarSystemCollection));
     Players = (PlayerCollection)info.GetValue("Players", typeof(PlayerCollection));
     ExistingHulls = (List<ShipHull>)info.GetValue("ExistingHulls", typeof(List<ShipHull>));
     ExistingParts = (List<EidosPart>)info.GetValue("ExistingParts", typeof(List<EidosPart>));
     ExistingShips = (List<Ship>)info.GetValue("ExistingShips", typeof(List<Ship>));
 }
开发者ID:NevermoreDCE,项目名称:Dalek,代码行数:9,代码来源:Game.cs


示例15: AsLocationCollection

        //public static Route AsRoute(this GoogleApisLib.GoogleMapsApi.DirectionsRoute googleRoute)
        //{
        //    var route = new Route();
        //    route.OverviewPath = googleRoute.overview_path.AsLocationCollection();
        //    route.Directions = new ObservableCollection<Direction>();
        //    foreach (var leg in googleRoute.legs)
        //    {
        //        route.Directions.Add(leg.AsDirection());
        //    }
        //    return route;
        //}
        //public static Direction AsDirection(this GoogleApisLib.GoogleMapsApi.DirectionsLeg googleLeg)
        //{
        //    var direction = new Direction
        //        {
        //            Distance = googleLeg.distance.value,
        //            Duration = TimeSpan.FromSeconds(googleLeg.duration.value),
        //            StartLocation = googleLeg.start_location.AsGeoCoordinate(),
        //            EndLocation = googleLeg.end_location.AsGeoCoordinate(),
        //            StartAddress = googleLeg.start_address,
        //            EndAddress = googleLeg.end_address,
        //            ////StartTime = DateTime.Parse(googleLeg.departure_time.value),
        //            ////EndTime = DateTime.Parse(googleLeg.arrival_time.value)
        //        };
        //    if (googleLeg.steps != null)
        //    {
        //        direction.Steps = new ObservableCollection<DirectionStep>();
        //        foreach (var googleStep in googleLeg.steps)
        //        {
        //            direction.Steps.Add(googleStep.AsDirectionStep());
        //        }
        //    }
        //    return direction;
        //}
        //public static DirectionStep AsDirectionStep(this GoogleApisLib.GoogleMapsApi.DirectionsStep googleStep)
        //{
        //    var directionStep = new DirectionStep
        //        {
        //            Instructions = googleStep.instructions,
        //            Distance = googleStep.distance.value,
        //            Duration = TimeSpan.FromSeconds(googleStep.duration.value),
        //            StartLocation = googleStep.start_location.AsGeoCoordinate(),
        //            EndLocation = googleStep.end_location.AsGeoCoordinate(),
        //            Mode = googleStep.travel_mode.ToString(),
        //            OverviewPath = googleStep.path.AsLocationCollection()
        //        };
        //    if (googleStep.steps != null)
        //    {
        //        directionStep.Steps = new ObservableCollection<DirectionStep>();
        //        foreach (var innerStep in googleStep.steps)
        //        {
        //            directionStep.Steps.Add(innerStep.AsDirectionStep());
        //        }
        //    }
        //    return directionStep;
        //}
        public static LocationCollection AsLocationCollection(this GoogleApisLib.GoogleMapsApi.LatLng[] coordinates)
        {
            var collection = new LocationCollection();
            foreach (var coordinate in coordinates)
            {
                collection.Add(coordinate.AsGeoCoordinate());
            }

            return collection;
        }
开发者ID:kyvok,项目名称:TransitWP7,代码行数:66,代码来源:GoogleMapsApiExtensions.cs


示例16: 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


示例17: 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


示例18: Convert

 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (!(value is IEnumerable<Location>))
     {
         return null;
     }
     var collection = new LocationCollection();
     collection.AddRange(((IEnumerable<Location>) value).Select(l => l.ToGeoCoordinate()));
     return collection;
 }
开发者ID:soleon,项目名称:Travlexer,代码行数:10,代码来源:LocationListToLocationCollectionConverter.cs


示例19: ToLocationCollection

		/// <summary>
		/// Gets a LocationCollection representing an enumeration of points.
		/// </summary>
		/// <param name="ezp"></param>
		/// <returns></returns>
		public static LocationCollection ToLocationCollection(this IEnumerable<ZonePoint> ezp)
		{
			LocationCollection coll = new LocationCollection();

			foreach (ZonePoint p in ezp)
			{
				coll.Add(p.ToGeoCoordinate());
			}

			return coll;
		}
开发者ID:chier01,项目名称:WF.Player.WinPhone,代码行数:16,代码来源:WherigoExtensions.cs


示例20: IsLocationInComplexPolygon

        //LocationCollection
        //public static bool IsLocationInComplexPolygon(List<Location> mainPolygon, List<List<Location>> holes, Location checkPoint)
        public static bool IsLocationInComplexPolygon(LocationCollection mainPolygon, List<LocationCollection> holes, Location checkPoint)
        {
            if (checkPoint != null)
            {
                // check if point is inside boundary box
                double minX = mainPolygon[0].Latitude;
                double maxX = mainPolygon[0].Latitude;
                double minY = mainPolygon[0].Longitude;
                double maxY = mainPolygon[0].Longitude;

                foreach (var q in mainPolygon)
                {
                    minX = Math.Min(q.Latitude, minX);
                    maxX = Math.Max(q.Latitude, maxX);
                    minY = Math.Min(q.Longitude, minY);
                    maxY = Math.Max(q.Longitude, maxY);
                }

                if (checkPoint.Latitude < minX || checkPoint.Latitude > maxX || checkPoint.Longitude < minY || checkPoint.Longitude > maxY)
                {
                    // point is not inside boundary box, do not continue
                    return false;
                }

                // check if point is inside main polygon
                var result = IsLocationInPolygon(mainPolygon, checkPoint);

                // point is not inside main polygon, do not continue
                if (result == false) return false;

                // check if point is not inside of any hole
                if (holes != null)
                {
                    foreach (var holePolygon in holes)
                    {
                        var holeResult = IsLocationInPolygon(holePolygon, checkPoint);

                        if (holeResult)
                        {
                            // point is inside hole, that means it doesn't belong to complex polygon, return false
                            return false;
                        }
                    }
                }

                // if all tests passed then point is inside Polygon.
                return true;

            }
            else
            {
                return false;
            }
        }
开发者ID:Wosad,项目名称:Wosad.Design,代码行数:56,代码来源:PolygonLocationChecking.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LocationInfo类代码示例发布时间:2022-05-24
下一篇:
C# Location类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap