コード例 #1
0
        private void SetGeolocationInfo(RouteServiceParameterDTO routeInfo)
        {
            Address address = GetAddressInfoObject(routeInfo);

            DS.DistributedServices.ServiceProxies.AddressFinder.Point point = GetGeoLocationFromWebService(address);
            if (point == null)
            {
                ThrowFaultException("Error while processing request !");
            }

            routeInfo.x = point.x;
            routeInfo.y = point.y;
        }
コード例 #2
0
        private RouteStop GetRouteStopInfo(RouteServiceParameterDTO routeDetails)
        {
            var routeStopDetails = new RouteStop()
            {
                description = routeDetails.StreetAvenueName + "," + routeDetails.Number + " - " + routeDetails.City + " - " + routeDetails.State,
                point       = new DistributedServices.ServiceProxies.RouteProximity.Point()
                {
                    x = routeDetails.x, y = routeDetails.y
                }
            };

            return(routeStopDetails);
        }
コード例 #3
0
        private void btnTestService_Click(object sender, EventArgs e)
        {
            RouteService.IRouteService RouteService  = new RouteServiceClient();
            RouteServiceParameterDTO   originalroute = new RouteServiceParameterDTO();

            //originalroute.StreetAvenueName = "Rua XYZ de ABC";
            originalroute.StreetAvenueName = "Rua Jose Fabiano Rodrigues";
            originalroute.Number           = "10";
            originalroute.City             = "Osasco";
            originalroute.State            = "SP";

            RouteServiceParameterDTO destinationroute = new RouteServiceParameterDTO();

            destinationroute.StreetAvenueName = "Avenida Manoel Pedro Pimentel";
            destinationroute.Number           = "155";
            destinationroute.City             = "Osasco";
            destinationroute.State            = "SP";

            GetRouteRequest inValue = new GetRouteRequest();

            inValue.Body = new GetRouteRequestBody();
            RouteServiceParameterRequestDTO routeServiceParameterRequestDTO = new RouteServiceParameterRequestDTO();

            routeServiceParameterRequestDTO.originalRoute    = originalroute;
            routeServiceParameterRequestDTO.destinationRoute = destinationroute;
            routeServiceParameterRequestDTO.routeType        = RouteType.FastestRoute;
            inValue.Body.routeParameterRequest = routeServiceParameterRequestDTO;

            try
            {
                GetRouteResponse retVal = RouteService.GetRoute(inValue);
                string           result = "Distancia Total {0}. Custo Combustivel {1}. Tempo Total Rota {2}. Custo Considerando Pedagio {3}";
                if (retVal.Body.GetRouteResult != null)
                {
                    MessageBox.Show(string.Format(result, retVal.Body.GetRouteResult.TotalDistance.ToString(),
                                                  retVal.Body.GetRouteResult.TotalFuelCost.ToString(),
                                                  retVal.Body.GetRouteResult.TotalTime.ToString(),
                                                  retVal.Body.GetRouteResult.TotalTollFeeCost.ToString()));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #4
0
        private Address GetAddressInfoObject(RouteServiceParameterDTO routeServiceParameterDTO)
        {
            Address address = null;

            if (routeServiceParameterDTO != null)
            {
                address = new Address()
                {
                    street      = routeServiceParameterDTO.StreetAvenueName,
                    houseNumber = routeServiceParameterDTO.Number,
                    city        = new DS.DistributedServices.ServiceProxies.AddressFinder.City()
                    {
                        name = routeServiceParameterDTO.City, state = routeServiceParameterDTO.State
                    }
                };
            }

            return(address);
        }