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

C# TripThruCore.Location类代码示例

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

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



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

示例1: Main

        static void Main()
        {
            Location fromLocation = new Location(-22.910194, -43.212211);
            Location toLocation = new Location(-22.9105337, -43.2123576);

            double Lat = fromLocation.Lat - toLocation.Lat;
            double Lng = fromLocation.Lng - toLocation.Lng;

            var result = Math.Sqrt(Math.Pow(Lat, 2) + Math.Pow(Lng, 2));
            int ocho = 9;
            /*

            var partnerConfigurations = GetPartnersConfigurations();

            using (var sr = new StreamReader("App_Data\\Geo-Routes.txt"))
            {
                var lines = sr.ReadToEnd();
                MapTools.routes = JsonConvert.DeserializeObject<Dictionary<string, Route>>(lines) ??
                                  new Dictionary<string, Route>();
            }
            using (var sr = new StreamReader("App_Data\\Geo-Location-Names.txt"))
            {
                var lines = sr.ReadToEnd();
                MapTools.locationNames = JsonConvert.DeserializeObject<Dictionary<string, string>>(lines) ??
                                         new Dictionary<string, string>();
            }
            using (var sr = new StreamReader("App_Data\\Geo-Location-Addresses.txt"))
            {
                var lines = sr.ReadToEnd();
                MapTools.locationAddresses = JsonConvert.DeserializeObject<Dictionary<string, Pair<string, string>>>(lines) ??
                                             new Dictionary<string, Pair<string, string>>();
            }

            foreach (var possibleTrip in partnerConfigurations.SelectMany(partnerConfiguration => partnerConfiguration.Fleets.ElementAt(0).PossibleTrips))
            {
                MapTools.GetRoute(possibleTrip.Start, possibleTrip.End);
            }

            var routesString = JsonConvert.SerializeObject(MapTools.routes);
            var locationNamesString = JsonConvert.SerializeObject(MapTools.locationNames);
            var locationAddresses = JsonConvert.SerializeObject(MapTools.locationAddresses);

            File.WriteAllText("App_Data\\Geo-Routes.txt", String.Empty);
            using (var sr = new StreamWriter("App_Data\\Geo-Routes.txt"))
            {
                sr.Write(routesString);
            }
            File.WriteAllText("App_Data\\Geo-Location-Names.txt", String.Empty);
            using (var sr = new StreamWriter("App_Data\\Geo-Location-Names.txt"))
            {
                sr.Write(locationNamesString);
            }
            File.WriteAllText("App_Data\\Geo-Location-Addresses.txt", String.Empty);
            using (var sr = new StreamWriter("App_Data\\Geo-Location-Addresses.txt"))
            {
                sr.Write(locationAddresses);
            }
             * */
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:59,代码来源:1397810076$Program.cs


示例2: Driver

 public Driver(string name, PartnerFleet PartnerFleet = null, Location location = null)
     : base(name)
 {
     if (PartnerFleet != null)
         PartnerFleet.AddDriver(this);
     this.PartnerFleet = PartnerFleet;
     this.location = location;
     lastUpdate = DateTime.UtcNow;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:9,代码来源:1396654558$PartnerGateway.cs


示例3: DecodePolylinePoints

        private static List<Location> DecodePolylinePoints(string encodedPoints)
        {
            if (encodedPoints == null || encodedPoints == "") return null;
            List<Location> poly = new List<Location>();
            char[] polylinechars = encodedPoints.ToCharArray();
            int index = 0;

            int currentLat = 0;
            int currentLng = 0;
            int next5bits;
            int sum;
            int shifter;

            try
            {
                while (index < polylinechars.Length)
                {
                    // calculate next latitude
                    sum = 0;
                    shifter = 0;
                    do
                    {
                        next5bits = (int)polylinechars[index++] - 63;
                        sum |= (next5bits & 31) << shifter;
                        shifter += 5;
                    } while (next5bits >= 32 && index < polylinechars.Length);

                    if (index >= polylinechars.Length)
                        break;

                    currentLat += (sum & 1) == 1 ? ~(sum >> 1) : (sum >> 1);

                    //calculate next longitude
                    sum = 0;
                    shifter = 0;
                    do
                    {
                        next5bits = (int)polylinechars[index++] - 63;
                        sum |= (next5bits & 31) << shifter;
                        shifter += 5;
                    } while (next5bits >= 32 && index < polylinechars.Length);

                    if (index >= polylinechars.Length && next5bits >= 32)
                        break;

                    currentLng += (sum & 1) == 1 ? ~(sum >> 1) : (sum >> 1);
                    Location p = new Location(Convert.ToDouble(currentLat) / 100000.0, Convert.ToDouble(currentLng) / 100000.0);
                    poly.Add(p);
                }
            }
            catch (Exception)
            {
                // log it
            }
            return poly;
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:56,代码来源:1397824053$Program.cs


示例4: GetRoute

        public static Route GetRoute(Location from, Location to)
        {
            var key = Route.GetKey(from, to);
            var route = StorageManager.GetRoute(key);
            if (route != null)
                return route;
            const double metersToMiles = 0.000621371192;
            const int maxDuration = 10;
            var doc = new XmlDocument();
            var elapse = new TimeSpan(0, 0, 0);
            double totalDistance = 0;
            var url = "http://maps.googleapis.com/maps/api/directions/xml?origin=" + from.Lat + ", " + from.Lng + "&destination=" + to.Lat + ", " + to.Lng + "&sensor=false&units=imperial";
            doc.Load(url);
            var status = doc.SelectSingleNode("//DirectionsResponse/status");

            if (status == null || status.InnerText == "ZERO_RESULTS" || status.InnerText == "OVER_QUERY_LIMIT")
            {
                Logger.LogDebug("Google request error", status != null ? status.InnerText : "status is null");
                throw new Exception("Bad route request");
            }
            var waypoints = new List<Waypoint> {new Waypoint(@from, new TimeSpan(0), 0)};
            var legs = doc.SelectNodes("//DirectionsResponse/route/leg");

            foreach (XmlNode leg in legs)
            {
                var stepNodes = leg.SelectNodes("step");
                foreach (XmlNode stepNode in stepNodes)
                {

                    var duration = int.Parse(stepNode.SelectSingleNode("duration/value").InnerText);
                    var distance = double.Parse(stepNode.SelectSingleNode("distance/value").InnerText) * metersToMiles;
                    var duration2 = new TimeSpan(0, 0, int.Parse(stepNode.SelectSingleNode("duration/value").InnerText));
                    var end = new Location(double.Parse(stepNode.SelectSingleNode("end_location/lat").InnerText), double.Parse(stepNode.SelectSingleNode("end_location/lng").InnerText));
                    var totalDistanceTemp = totalDistance;
                    totalDistance += distance;
                    var timeSpanTemp = elapse;
                    elapse += duration2;

                    if (duration > maxDuration)
                    {
                        var polyline = stepNode.SelectSingleNode("polyline/points").InnerText;
                        var locations = DecodePolylinePoints(polyline);
                        waypoints.AddRange(IncreaseLocationsEnumerable(locations, duration, timeSpanTemp.TotalSeconds, distance, totalDistanceTemp));
                    }
                    else
                    {
                        waypoints.Add(new Waypoint(end, elapse, totalDistance));
                    }
                }
            }

            waypoints.Add(new Waypoint(to, elapse, totalDistance));
            route = new Route(waypoints.ToArray());
            StorageManager.SaveRoute(route);
            return route;
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:56,代码来源:MapTools.cs


示例5: GetReverseGeoLoc

 // http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
 public static string GetReverseGeoLoc(Location location)
 {
     lock (locationNames)
     {
         string key = location.getID();
         if (locationNames.ContainsKey(key))
             return locationNames[key];
         return GetReverseGeoLocationNameFromMapService(location);
     }
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:11,代码来源:1397817436$MapTools.cs


示例6: GetReverseGeoLocAddress

 public static Pair<string, string> GetReverseGeoLocAddress(Location location)
 {
     lock (locationAddresses)
     {
         string key = location.getID();
         if (locationAddresses.ContainsKey(key))
             return locationAddresses[key];
         return GetReverseGeoAddressFromMapService(location);
     }
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:10,代码来源:1397889938$MapTools.cs


示例7: IncreaseGranularityDistance

 private static IEnumerable<Location> IncreaseGranularityDistance(Location from, Location to, double maxLatLng)
 {
     var locations = new List<Location>();
     var lat = from.Lat - to.Lat;
     var lng = from.Lng - to.Lng;
     var latCount = from.Lat;
     var lngCount = from.Lng;
     var result = Math.Sqrt(Math.Pow(lat, 2) + Math.Pow(lng, 2)); //Calculamos la hipotenusa.
     if (result > maxLatLng)//Preguntamos si es necesario Granular
     {
         var repeatTimes = (uint)(result / maxLatLng); //Obtenemos las veces que se repetira el proceso.
         var stepLat = lat / repeatTimes;
         var stepLng = lng / repeatTimes;
         for (var i = 1; i < repeatTimes; i++)
         {
             latCount -= stepLat;
             lngCount -= stepLng;
             locations.Add(new Location(latCount, lngCount));
         }
     }
     locations.Add(new Location(to.Lat, to.Lng));
     return locations;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:23,代码来源:1397824053$Program.cs


示例8: GetRoute

        public static Route GetRoute(Location from, Location to)
        {
            lock (routes)
            {
                var key = Route.GetKey(from, to);
                if (routes.ContainsKey(key))
                    return routes[key];
                const double metersToMiles = 0.000621371192;
                const int maxDuration = 10;
                var doc = new XmlDocument();
                var elapse = new TimeSpan(0, 0, 0);
                double totalDistance = 0;
                var url = "http://maps.googleapis.com/maps/api/directions/xml?origin=" + from.Lat + ", " + from.Lng + "&destination=" + to.Lat + ", " + to.Lng + "&sensor=false&units=imperial";
                doc.Load(url);
                var status = doc.SelectSingleNode("//DirectionsResponse/status");

                if (status == null || status.InnerText == "ZERO_RESULTS")
                    return null;
                var waypoints = new List<Waypoint> {new Waypoint(@from, new TimeSpan(0), 0)};
                var legs = doc.SelectNodes("//DirectionsResponse/route/leg");

                foreach (XmlNode leg in legs)
                {
                    var stepNodes = leg.SelectNodes("step");
                    foreach (XmlNode stepNode in stepNodes)
                    {

                        var duration = int.Parse(stepNode.SelectSingleNode("duration/value").InnerText);
                        var distance = double.Parse(stepNode.SelectSingleNode("distance/value").InnerText) * metersToMiles;
                        var duration2 = new TimeSpan(0, 0, int.Parse(stepNode.SelectSingleNode("duration/value").InnerText));
                        var end = new Location(double.Parse(stepNode.SelectSingleNode("end_location/lat").InnerText), double.Parse(stepNode.SelectSingleNode("end_location/lng").InnerText));
                        var totalDistanceTemp = totalDistance;
                        totalDistance += distance;
                        var timeSpanTemp = elapse;
                        elapse += duration2;

                        if (duration > maxDuration)
                        {
                            var polyline = stepNode.SelectSingleNode("polyline/points").InnerText;
                            var locations = DecodePolylinePoints(polyline);

                            waypoints.AddRange(IncreaseGranularityInPolylineList(locations, duration, maxDuration, timeSpanTemp.TotalSeconds, distance, totalDistanceTemp));

                        }
                        else
                        {
                            waypoints.Add(new Waypoint(end, elapse, totalDistance));
                        }
                    }
                }

                waypoints.Add(new Waypoint(to, elapse, totalDistance));
                var route = new Route(waypoints.ToArray());
                routes.Add(key, route);
                return route;
            }
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:57,代码来源:1397817436$MapTools.cs


示例9: FleetServesLocation

 public bool FleetServesLocation(Location l)
 {
     foreach (Zone z in coverage)
     {
         if (z.IsInside(l))
             return true;
     }
     return false;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:9,代码来源:1396654558$PartnerGateway.cs


示例10: NotifyForeignPartner

 private void NotifyForeignPartner(Status status, Location driverLocation, DateTime? eta)
 {
     Logger.Log("Since trip has foreign dependency, notify partner through TripThru");
     Logger.Tab();
     Gateway.UpdateTripStatusRequest request = new Gateway.UpdateTripStatusRequest(
         clientID: partner.ID,
         tripID: ID,
         status: status,
         driverLocation: driverLocation,
         eta: eta
     );
     partner.tripthru.UpdateTripStatus(request);
     Logger.Untab();
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:14,代码来源:1396654558$PartnerGateway.cs


示例11: IncreaseGranularityDistance

        private static IEnumerable<Location> IncreaseGranularityDistance(Location from, Location to, double maxLatLng)
        {
            var locations = new List<Location>();

            double Lat = from.Lat - to.Lat;
            double Lng = from.Lng - from.Lat;
            var latCount = from.Lat;
            var lngCount = from.Lng;
            var result = Math.Sqrt(Math.Pow(Lat, 2) + Math.Pow(Lng, 2)); //Calculamos la hipotenusa.
            if (result > maxLatLng)//Preguntamos si es necesario Granular
            {
                var repeatTimes = (int)(result/maxLatLng); //Obtenemos las veces que se repetira el proceso.
                var stepLat = Lat / repeatTimes;
                var stepLng = Lng / repeatTimes;
                for (var i = 0; i < repeatTimes; i++)
                {
                    latCount += stepLat;
                    lngCount += stepLng;
                    locations.Add(new Location(latCount,lngCount));
                }
            }
            return null;
            /*
            List<Waypoint> wayPoints = new List<Waypoint>();

            double granularity = duration / maxDuration;
            double stepDistance = (distance / granularity) + totalDistance;
            double stepDistaceCount = 0;
            double durationCount = totalDuration;
            double stepLat = from.Lat - to.Lat;
            double stepLng = from.Lng - to.Lng;
            double subStepLat = stepLat / granularity;
            double subStepLng = stepLng / granularity;

            for (int i = 0; i <= (granularity - 1); i++)
            {
                from.Lat -= subStepLat;
                from.Lng -= subStepLng;
                Location location = new Location(from.Lat, from.Lng);

                durationCount += maxDuration;
                stepDistaceCount += stepDistance;

                TimeSpan timeSpan = new TimeSpan(0, 0, (int)durationCount);
                wayPoints.Add(new Waypoint(location, timeSpan, stepDistaceCount));
            }
            wayPoints.Add(new Waypoint(from, new TimeSpan(0, 0, ((int)totalDuration + duration)), stepDistaceCount));

            return wayPoints;
             */
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:51,代码来源:1397813264$MapTools.cs


示例12: Zone

 public Zone(Location center, double radius)
 {
     this.Center = center;
     this.Radius = radius;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:5,代码来源:1396867459$Gateway.cs


示例13: IsInside

 public bool IsInside(Location l)
 {
     double lat1 = DegreesToRadians(Center.Lat);
     double lng1 = DegreesToRadians(Center.Lng);
     double lat2 = DegreesToRadians(l.Lat);
     double lng2 = DegreesToRadians(l.Lng);
     double dlon = lng2 - lng1;
     double dlat = lat2 - lat1;
     double a = Math.Pow(Math.Sin(dlat / 2.0), 2) + Math.Cos(lat1) * Math.Cos(lat2) * Math.Pow(Math.Sin(dlon / 2.0), 2);
     double c = 2.0 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
     double d = 3961.0 * c; // (where 3961 is the radius of the Earth in miles
     return d < Radius;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:13,代码来源:1396867459$Gateway.cs


示例14: Equals

 public bool Equals(Location l, double tolerance = .005)
 {
     double distance = GetDistance(l);
     return distance < tolerance;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:5,代码来源:1396867459$Gateway.cs


示例15: UpdateTripStatusRequest

 public UpdateTripStatusRequest(string clientID, string tripID, Status status, Location driverLocation = null, DateTime? eta = null)
 {
     this.clientID = clientID;
     this.tripID = tripID;
     this.status = status;
     this.driverLocation = driverLocation;
     this.eta = eta;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:8,代码来源:1396867459$Gateway.cs


示例16: GetRoute

        /*
        // http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false
        public static Route GetRoute(Location from, Location to)
        {//GETROUTEOSCAR
            lock (routes)
            {
                string key = Route.GetKey(from, to);
                if (routes.ContainsKey(key))
                    return routes[key];
                double METERS_TO_MILES = 0.000621371192;
                int MAX_DURATION = 10;
                XmlDocument doc = new XmlDocument();
                TimeSpan elapse = new TimeSpan(0, 0, 0);
                double totalDistance = 0;
                string url = "http://maps.googleapis.com/maps/api/directions/xml?origin=" + from.Lat + ", " + from.Lng + "&destination=" + to.Lat + ", " + to.Lng + "&sensor=false&units=imperial";
                doc.Load(url);
                XmlNode status = doc.SelectSingleNode("//DirectionsResponse/status");
                if (status == null || status.InnerText == "ZERO_RESULTS")
                    return null;
                List<Waypoint> waypoints = new List<Waypoint>();
                waypoints.Add(new Waypoint(from, new TimeSpan(0), 0));
                var legs = doc.SelectNodes("//DirectionsResponse/route/leg");
                foreach (XmlNode leg in legs)
                {
                    var stepNodes = leg.SelectNodes("step");
                    foreach (XmlNode stepNode in stepNodes)
                    {
                        int duration = int.Parse(stepNode.SelectSingleNode("duration/value").InnerText);
                        double distance = double.Parse(stepNode.SelectSingleNode("distance/value").InnerText) * METERS_TO_MILES;
                        TimeSpan duration2 = new TimeSpan(0, 0, int.Parse(stepNode.SelectSingleNode("duration/value").InnerText));
                        Location end = new Location(double.Parse(stepNode.SelectSingleNode("end_location/lat").InnerText), double.Parse(stepNode.SelectSingleNode("end_location/lng").InnerText));
                        totalDistance += distance;
                        TimeSpan timeSpanTemp = elapse;
                        elapse += duration2;

                        if (duration > MAX_DURATION)
                        {
                            Location start = new Location(double.Parse(stepNode.SelectSingleNode("start_location/lat").InnerText), double.Parse(stepNode.SelectSingleNode("start_location/lng").InnerText));
                            waypoints.AddRange(IncreaseGranularity(duration, MAX_DURATION, timeSpanTemp.TotalSeconds, distance, start, end));
                        }
                        else
                        {
                            waypoints.Add(new Waypoint(end, elapse, totalDistance));
                        }

                    }
                }
                waypoints.Add(new Waypoint(to, elapse, totalDistance));
                Route route = new Route(waypoints.ToArray());
                routes.Add(key, route);
                return route;
            }
        }

        private static List<Waypoint> IncreaseGranularity(int duration, int maxDuration, double totalDuration, double distance, Location from, Location to)
        {
            List<Waypoint> wayPoints = new List<Waypoint>();

            double granularity = (duration / maxDuration);
            double stepDistance = distance / granularity;
            double stepDistaceCount = 0;
            double durationCount = totalDuration;
            double stepLat = from.Lat - to.Lat;
            double stepLng = from.Lng - to.Lng;
            double subStepLat = stepLat / granularity;
            double subStepLng = stepLng / granularity;
            for (int i = 0; i < (granularity - 1); i++)
            {
                from.Lat -= subStepLat;
                from.Lng -= subStepLng;
                Location location = new Location(from.Lat, from.Lng);

                durationCount += maxDuration;
                stepDistaceCount += stepDistance;

                TimeSpan timeSpan = new TimeSpan(0, 0, (int)durationCount);
                wayPoints.Add(new Waypoint(location, timeSpan, stepDistaceCount));

            }
            return wayPoints;
        } */
        /*public static Route GetCachedRoute(Location from, Location to)
        {
            string key = Route.GetKey(from, to);
            if (routes.ContainsKey(key))
                return routes[key];
            /*            foreach (Route r in routes.Values)
                        {
                            if (r.ContainsSubRoute(from, to))
                            {
                                Route route = r.MakeSubRoute(from, to);
                                routes.Add(key, route);
                            }
                        } */
        //  return null;
        //}
        // http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false
        /*public static Route GetRoute(Location from, Location to)
        {
            lock (routes)
//.........这里部分代码省略.........
开发者ID:TripThru,项目名称:Gateway,代码行数:101,代码来源:1397674645$MapTools.cs


示例17: Main

        static void Main()
        {
            Location fromLocation = new Location(37.78374, -122.4143);
            Location toLocation = new Location(37.78466, -122.41447);

            double Lat = fromLocation.Lat - toLocation.Lat;
            double Lng = fromLocation.Lng - toLocation.Lng;

            var timeSpan = new TimeSpan(0, 0, 300);

            List<Location> locations = DecodePolylinePoints(@"upreFx_djVuAPwD`@{[email protected]@_CX}@L}[email protected]}BX{@H");
            var wayPoints = IncreaseLocationsEnumerable(locations, 300, 10, 0, 500, 0);

            //var locations = IncreaseGranularityDistance(fromLocation, toLocation, 0.0001);

            var result = Math.Sqrt(Math.Pow(Lat, 2) + Math.Pow(Lng, 2));
            int ocho = 9;
            /*

            var partnerConfigurations = GetPartnersConfigurations();

            using (var sr = new StreamReader("App_Data\\Geo-Routes.txt"))
            {
                var lines = sr.ReadToEnd();
                MapTools.routes = JsonConvert.DeserializeObject<Dictionary<string, Route>>(lines) ??
                                  new Dictionary<string, Route>();
            }
            using (var sr = new StreamReader("App_Data\\Geo-Location-Names.txt"))
            {
                var lines = sr.ReadToEnd();
                MapTools.locationNames = JsonConvert.DeserializeObject<Dictionary<string, string>>(lines) ??
                                         new Dictionary<string, string>();
            }
            using (var sr = new StreamReader("App_Data\\Geo-Location-Addresses.txt"))
            {
                var lines = sr.ReadToEnd();
                MapTools.locationAddresses = JsonConvert.DeserializeObject<Dictionary<string, Pair<string, string>>>(lines) ??
                                             new Dictionary<string, Pair<string, string>>();
            }

            foreach (var possibleTrip in partnerConfigurations.SelectMany(partnerConfiguration => partnerConfiguration.Fleets.ElementAt(0).PossibleTrips))
            {
                MapTools.GetRoute(possibleTrip.Start, possibleTrip.End);
            }

            var routesString = JsonConvert.SerializeObject(MapTools.routes);
            var locationNamesString = JsonConvert.SerializeObject(MapTools.locationNames);
            var locationAddresses = JsonConvert.SerializeObject(MapTools.locationAddresses);

            File.WriteAllText("App_Data\\Geo-Routes.txt", String.Empty);
            using (var sr = new StreamWriter("App_Data\\Geo-Routes.txt"))
            {
                sr.Write(routesString);
            }
            File.WriteAllText("App_Data\\Geo-Location-Names.txt", String.Empty);
            using (var sr = new StreamWriter("App_Data\\Geo-Location-Names.txt"))
            {
                sr.Write(locationNamesString);
            }
            File.WriteAllText("App_Data\\Geo-Location-Addresses.txt", String.Empty);
            using (var sr = new StreamWriter("App_Data\\Geo-Location-Addresses.txt"))
            {
                sr.Write(locationAddresses);
            }
             * */
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:66,代码来源:1397824053$Program.cs


示例18: PartnerTrip

 public PartnerTrip(Partner partner, string ID, Origination origination, Location pickupLocation, DateTime pickupTime, PaymentMethod? paymentMethod = null, string passengerID = null, string passengerName = null, Location dropoffLocation = null,
    DateTime? dropoffTime = null, List<Location> waypoints = null, VehicleType? vehicleType = null, double? maxPrice = null, int? minRating = null, PartnerFleet fleet = null, Driver driver = null, TimeSpan? duration = null, TimeSpan? driverRouteDuration = null, double? price = null)
 {
     this.ID = ID;
     this.origination = origination;
     this.service = Origination.Local;
     this.partner = partner;
     this.passengerID = passengerID;
     this.passengerName = passengerName;
     this.pickupLocation = pickupLocation;
     this.pickupTime = pickupTime;
     this.duration = duration;
     this.dropoffLocation = dropoffLocation;
     this.dropoffTime = dropoffTime;
     this.waypoints = waypoints;
     this.paymentMethod = paymentMethod;
     this.vehicleType = vehicleType;
     this.maxPrice = maxPrice;
     this.minRating = minRating;
     this.PartnerFleet = fleet;
     this.driver = driver;
     this.price = price;
     this.UpdateTripStatus(notifyPartner: false, status: Status.New);
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:24,代码来源:1396654558$PartnerGateway.cs


示例19: GetTripStatusResponse

 public GetTripStatusResponse(string partnerID = null, string partnerName = null, string fleetID = null, string fleetName = null, string originatingPartnerName = null,
     string servicingPartnerName = null, string driverID = null, string driverName = null, Location driverLocation = null, Location driverInitialLocation = null, VehicleType? vehicleType = null, string passengerName = null,
     DateTime? ETA = null, Status? status = null, DateTime? pickupTime = null, Location pickupLocation = null, DateTime? dropoffTime = null, Location dropoffLocation = null,
     double? price = null, double? distance = null, double? driverRouteDuration = null, Result result = Result.OK
      )
 {
     this.partnerID = partnerID;
     this.partnerName = partnerName;
     this.fleetID = fleetID;
     this.fleetName = fleetName;
     this.passengerName = passengerName;
     this.driverID = driverID;
     this.driverName = driverName;
     this.driverLocation = driverLocation;
     this.driverInitialLocation = driverInitialLocation;
     this.vehicleType = vehicleType;
     this.ETA = ETA;
     this.pickupTime = pickupTime;
     this.pickupLocation = pickupLocation;
     this.dropoffLocation = dropoffLocation;
     this.dropoffTime = dropoffTime;
     this.price = price;
     this.distance = distance;
     this.driverRouteDuration = driverRouteDuration;
     this.result = result;
     this.status = status;
     this.originatingPartnerName = originatingPartnerName;
     this.servicingPartnerName = servicingPartnerName;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:29,代码来源:1396867459$Gateway.cs


示例20: GetRouteFromMapService

 private static Route GetRouteFromMapService(Location from, Location to, Route route)
 {
     double METERS_TO_MILES = 0.000621371192;
     XmlDocument doc = new XmlDocument();
     TimeSpan elapse = new TimeSpan(0, 0, 0);
     double totalDistance = 0;
     string url = "http://maps.googleapis.com/maps/api/directions/xml?origin=" + from.Lat + ", " + from.Lng + "&destination=" + to.Lat + ", " + to.Lng + "&sensor=false";
     doc.Load(url);
     XmlNode status = doc.SelectSingleNode("//DirectionsResponse/status");
     if (status != null && status.InnerText != "ZERO_RESULTS")
     {
         List<Waypoint> waypoints = new List<Waypoint>();
         waypoints.Add(new Waypoint(from, new TimeSpan(0), 0));
         var legs = doc.SelectNodes("//DirectionsResponse/route/leg");
         foreach (XmlNode leg in legs)
         {
             var stepNodes = leg.SelectNodes("step");
             foreach (XmlNode stepNode in stepNodes)
             {
                 TimeSpan duration = new TimeSpan(0, 0, (int)(int.Parse(stepNode.SelectSingleNode("duration/value").InnerText) * distance_and_time_scale));
                 Location end = new Location(double.Parse(stepNode.SelectSingleNode("end_location/lat").InnerText), double.Parse(stepNode.SelectSingleNode("end_location/lng").InnerText));
                 double distance = double.Parse(stepNode.SelectSingleNode("distance/value").InnerText) * METERS_TO_MILES * distance_and_time_scale;
                 totalDistance += distance;
                 elapse += duration;
                 waypoints.Add(new Waypoint(end, elapse, totalDistance));
             }
         }
         waypoints.Add(new Waypoint(to, elapse, totalDistance));
         route = new Route(waypoints.ToArray());
     }
     return route;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:32,代码来源:1397672821$MapTools.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TripThruCore.PartnerTrip类代码示例发布时间:2022-05-26
下一篇:
C# TripThruCore.Gateway类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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