Beispiel #1
0
        internal RouteSearchRequest(MapService service, Geocoordinates from, Geocoordinates to) : this(service, ServiceRequestType.SearchRoute)
        {
            _to   = to;
            _from = from;
            startExecutionAction = new Action(() =>
            {
                int requestID;
                errMessage = $"Failed to get route list for given origin {_from} and destination {_to}";
                if (_waypoints?.Count == 0)
                {
                    _type     = ServiceRequestType.SearchRoute;
                    errorCode = _service.handle.SearchRoute(_from.handle, _to.handle, _service.Preferences.handle, _routeCallback, IntPtr.Zero, out requestID);
                    if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
                    {
                        _requestTask?.TrySetException(errorCode.GetException(errMessage));
                    }
                }
                else
                {
                    _type = ServiceRequestType.SearchRouteWithWaypoints;

                    var waypoints = GetCoordinateListForWaypoints();
                    errorCode     = _service.handle.SearchRouteWaypoints(waypoints, waypoints.Length, _service.Preferences.handle, _routeCallback, IntPtr.Zero, out requestID);
                    if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
                    {
                        _requestTask?.TrySetException(errorCode.GetException(errMessage));
                    }
                }
                _requestID = requestID;
            });
        }
Beispiel #2
0
        internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
        {
            var err = Interop.ErrorCode.InvalidParameter;

            if (coordinates == null || objectToContain == null)
            {
                err.ThrowIfFailed("given coordinates or parent evas object is null");
            }
            handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, type);
        }
Beispiel #3
0
        internal Marker(Geocoordinates coordinates, string imagePath, Interop.ViewMarkerType type)
        {
            var err = Interop.ErrorCode.InvalidParameter;

            if (coordinates == null || imagePath == null)
            {
                err.ThrowIfFailed("given coordinates or imagePath is null");
            }
            handle = new Interop.MarkerHandle(coordinates.handle, imagePath, type);
        }
Beispiel #4
0
        internal RouteSegment(Interop.RouteSegmentHandle handle)
        {
            _origin      = new Geocoordinates(handle.Origin);
            _destination = new Geocoordinates(handle.Destination);
            _distance    = handle.Distance;
            _duration    = handle.Duration;
            _boundingBox = new Area(handle.BoundingBox);

            handle.ForeachManeuver(maneuverHandle => _maneuvers.Add(new RouteManeuver(maneuverHandle)));
            handle.ForeachPath(pathHandle => _path.Add(new Geocoordinates(pathHandle)));
        }
Beispiel #5
0
 internal RouteManeuver(Interop.RouteManeuverHandle handle)
 {
     _direction                 = handle.Direction;
     _turntype                  = handle.TurnType;
     _coordinates               = new Geocoordinates(handle.Coordinates);
     _road                      = handle.RoadName;
     _instruction               = handle.Instruction;
     _locale                    = handle.Locale;
     _timeToNextInstruction     = handle.TimeToNextInstruction;
     _distanceToNextInstruction = handle.DistanceToNextInstruction;
 }
Beispiel #6
0
 internal MapGestureEventArgs(IntPtr nativeHandle)
 {
     using (var handle = new Interop.GestureEventDataHandle(nativeHandle))
     {
         GestureType    = (GestureType)handle.GestureType;
         Position       = handle.Position;
         TouchCount     = handle.FingerCount;
         ZoomFactor     = handle.ZoomFactor;
         RotationAngle  = handle.RotationAngle;
         Geocoordinates = new Geocoordinates(handle.Coordinates);
     }
 }
Beispiel #7
0
 internal PlaceSearchRequest(MapService service, Geocoordinates position, int distance) : this(service, ServiceRequestType.SearchPlace)
 {
     startExecutionAction = new Action(() =>
     {
         int requestID;
         errMessage = $"Failed to get place list for given co-ordinate {position} and distance {distance}";
         errorCode  = _service.handle.SearchPlace(position.handle, distance, _service.PlaceSearchFilter.handle, _service.Preferences.handle, _placeCallback, IntPtr.Zero, out requestID);
         if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
         {
             _requestTask?.TrySetException(errorCode.GetException(errMessage));
         }
         _requestID = requestID;
     });
 }
        /// <summary>
        /// Searches for places of specified type in given area.
        /// </summary>
        /// <param name="area">Area to look for places.</param>
        /// <param name="placeType">Type of place.</param>
        /// <returns>Response from find place service.</returns>
        public async Task <FindPlaceResponse> GetPlacesAsync(Model.Area area, PlaceType placeType)
        {
            try
            {
                var placeCategory = new PlaceCategory();
                placeCategory.Id = placeType.GetPlaceCategoryId();

                using (_mapService.PlaceSearchFilter = new PlaceFilter())
                {
                    _mapService.PlaceSearchFilter.Category = placeCategory;

                    Geocoordinates geoTopLeft = new Geocoordinates(
                        area.TopLeftPoint.Latitude, area.TopLeftPoint.Longitude);
                    Geocoordinates geoBottomRight = new Geocoordinates(
                        area.BottomRightPoint.Latitude, area.BottomRightPoint.Longitude);

                    var request = _mapService.CreatePlaceSearchRequest(new Area(geoTopLeft, geoBottomRight));
                    _loggerService.Verbose($"{request}");

                    var response = await request.GetResponseAsync();

                    _loggerService.Verbose($"{response}");

                    var results = response
                                  .Select(r => new PlaceSearchResult(r.Name, AddressToString(r.Address)))
                                  .ToList();
                    results.ForEach(result => _loggerService.Verbose($"{result}"));

                    return(new FindPlaceResponse(true, results));
                }
            }
            catch (Exception e)
            {
                bool notFound = e.Message.Contains(NotFoundError);

                return(new FindPlaceResponse(notFound));
            }
        }
