Пример #1
0
 public void SetGoogleDistance(GoogleDistanceDTO distance)
 {
     if (_segmentsCount % 2 == 0)
     {
         _lastdistance = distance;
     }
     else
     {
         if (_lastdistance.distance.value > distance.distance.value)
         {
             RouteDistance += distance.distance.value;
             RouteDuration += distance.duration.value;
         }
         else
         {
             RouteDistance += _lastdistance.distance.value;
             RouteDuration += _lastdistance.duration.value;
         }
     }
     _segmentsCount++;
     StateHasChanged();
 }
 public static void SetResult(GoogleDistanceDTO result, LocationDTO start, LocationDTO end)
 {
     if (_segmentsCount % 2 == 0)
     {
         _lastResult = result;
     }
     else
     {
         if (result.distance.value > _lastResult.distance.value)
         {
             Result = result;
         }
         else
         {
             Result = _lastResult;
         }
         if (!MemorizationDictionary.ContainsKey(start))
         {
             MemorizationDictionary[start] = new Dictionary <LocationDTO, GoogleDistanceDTO>(new LocationDTOComparer());
         }
         MemorizationDictionary[start][end] = Result;
     }
     _segmentsCount++;
 }