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


C# LocationCollection类代码示例

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


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


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