Example #1
0
 static void TestInitMatrixAsync(
     IGoogleMapClient googleMapClient,
     List <string> locations,
     string key)
 {
     var result = googleMapClient.Hamilton
                  .Find(locations, 10000, key).Result;
 }
Example #2
0
 static void TestHamilton(
     IGoogleMapClient googleMapClient,
     List <string> cities,
     string key)
 {
     var result = googleMapClient.Hamilton
                  .Find(cities, 100, key)
                  .Result;
 }
Example #3
0
        static void TestInitMatrix(
            IGoogleMapClient googleMapClient,
            List <string> cities,
            string key)
        {
            var range = 10000;

            int[,] matrix = new int[9, 9];

            for (int i = 0; i < cities.Count; i++)
            {
                for (int j = 0; j < cities.Count; j++)
                {
                    var directions = googleMapClient.Routes
                                     .GetDirection(new DirectionRequest()
                    {
                        origin      = cities[i],
                        destination = cities[j]
                    }, key).Result;

                    var distanceDefault = GetDistance(directions.Data);

                    if (distanceDefault > 0 || i == j)
                    {
                        matrix[i, j] = 1;
                    }

                    for (int k = 0; k < cities.Count; k++)
                    {
                        var distanceCheck = 0L;

                        if (k == i || k == j)
                        {
                            continue;
                        }

                        var checkDirections = googleMapClient.Routes
                                              .GetDirection(new DirectionRequest()
                        {
                            origin      = cities[i],
                            destination = cities[j],
                            waypoints   = cities[k]
                        }, key).Result;

                        distanceCheck = GetDistance(checkDirections.Data);

                        if ((distanceCheck - distanceDefault) < range)
                        {
                            matrix[i, j] = 0;
                        }
                    }
                }
            }
            var hamilton      = new Hamilton(10);
            var arrayHamilton = hamilton.FindHamilton(matrix, cities.Count);
        }
Example #4
0
 static void TestFindPlace(
     IGoogleMapClient googleMapClient,
     string key)
 {
     var result = googleMapClient.Places
                  .FindPlace(new GoogleMap.Models.Places.PlaceSearch.FindPlaceRequest()
     {
         input = "Thành phố Hồ Chí Minh"
     }, key).Result;
 }
Example #5
0
 static void TestTextSearch(
     IGoogleMapClient googleMapClient,
     string key)
 {
     var result = googleMapClient.Places
                  .TextSearch(new GoogleMap.Models.Places.PlaceSearch.TextSearchRequest()
     {
         query = "Bến Thành"
     }, key).Result;
 }
Example #6
0
 static void TestGetGeocoding(
     IGoogleMapClient googleMapClient,
     string key)
 {
     var result = googleMapClient.Places
                  .Geocoding(new GoogleMap.Models.Places.GeocodingRequest()
     {
         address = "Thành phố Hồ Chí Minh"
     }, key).Result;
 }
Example #7
0
 static void TestGetPlaceDetail(
     IGoogleMapClient googleMapClient,
     string key)
 {
     var result = googleMapClient.Places
                  .PlaceDetail(new GoogleMap.Models.Places.PlaceDetailRequest()
     {
         place_id = "ChIJN1t_tDeuEmsRUsoyG83frY4"
     }, key).Result;
 }
Example #8
0
 static void TestGetPlaceAutocomplete(
     IGoogleMapClient googleMapClient,
     string key)
 {
     var result = googleMapClient.Places
                  .PlaceAutocomplete(new GoogleMap.Models.Places.PlaceAutocompleteRequest()
     {
         input = "Bến Thành"
     }, key).Result;
 }
Example #9
0
        static void TestGetDirection(
            IGoogleMapClient googleMapClient,
            DirectionRequest request,
            string key)
        {
            var result = googleMapClient.Routes
                         .GetDirection(request, key)
                         .Result;

            var data = result.Data;
        }
Example #10
0
        static void TestGetDistanceMatrix(
            IGoogleMapClient googleMapClient,
            GoogleMap.Models.Routes.DistanceMatrix.DistanceMatrixRequest request,
            string key)
        {
            var result = googleMapClient.Routes
                         .GetDistanceMatrix(request, key)
                         .Result;

            var data = result.Data;
        }
Example #11
0
 static void TestNearbySearch(
     IGoogleMapClient googleMapClient,
     string key)
 {
     var result = googleMapClient.Places
                  .NearbySearch(new GoogleMap.Models.Places.PlaceSearch.NearbySearchRequest()
     {
         location = "10.8230989,106.6296638",
         radius   = 150000
     }, key).Result;
 }
Example #12
0
 public GoogleMapBusiness(
     IGoogleMapClient client)
 {
     this.client = client;
 }
Example #13
0
 public HamiltonBusiness(
     IGoogleMapClient client)
 {
     this.client = client;
 }