Beispiel #9
0
 /// <summary>
 /// Constructs a rectangular area.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="topLeft">Top-left coordinates of the area.</param>
 /// <param name="bottomRight">Bottom-left coordinates of the area.</param>
 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
 /// <exception cref="System.ArgumentException">Thrown when input coordinates are invalid.</exception>
 /// <exception cref="System.InvalidOperationException">Thrown when a native operation fails to allocate memory.</exception>
 public Area(Geocoordinates topLeft, Geocoordinates bottomRight)
 {
     handle = new Interop.AreaHandle(topLeft?.handle, bottomRight?.handle);
 }
Beispiel #10
0
 /// <summary>
 /// Creates a pin type marker.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates">Marker coordinates.</param>
 /// <exception cref="System.ArgumentException">Thrown when input coordinates are invalid.</exception>
 public Pin(Geocoordinates coordinates)
     : base(coordinates, defaultImagePath, Interop.ViewMarkerType.Pin)
 {
 }
Beispiel #11
0
 /// <summary>
 /// Creates a place search request for a specified search radius around a given coordinates position.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates">Geographical coordinates of the center.</param>
 /// <param name="distance">A double value representing the radius of an area to search places.</param>
 /// <returns>Returns a PlaceSearchRequest object created with the location coordinates and search radius.</returns>
 public PlaceSearchRequest CreatePlaceSearchRequest(Geocoordinates coordinates, int distance)
 {
     return(new PlaceSearchRequest(this, coordinates, distance));
 }
Beispiel #12
0
 /// <summary>
 /// Creates a route search request for the origin and destination points.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="from">Starting point.</param>
 /// <param name="to">Destination.</param>
 /// <returns>Returns a RouteSearchRequest object created with the origin and destination coordinates.</returns>
 public RouteSearchRequest CreateRouteSearchRequest(Geocoordinates from, Geocoordinates to)
 {
     return(new RouteSearchRequest(this, from, to));
 }
Beispiel #13
0
 /// <summary>
 /// Creates a sticker type marker.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates">Marker coordinates.</param>
 /// <param name="imagePath">Image file path for Marker.</param>
 /// <remarks>
 /// http://tizen.org/privilege/mediastorage is needed if the input or output path are relevant to media storage.
 /// http://tizen.org/privilege/externalstorage is needed if the input or output path are relevant to external storage.
 /// </remarks>
 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
 /// <exception cref="System.ArgumentException">Thrown when the input coordinates or imagePath is invalid.</exception>
 public Sticker(Geocoordinates coordinates, string imagePath)
     : base(coordinates, imagePath, Interop.ViewMarkerType.Sticker)
 {
 }
Beispiel #14
0
 /// <summary>
 /// Creates a sticker type marker.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates">Marker coordinates.</param>
 /// <exception cref="System.ArgumentException">Thrown when input coordinates are invalid.</exception>
 public Sticker(Geocoordinates coordinates)
     : base(coordinates, defaultImagePath, Interop.ViewMarkerType.Sticker)
 {
 }
Beispiel #15
0
 /// <summary>
 /// Creates a pin type marker.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates">Marker coordinates.</param>
 /// <param name="imagePath">Image file path for the Marker.</param>
 /// <remarks>
 /// http://tizen.org/privilege/mediastorage is needed if the file path is relevant to media storage.
 /// http://tizen.org/privilege/externalstorage is needed if the file path is relevant to external storage.
 /// </remarks>
 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
 /// <exception cref="System.ArgumentException">Thrown when the input coordinates or imagePath is invalid.</exception>
 public Pin(Geocoordinates coordinates, string imagePath)
     : base(coordinates, imagePath, Interop.ViewMarkerType.Pin)
 {
 }
Beispiel #16
0
 /// <summary>
 /// Constructs a circular area.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="center">Coordinates for center of the area.</param>
 /// <param name="radius">Radius of the area.</param>
 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
 /// <exception cref="System.ArgumentException">Thrown when input coordinates are invalid.</exception>
 /// <exception cref="System.InvalidOperationException">Thrown when a native operation fails to allocate memory.</exception>
 public Area(Geocoordinates center, double radius)
 {
     handle = new Interop.AreaHandle(center?.handle, radius);
 }
Beispiel #17
0
 /// <summary>
 /// Creates a box overlay.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates">The geographical coordinates to be pointed.</param>
 /// <param name="objectToContain">The EvasObject to be shown.</param>
 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
 /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid</exception>
 public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain)
     : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)
 {
 }
Beispiel #18
0
 /// <summary>
 /// Creates a normal overlay map object.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates"></param>
 /// <param name="objectToContain"></param>
 /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid.</exception>
 public Overlay(Geocoordinates coordinates, EvasObject objectToContain)
     : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal)
 {
 }
Beispiel #19
0
 /// <summary>
 /// Changes the geographical coordinates to screen coordinates.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="coordinates">Geographical coordinates.</param>
 /// <returns>Returns an instance of the screen coordinates on the current screen.</returns>
 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
 /// <exception cref="System.InvalidOperationException">Thrown when a native operation failed to allocate memory and connect to the service.</exception>
 public Point GeolocationToScreen(Geocoordinates coordinates)
 {
     return(handle.GeolocationToScreen(coordinates.handle));
 }
Beispiel #20
0
 /// <summary>
 /// Changes the marker coordinates.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 /// <param name="newPosition">New position for the marker.</param>
 public void Move(Geocoordinates newPosition)
 {
     Coordinates = newPosition;
 }