Exemple #1
0
        /// <summary>
        /// Creates a polygon visual object.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="coordinates">List of geographical coordinates.</param>
        /// <param name="color">Background color.</param>
        /// <exception cref="ArgumentException">Thrown when input values are invalid.</exception>
        public Polygon(IEnumerable <Geocoordinates> coordinates, Color color) : base()
        {
            var err = Interop.ErrorCode.InvalidParameter;

            if (coordinates == null || coordinates.Count() < 3)
            {
                err.ThrowIfFailed("given coordinates list should contain at least 3 coordinates");
            }
            _coordinateList = coordinates.ToList();
            var geocoordinateList = new GeocoordinatesList(_coordinateList, false);

            handle = new Interop.PolygonHandle(geocoordinateList.handle, color);
        }
Exemple #2
0
        /// <summary>
        /// Creates polyline visual object.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="coordinates">List of geographical coordinates.</param>
        /// <param name="color">Line color.</param>
        /// <param name="width">The width of line [1 ~ 100] \(pixels).</param>
        /// <exception cref="ArgumentException">Thrown when input values are invalid.</exception>
        public Polyline(List <Geocoordinates> coordinates, Color color, int width) : base()
        {
            var err = Interop.ErrorCode.InvalidParameter;

            if (coordinates == null || coordinates.Count() < 2)
            {
                err.ThrowIfFailed("given coordinates list should contain at least 2 coordinates");
            }
            _coordinateList = coordinates.ToList();
            var geocoordinateList = new GeocoordinatesList(_coordinateList);

            handle = new Interop.PolylineHandle(geocoordinateList.handle, color, width);
        }
Exemple #3
0
        internal MultiReverseGeocodeRequest(MapService service, IEnumerable <Geocoordinates> coordinates) : base(service, ServiceRequestType.ReverseGeocode)
        {
            // The Maps Service invokes this callback once when gets the response from map service provider
            // The value of total is same with requested coordinates list size. Even though one of address is not provided valid address handle is retrieved.
            _geocodeCallback = (result, id, total, handle, userData) =>
            {
                errorCode = result;
                if (result.IsSuccess())
                {
                    var addressListHandle = new Interop.AddressListHandle(handle, needToRelease: true);
                    var addressList       = new PlaceAddressList(addressListHandle);
                    _addressesList = addressList.Addresses as List <PlaceAddress>;
                    _requestTask?.TrySetResult(_addressesList);
                    return(true);
                }
                else
                {
                    _requestTask?.TrySetException(errorCode.GetException(errMessage));
                    return(false);
                }
            };

            var coordinateList = new GeocoordinatesList(coordinates);

            startExecutionAction = new Action(() =>
            {
                int requestID;
                errMessage = "Failed to get address list for given co-ordinate list";
                errorCode  = _service.handle.MultiReverseGeocode(coordinateList.handle, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID);
                if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
                {
                    _requestTask?.TrySetException(errorCode.GetException(errMessage));
                }
                _requestID = requestID;
            });
        }