Пример #1
0
        /// <summary>
        /// Gets the request URL for the given face given the API parameters.
        /// </summary>
        /// <param name="face">The <see cref="Face"/> whose texture is to be downloaded.</param>
        /// <returns>The URL for downloading the texture of this <see cref="Face"/></returns>
        public string GetURL(StreetView.Face face)
        {
            var sb = new StringBuilder(k_BaseURL).Append("key=").Append(options.key);

            switch (options.mode)
            {
            case StreetView.Mode.Coordinates:
                sb.Append("&location=").Append(options.location.lat).Append(",").Append(options.location.lng);
                break;

            case StreetView.Mode.PanoID:
                sb.Append("&pano=").Append(options.panoID);
                break;

            case StreetView.Mode.Location:
                sb.Append("&location=").Append(options.place);
                break;
            }

            sb.Append("&size=").Append(options.resolution).Append("x").Append(options.resolution)
            .Append("&fov=").Append(options.fov)
            .Append("&heading=").Append((options.heading % 360) + EnumUtility.HeadingFrom(face) + options.heading)
            .Append("&pitch=").Append(EnumUtility.PitchFrom(face) + options.pitch)
            .Append("&radius=").Append(options.radius)
            .Append("&source=").Append(EnumToString.From(options.source));

            return(sb.ToString());
        }
Пример #2
0
        /// <summary>
        /// Gets the request URL for the set parameters
        /// </summary>
        /// <returns></returns>
        public string GetURL()
        {
            if (string.IsNullOrEmpty(Key))
            {
                throw new Exception("Key cannot be null or empty");
            }
            if (Location == null)
            {
                throw new Exception("Location cannot be null");
            }

            var sb = new StringBuilder(k_BaseURL);

            // Add the parameters that are gaurunteed a value
            sb.Append("key=").Append(Key)
            .Append("&location=").Append(Location.lat).Append(",").Append(Location.lng)
            .Append("&radius=").Append(radius)
            .Append("&minprice=").Append(minPriceLevel)
            .Append("&maxprice=").Append(maxPriceLevel)
            .Append("&rankby=").Append(RankByToString(rankBy));

            // Check and add the other parameters
            if (!string.IsNullOrEmpty(keyword))
            {
                sb.Append("&keyword=").Append(keyword);
            }

            if (!string.IsNullOrEmpty(language))
            {
                sb.Append("&language=").Append(language);
            }

#pragma warning disable 0618
            if (!string.IsNullOrEmpty(name))
            {
                sb.Append("&name=").Append(name);
            }
#pragma warning restore 0618

            if (type != PlaceType.Undefined)
            {
                sb.Append("&type=").Append(EnumToString.From(type));
            }

            if (isOpenNow)
            {
                sb.Append("&opennow");
            }

            return(sb.ToString());
        }
Пример #3
0
        /// <summary>
        /// Gets the request URL for the given face given the API parameters.
        /// </summary>
        /// <param name="face">The <see cref="Face"/> whose texture is to be downloaded.</param>
        /// <returns>The URL for downloading the texture of this <see cref="Face"/></returns>
        public string GetURL()
        {
            var sb = new StringBuilder(k_BaseURL).Append("key=").Append(options.key);

            switch (options.mode)
            {
            case StreetView.Mode.Coordinates:
                sb.Append("&location=").Append(options.location.lat).Append(",").Append(options.location.lng);
                break;

            case StreetView.Mode.PanoID:
                sb.Append("&pano=").Append(options.panoID);
                break;

            case StreetView.Mode.Location:
                sb.Append("&location=").Append(options.place);
                break;
            }

            sb.Append("&radius=").Append(options.radius)
            .Append("&source=").Append(EnumToString.From(options.source));

            return(sb.ToString());
        }
Пример #4
0
        /// <summary>
        /// Gets the request URL for the set parameters
        /// </summary>
        public string GetURL()
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new Exception("Key cannot be null or empty");
            }
            if (string.IsNullOrEmpty(query))
            {
                throw new Exception("Query cannot be null or empty");
            }
            if (radius > 50000)
            {
                throw new Exception("Radius cannot be larger than 50000");
            }

            var sb = new StringBuilder(k_BaseURL)
                     .Append("key=").Append(key)
                     .Append("&query=").Append(query);

            if (!string.IsNullOrEmpty(region))
            {
                sb.Append("&region=").Append(region);
            }

            if (location != null)
            {
                sb.Append("&location=").Append(location.lat).Append(",").Append(location.lng);
            }

            if (radius >= 0)
            {
                sb.Append("&radius=").Append(radius);
            }

            if (!string.IsNullOrEmpty(language))
            {
                sb.Append("&language=").Append(language);
            }

            if (minPriceLevel != PriceLevel.Undefined)
            {
                sb.Append("&minprice=").Append(minPriceLevel);
            }

            if (maxPriceLevel != PriceLevel.Undefined)
            {
                sb.Append("&maxprice=").Append(maxPriceLevel);
            }

            if (isOpenNow)
            {
                sb.Append("&opennow");
            }

            if (type != PlaceType.Undefined)
            {
                sb.Append("&type=").Append(EnumToString.From(type));
            }

            return(sb.ToString());
        }