/// <summary>
 /// Deprecated Method for adding a new object to the MapPoints EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMapPoints(MapPoint mapPoint)
 {
     base.AddObject("MapPoints", mapPoint);
 }
Exemple #2
0
 public static Location LocationFromMapPoint(MapPoint mapPoint)
 {
     return new Location(mapPoint.Lat, mapPoint.Lng);
 }
 /// <summary>
 /// Create a new MapPoint object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="lat">Initial value of the Lat property.</param>
 /// <param name="lng">Initial value of the Lng property.</param>
 public static MapPoint CreateMapPoint(global::System.Int32 id, global::System.Double lat, global::System.Double lng)
 {
     MapPoint mapPoint = new MapPoint();
     mapPoint.Id = id;
     mapPoint.Lat = lat;
     mapPoint.Lng = lng;
     return mapPoint;
 }
        private static Poi SelectPoi(IEnumerable<Poi> matchingPois, MapPoint personMapPoint, string selectionMethodName)
        {
            Poi selectedPoi = null;

            if (selectionMethodName == SymulationType.ShortestDistance)
            {
                var personLocation = GeoUtilities.LocationFromMapPoint(personMapPoint);

                var shortestDistance = double.MaxValue;
                foreach (var matchingPoi in matchingPois)
                {
                    var poiLocation = GeoUtilities.LocationFromMapPoint(matchingPoi.MapPoint);
                    var distance = GeoUtilities.DirectDistance(personLocation, poiLocation);

                    if (distance >= shortestDistance) continue;

                    shortestDistance = distance;
                    selectedPoi = matchingPoi;
                }
            }
            else if (selectionMethodName == SymulationType.Random)
                selectedPoi = matchingPois.ElementAt(Random.Next(0, matchingPois.Count()));

            return selectedPoi;
        }