示例#1
0
        /// <summary>
        /// Finds bus stops matching the area specified by center location and radius.
        /// </summary>
        /// <param name="pos">Position</param>
        /// <param name="radius">Rectangular search "radius" in kilometers</param>
        /// <returns>Array of Stop objects</returns>
        public static async Task <Stop[]> FindStopsByLocationAsync(BasicPosition pos, int radius)
        {
            var box      = MapExtensions.GetBoundingBox(pos, radius);
            var left     = (int)(box.MinPoint.Longitude * 3600000);
            var right    = (int)(box.MaxPoint.Longitude * 3600000);
            var top      = (int)(box.MaxPoint.Latitude * 3600000);
            var bottom   = (int)(box.MinPoint.Latitude * 3600000);
            var content  = new StringContent("left=" + left + "&bottom=" + bottom + "&right=" + right + "&top=" + top);
            var response = await _client.PostAsync(_geoUrl, content);

            var locationInfo = await DeserializeAsync <LocationInfo>(response);

            return(locationInfo.Stops);
        }
示例#2
0
 public static Position FromBasic(BasicPosition basic)
 {
     return(new Position(basic)); // accesses private ctor
 }
示例#3
0
 public void GivenIHaveANewPositionObjectAt(double x, double y)
 {
     bp = new BasicPosition(x, y);
 }
示例#4
0
 private Position(BasicPosition basic) : base(basic)
 {
     // private ctor
 }
示例#5
0
 public void GivenIHaveANewPositionObject()
 {
     bp = new BasicPosition();
 }