--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_building_number")]
+ internal static extern ErrorCode GetBuildingNumber(this AddressHandle /* maps_address_h */ address, out string buildingNumber);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_building_number")]
+ internal static extern ErrorCode SetBuildingNumber(this AddressHandle /* maps_address_h */ address, string buildingNumber);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_street")]
+ internal static extern ErrorCode GetStreet(this AddressHandle /* maps_address_h */ address, out string street);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_street")]
+ internal static extern ErrorCode SetStreet(this AddressHandle /* maps_address_h */ address, string street);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_district")]
+ internal static extern ErrorCode GetDistrict(this AddressHandle /* maps_address_h */ address, out string district);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_district")]
+ internal static extern ErrorCode SetDistrict(this AddressHandle /* maps_address_h */ address, string district);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_city")]
+ internal static extern ErrorCode GetCity(this AddressHandle /* maps_address_h */ address, out string city);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_city")]
+ internal static extern ErrorCode SetCity(this AddressHandle /* maps_address_h */ address, string city);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_state")]
+ internal static extern ErrorCode GetState(this AddressHandle /* maps_address_h */ address, out string state);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_state")]
+ internal static extern ErrorCode SetState(this AddressHandle /* maps_address_h */ address, string state);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_country")]
+ internal static extern ErrorCode GetCountry(this AddressHandle /* maps_address_h */ address, out string country);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_country")]
+ internal static extern ErrorCode SetCountry(this AddressHandle /* maps_address_h */ address, string country);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_country_code")]
+ internal static extern ErrorCode GetCountryCode(this AddressHandle /* maps_address_h */ address, out string countryCode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_country_code")]
+ internal static extern ErrorCode SetCountryCode(this AddressHandle /* maps_address_h */ address, string countryCode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_county")]
+ internal static extern ErrorCode GetCounty(this AddressHandle /* maps_address_h */ address, out string county);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_county")]
+ internal static extern ErrorCode SetCounty(this AddressHandle /* maps_address_h */ address, string county);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_postal_code")]
+ internal static extern ErrorCode GetPostalCode(this AddressHandle /* maps_address_h */ address, out string postalCode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_postal_code")]
+ internal static extern ErrorCode SetPostalCode(this AddressHandle /* maps_address_h */ address, string postalCode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_freetext")]
+ internal static extern ErrorCode GetFreeText(this AddressHandle /* maps_address_h */ address, out string freetext);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_freetext")]
+ internal static extern ErrorCode SetFreeText(this AddressHandle /* maps_address_h */ address, string freetext);
+
+ internal class AddressHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_create")]
+ internal static extern ErrorCode Create(out IntPtr /* maps_address_h */ address);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_address_h */ address);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_clone")]
+ internal static extern ErrorCode Clone(IntPtr /* maps_address_h */ origin, out IntPtr /* maps_address_h */ cloned);
+
+ internal string Building
+ {
+ get { return NativeGet(this.GetBuildingNumber); }
+ set { NativeSet(this.SetBuildingNumber, value); }
+ }
+
+ internal string Street
+ {
+ get { return NativeGet(this.GetStreet); }
+ set { NativeSet(this.SetStreet, value); }
+ }
+
+ internal string City
+ {
+ get { return NativeGet(this.GetCity); }
+ set { NativeSet(this.SetCity, value); }
+ }
+
+ internal string District
+ {
+ get { return NativeGet(this.GetDistrict); }
+ set { NativeSet(this.SetDistrict, value); }
+ }
+
+ internal string State
+ {
+ get { return NativeGet(this.GetState); }
+ set { NativeSet(this.SetState, value); }
+ }
+
+ internal string Country
+ {
+ get { return NativeGet(this.GetCountry); }
+ set { NativeSet(this.SetCountry, value); }
+ }
+
+ internal string CountryCode
+ {
+ get { return NativeGet(this.GetCountryCode); }
+ set { NativeSet(this.SetCountryCode, value); }
+ }
+
+ internal string County
+ {
+ get { return NativeGet(this.GetCounty); }
+ set { NativeSet(this.SetCounty, value); }
+ }
+
+ internal string PostalCode
+ {
+ get { return NativeGet(this.GetPostalCode); }
+ set { NativeSet(this.SetPostalCode, value); }
+ }
+
+ internal string FreeText
+ {
+ get { return NativeGet(this.GetFreeText); }
+ set { NativeSet(this.SetFreeText, value); }
+ }
+
+ internal AddressHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal AddressHandle() : this(IntPtr.Zero, true)
+ {
+ Create(out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal static AddressHandle CloneFrom(IntPtr nativeHandle)
+ {
+ IntPtr handle;
+ Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
+ return new AddressHandle(handle, true);
+ }
+
+ internal static AddressHandle Create(IntPtr nativeHandle)
+ {
+ return new AddressHandle(nativeHandle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_append")]
+ internal static extern ErrorCode ListAppend(this AddressListHandle /* maps_address_list_h */ addressList, AddressHandle /* maps_address_h */ address);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_remove")]
+ internal static extern ErrorCode ListRemove(this AddressListHandle /* maps_address_list_h */ addressList, AddressHandle /* maps_address_h */ address);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_get_length")]
+ internal static extern ErrorCode ListGetLength(this AddressListHandle /* maps_address_list_h */ addressList, out int length);
+
+
+ internal class AddressListHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool AddressCallback(int index, IntPtr /* maps_address_h */ addressHandle, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_create")]
+ internal static extern ErrorCode Create(out IntPtr /* maps_address_list_h */ addressList);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_address_list_h */ addressList);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_foreach")]
+ internal static extern ErrorCode Foreach(IntPtr /* maps_address_list_h */ addressList, AddressCallback callback, IntPtr /* void */ userData);
+
+ internal AddressListHandle() : base(IntPtr.Zero, true, Destroy)
+ {
+ Create(out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal AddressListHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal void Foreach(Action<AddressHandle> action)
+ {
+ AddressCallback callback = (index, handle, userData) =>
+ {
+ action(AddressHandle.CloneFrom(handle));
+ return true;
+ };
+
+ Foreach(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get address list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal class AreaHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_area_create_rectangle")]
+ internal static extern ErrorCode CreateRectangle(IntPtr /* maps_coordinates_h */ topLeft, IntPtr /* maps_coordinates_h */ bottomRight, out IntPtr /* maps_area_h */ area);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_area_create_circle")]
+ internal static extern ErrorCode CreateCircle(IntPtr /* maps_coordinates_h */ center, double radius, out IntPtr /* maps_area_h */ area);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_area_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_area_h */ area);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_area_clone")]
+ internal static extern ErrorCode Clone(IntPtr /* maps_area_h */ origin, out IntPtr /* maps_area_h */ cloned);
+
+ internal AreaHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal AreaHandle(CoordinatesHandle topLeft, CoordinatesHandle bottomRight) : this(IntPtr.Zero, true)
+ {
+ IntPtr _topLeft = (topLeft != null ? topLeft : IntPtr.Zero);
+ IntPtr _bottomRight = (bottomRight != null ? bottomRight : IntPtr.Zero);
+ CreateRectangle(_topLeft, _bottomRight, out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal AreaHandle(CoordinatesHandle center, double radius) : this(IntPtr.Zero, true)
+ {
+ IntPtr _center = (center != null ? center : IntPtr.Zero);
+ CreateCircle(_center, radius, out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal static AreaHandle CloneFrom(IntPtr nativeHandle)
+ {
+ IntPtr handle;
+ Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
+ return new AreaHandle(handle, true);
+ }
+
+ internal static AreaHandle Create(IntPtr nativeHandle)
+ {
+ return new AreaHandle(nativeHandle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_get_latitude")]
+ internal static extern ErrorCode GetLatitude(this CoordinatesHandle /* maps_coordinates_h */ coordinates, out double latitude);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_get_longitude")]
+ internal static extern ErrorCode GetLongitude(this CoordinatesHandle /* maps_coordinates_h */ coordinates, out double longitude);
+
+ internal class CoordinatesHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_create")]
+ internal static extern ErrorCode Create(double latitude, double longitude, out IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_clone")]
+ internal static extern ErrorCode Clone(IntPtr /* maps_coordinates_h */ origin, out IntPtr /* maps_coordinates_h */ cloned);
+
+ internal double Latitude
+ {
+ get { return NativeGet<double>(this.GetLatitude); }
+ }
+
+ internal double Longitude
+ {
+ get { return NativeGet<double>(this.GetLongitude); }
+ }
+
+ internal CoordinatesHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal CoordinatesHandle(double latitude, double longitude) : this(IntPtr.Zero, true)
+ {
+ Create(latitude, longitude, out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal static CoordinatesHandle CloneFrom(IntPtr nativeHandle)
+ {
+ IntPtr handle;
+ Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
+ return new CoordinatesHandle(handle, true);
+ }
+
+ internal static CoordinatesHandle Create(IntPtr nativeHandle)
+ {
+ return new CoordinatesHandle(nativeHandle, true);
+ }
+
+ public override string ToString()
+ {
+ return $"[{Latitude}, {Longitude}]";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_append")]
+ internal static extern ErrorCode Append(this CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_remove")]
+ internal static extern ErrorCode Remove(this CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, CoordinatesHandle /* maps_coordinates_h */ coordinates);
+
+
+ internal class CoordinatesListHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool CoordinatesCallback(int index, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_create")]
+ internal static extern ErrorCode Create(out IntPtr /* maps_coordinates_list_h */ coordinatesList);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_coordinates_list_h */ coordinatesList);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_foreach")]
+ internal static extern ErrorCode Foreach(IntPtr /* maps_coordinates_list_h */ coordinatesList, CoordinatesCallback callback, IntPtr /* void */ userData);
+
+ internal CoordinatesListHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) { }
+
+ internal CoordinatesListHandle(bool needToRelease = true) : this(IntPtr.Zero, needToRelease)
+ {
+ Create(out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal void Add(CoordinatesHandle handleToAdd)
+ {
+ using (var clonedHandle = CoordinatesHandle.CloneFrom(handleToAdd))
+ {
+ if (this.Append(clonedHandle).WarnIfFailed("Failed to add coordinates to the list"))
+ {
+ clonedHandle.HasOwnership = false;
+ }
+ }
+ }
+
+ internal void ForEach(Action<CoordinatesHandle> action)
+ {
+ CoordinatesCallback callback = (index, handle, userData) =>
+ {
+ action(CoordinatesHandle.CloneFrom(handle));
+ return true;
+ };
+
+ Foreach(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get coordinates list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.CompilerServices;
+using Tizen;
+
+internal static partial class Interop
+{
+ internal enum ErrorCode
+ {
+ None = Tizen.Internals.Errors.ErrorCode.None,
+ PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
+ OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
+ InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
+ NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported,
+ ConnectionTimeOut = Tizen.Internals.Errors.ErrorCode.ConnectionTimeout,
+ NetworkUnreachable = Tizen.Internals.Errors.ErrorCode.NetworkUnreachable,
+ InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation,
+ KeyNotAvailable = Tizen.Internals.Errors.ErrorCode.KeyNotAvailable,
+ ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy,
+ Canceled = Tizen.Internals.Errors.ErrorCode.Canceled,
+ Unknown = Tizen.Internals.Errors.ErrorCode.Unknown,
+ UserNotConsented = Tizen.Internals.Errors.ErrorCode.UserNotConsented,
+ ServiceNotAvailable = -0x02C20000 | 0x01, // MAPS_ERROR_SERVICE_NOT_AVAILABLE
+ NotFound = -0x02C20000 | 0x02, // MAPS_ERROR_NOT_FOUND
+ }
+}
+
+internal static class ErrorCodeExtensions
+{
+ private const string LogTag = "Tizen.Maps";
+
+ internal static bool IsSuccess(this Interop.ErrorCode err)
+ {
+ return err == Interop.ErrorCode.None;
+ }
+
+ internal static bool IsFailed(this Interop.ErrorCode err)
+ {
+ return !err.IsSuccess();
+ }
+
+ /// <summary>
+ /// The utility method to check for an error. Returns false on failure and prints warning messages.
+ /// </summary>
+ /// <returns>Returns true in case of no error, otherwise false.</returns>
+ internal static bool WarnIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ if (err.IsFailed())
+ {
+ Log.Debug(LogTag, $"{msg}, err: {err.ToString()}", file, func, line);
+ return false;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// The utility method to check for an error. Returns false on failure and throws an exception.
+ /// </summary>
+ /// <returns>Returns true in case of no error, otherwise false.</returns>
+ internal static bool ThrowIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ if (err.IsFailed())
+ {
+ Log.Error(LogTag, $"{msg}, err: {err.ToString()}", file, func, line);
+ throw err.GetException(msg);
+ }
+ return true;
+ }
+
+ internal static Exception GetException(this Interop.ErrorCode err, string message)
+ {
+ string errMessage = $"{message}, err: {err.ToString()}";
+ switch (err)
+ {
+ //case ErrorCode.None:
+ case Interop.ErrorCode.PermissionDenied: return new System.UnauthorizedAccessException(errMessage);
+ case Interop.ErrorCode.InvalidParameter: return new System.ArgumentException(errMessage);
+ case Interop.ErrorCode.OutOfMemory:
+ case Interop.ErrorCode.NotSupported:
+ case Interop.ErrorCode.ConnectionTimeOut:
+ case Interop.ErrorCode.NetworkUnreachable:
+ case Interop.ErrorCode.InvalidOperation:
+ case Interop.ErrorCode.KeyNotAvailable:
+ case Interop.ErrorCode.ResourceBusy:
+ case Interop.ErrorCode.Canceled:
+ case Interop.ErrorCode.Unknown:
+ case Interop.ErrorCode.ServiceNotAvailable:
+ case Interop.ErrorCode.NotFound:
+ default: return new System.InvalidOperationException(errMessage);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+internal static partial class Interop
+{
+ internal static class Libraries
+ {
+ internal const string MapService = "capi-maps-service.so.0";
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_id")]
+ internal static extern ErrorCode GetId(this PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string id);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_label")]
+ internal static extern ErrorCode GetLabel(this PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string label);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_text")]
+ internal static extern ErrorCode GetText(this PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string text);
+
+ internal class PlaceAttributeHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_attribute_h */ attribute);
+
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ }
+
+ internal string Label
+ {
+ get { return NativeGet(this.GetLabel); }
+ }
+
+ internal string Text
+ {
+ get { return NativeGet(this.GetText); }
+ }
+
+ public PlaceAttributeHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_id")]
+ internal static extern ErrorCode GetId(this PlaceCategoryHandle /* maps_place_category_h */ category, out string id);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_id")]
+ internal static extern ErrorCode SetId(this PlaceCategoryHandle /* maps_place_category_h */ category, string id);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_name")]
+ internal static extern ErrorCode GetName(this PlaceCategoryHandle /* maps_place_category_h */ category, out string name);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_name")]
+ internal static extern ErrorCode SetName(this PlaceCategoryHandle /* maps_place_category_h */ category, string name);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_url")]
+ internal static extern ErrorCode GetUrl(this PlaceCategoryHandle /* maps_place_category_h */ category, out string url);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_url")]
+ internal static extern ErrorCode SetUrl(this PlaceCategoryHandle /* maps_place_category_h */ category, string url);
+
+ internal class PlaceCategoryHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_create")]
+ internal static extern ErrorCode Create(out IntPtr /* maps_place_category_h */ category);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_category_h */ category);
+
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ set { NativeSet(this.SetId, value); }
+ }
+
+ internal string Name
+ {
+ get { return NativeGet(this.GetName); }
+ set { NativeSet(this.SetName, value); }
+ }
+
+ internal string Url
+ {
+ get { return NativeGet(this.GetUrl); }
+ set { NativeSet(this.SetUrl, value); }
+ }
+
+ public PlaceCategoryHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal PlaceCategoryHandle() : this(IntPtr.Zero, true)
+ {
+ Create(out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal static PlaceCategoryHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceCategoryHandle(nativeHandle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_label")]
+ internal static extern ErrorCode GetLabel(this PlaceContactHandle /* maps_place_contact_h */ contact, out string label);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_type")]
+ internal static extern ErrorCode GetType(this PlaceContactHandle /* maps_place_contact_h */ contact, out string type);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_value")]
+ internal static extern ErrorCode GetValue(this PlaceContactHandle /* maps_place_contact_h */ contact, out string value);
+
+ internal class PlaceContactHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_contact_h */ contact);
+
+ internal string Label
+ {
+ get { return NativeGet(this.GetLabel); }
+ }
+
+ internal string Type
+ {
+ get { return NativeGet(this.GetType); }
+ }
+
+ internal string Value
+ {
+ get { return NativeGet(this.GetValue); }
+ }
+
+ public PlaceContactHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_description")]
+ internal static extern ErrorCode GetDescription(this PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out string description);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_language")]
+ internal static extern ErrorCode GetLanguage(this PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out string language);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_media")]
+ internal static extern ErrorCode GetMedia(this PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out IntPtr /* maps_place_media_h */ media);
+
+ internal class PlaceEditorialHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_editorial_h */ editorial);
+
+ internal string Description
+ {
+ get { return NativeGet(this.GetDescription); }
+ }
+
+ internal string Language
+ {
+ get { return NativeGet(this.GetLanguage); }
+ }
+
+ internal PlaceMediaHandle Media
+ {
+ get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); }
+ }
+
+ public PlaceEditorialHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get")]
+ internal static extern ErrorCode Get(this PlaceFilterHandle /* maps_place_filter_h */ filter, string key, out string value);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set")]
+ internal static extern ErrorCode Set(this PlaceFilterHandle /* maps_place_filter_h */ filter, string key, string value);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_keyword")]
+ internal static extern ErrorCode GetKeyword(this PlaceFilterHandle /* maps_place_filter_h */ filter, out string keyword);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_keyword")]
+ internal static extern ErrorCode SetKeyword(this PlaceFilterHandle /* maps_place_filter_h */ filter, string keyword);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_place_name")]
+ internal static extern ErrorCode GetPlaceName(this PlaceFilterHandle /* maps_place_filter_h */ filter, out string placeName);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_place_name")]
+ internal static extern ErrorCode SetPlaceName(this PlaceFilterHandle /* maps_place_filter_h */ filter, string placeName);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_category")]
+ internal static extern ErrorCode GetCategory(this PlaceFilterHandle /* maps_place_filter_h */ filter, out IntPtr /* maps_place_category_h */ category);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_category")]
+ internal static extern ErrorCode SetCategory(this PlaceFilterHandle /* maps_place_filter_h */ filter, PlaceCategoryHandle /* maps_place_category_h */ category);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_place_address")]
+ internal static extern ErrorCode GetPlaceAddress(this PlaceFilterHandle /* maps_place_filter_h */ filter, out string placeAddress);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_place_address")]
+ internal static extern ErrorCode SetPlaceAddress(this PlaceFilterHandle /* maps_place_filter_h */ filter, string placeAddress);
+
+ internal class PlaceFilterHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PlaceFilterPropertiesCallback(int index, int total, string key, IntPtr /* void */ value, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_foreach_property")]
+ internal static extern ErrorCode ForeachProperty(IntPtr /* maps_place_filter_h */ filter, PlaceFilterPropertiesCallback callback, IntPtr /* void */ userData);
+
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_create")]
+ internal static extern ErrorCode Create(out IntPtr /* maps_place_filter_h */ filter);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_filter_h */ filter);
+
+ internal string Keyword
+ {
+ get { return NativeGet(this.GetKeyword); }
+ set { NativeSet(this.SetKeyword, value); }
+ }
+
+ internal string PlaceName
+ {
+ get { return NativeGet(this.GetPlaceName); }
+ set { NativeSet(this.SetPlaceName, value); }
+ }
+
+ internal string PlaceAddress
+ {
+ get { return NativeGet(this.GetPlaceAddress); }
+ set { NativeSet(this.SetPlaceAddress, value); }
+ }
+
+ internal PlaceCategoryHandle Category
+ {
+ get { return NativeGet(this.GetCategory, PlaceCategoryHandle.Create); }
+ set { NativeSet(this.SetCategory, value); }
+ }
+
+ public PlaceFilterHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ public PlaceFilterHandle() : this(IntPtr.Zero, true)
+ {
+ Create(out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal void ForeachProperty(Action<string, string> action)
+ {
+ PlaceFilterPropertiesCallback callback = (index, total, key, value, userData) =>
+ {
+ action(key, Marshal.PtrToStringUni(value));
+ return true;
+ };
+
+ ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get address list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_id")]
+ internal static extern ErrorCode GetId(this PlaceImageHandle /* maps_place_image_h */ image, out string id);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_url")]
+ internal static extern ErrorCode GetUrl(this PlaceImageHandle /* maps_place_image_h */ image, out string url);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_width")]
+ internal static extern ErrorCode GetWidth(this PlaceImageHandle /* maps_place_image_h */ image, out int width);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_height")]
+ internal static extern ErrorCode GetHeight(this PlaceImageHandle /* maps_place_image_h */ image, out int height);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_user_link")]
+ internal static extern ErrorCode GetUserLink(this PlaceImageHandle /* maps_place_image_h */ image, out IntPtr /* maps_place_link_object_h */ user);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_media")]
+ internal static extern ErrorCode GetMedia(this PlaceImageHandle /* maps_place_image_h */ image, out IntPtr /* maps_place_media_h */ media);
+
+ internal class PlaceImageHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_image_h */ image);
+
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ }
+
+ internal string Url
+ {
+ get { return NativeGet(this.GetUrl); }
+ }
+
+ internal int Width
+ {
+ get { return NativeGet<int>(this.GetWidth); }
+ }
+
+ internal int Height
+ {
+ get { return NativeGet<int>(this.GetHeight); }
+ }
+
+ internal PlaceLinkObjectHandle User
+ {
+ get { return NativeGet(this.GetUserLink, PlaceLinkObjectHandle.Create); }
+ }
+
+ internal PlaceMediaHandle Media
+ {
+ get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); }
+ }
+
+ public PlaceImageHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_id")]
+ internal static extern ErrorCode GetId(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string id);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_name")]
+ internal static extern ErrorCode GetName(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string name);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_string")]
+ internal static extern ErrorCode GetLink(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string linkString);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_type")]
+ internal static extern ErrorCode GetType(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string type);
+
+ internal class PlaceLinkObjectHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_link_object_h */ link);
+
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ }
+
+ internal string Name
+ {
+ get { return NativeGet(this.GetName); }
+ }
+
+ internal string Link
+ {
+ get { return NativeGet(this.GetLink); }
+ }
+
+ internal string Type
+ {
+ get { return NativeGet(this.GetType); }
+ }
+
+ public PlaceLinkObjectHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static PlaceLinkObjectHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceLinkObjectHandle(nativeHandle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_attribution")]
+ internal static extern ErrorCode GetAttribution(this PlaceMediaHandle /* maps_place_media_h */ media, out string attribution);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_supplier")]
+ internal static extern ErrorCode GetSupplier(this PlaceMediaHandle /* maps_place_media_h */ media, out IntPtr /* maps_place_link_object_h */ supplier);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_via")]
+ internal static extern ErrorCode GetVia(this PlaceMediaHandle /* maps_place_media_h */ media, out IntPtr /* maps_place_link_object_h */ via);
+
+ internal class PlaceMediaHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_media_h */ media);
+
+ internal string Attribution
+ {
+ get { return NativeGet(this.GetAttribution); }
+ }
+
+ internal PlaceLinkObjectHandle Supplier
+ {
+ get { return NativeGet(this.GetSupplier, PlaceLinkObjectHandle.Create); }
+ }
+
+ internal PlaceLinkObjectHandle Via
+ {
+ get { return NativeGet(this.GetVia, PlaceLinkObjectHandle.Create); }
+ }
+
+ public PlaceMediaHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static PlaceMediaHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceMediaHandle(nativeHandle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_get_count")]
+ internal static extern ErrorCode GetCount(this PlaceRatingHandle /* maps_place_rating_h */ rating, out int count);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_get_average")]
+ internal static extern ErrorCode GetAverage(this PlaceRatingHandle /* maps_place_rating_h */ rating, out double average);
+
+ internal class PlaceRatingHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_rating_h */ rating);
+
+ internal int Count
+ {
+ get { return NativeGet<int>(this.GetCount); }
+ }
+
+ internal double Average
+ {
+ get { return NativeGet<double>(this.GetAverage); }
+ }
+
+
+ public PlaceRatingHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static PlaceRatingHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceRatingHandle(nativeHandle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_date")]
+ internal static extern ErrorCode GetDate(this PlaceReviewHandle /* maps_place_review_h */ review, out string date);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_title")]
+ internal static extern ErrorCode GetTitle(this PlaceReviewHandle /* maps_place_review_h */ review, out string title);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_rating")]
+ internal static extern ErrorCode GetRating(this PlaceReviewHandle /* maps_place_review_h */ review, out double rating);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_description")]
+ internal static extern ErrorCode GetDescription(this PlaceReviewHandle /* maps_place_review_h */ review, out string description);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_language")]
+ internal static extern ErrorCode GetLanguage(this PlaceReviewHandle /* maps_place_review_h */ review, out string language);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_media")]
+ internal static extern ErrorCode GetMedia(this PlaceReviewHandle /* maps_place_review_h */ review, out IntPtr /* maps_place_media_h */ media);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_user_link")]
+ internal static extern ErrorCode GetUserLink(this PlaceReviewHandle /* maps_place_review_h */ review, out IntPtr /* maps_place_link_object_h */ user);
+
+ internal class PlaceReviewHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_review_h */ review);
+
+ internal string Date
+ {
+ get { return NativeGet(this.GetDate); }
+ }
+
+ internal string Title
+ {
+ get { return NativeGet(this.GetTitle); }
+ }
+ internal string Language
+ {
+ get { return NativeGet(this.GetLanguage); }
+ }
+ internal string Description
+ {
+ get { return NativeGet(this.GetDescription); }
+ }
+ internal double Rating
+ {
+ get { return NativeGet<double>(this.GetRating); }
+ }
+
+ internal PlaceLinkObjectHandle User
+ {
+ get { return NativeGet(this.GetUserLink, PlaceLinkObjectHandle.Create); }
+ }
+
+ internal PlaceMediaHandle Media
+ {
+ get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); }
+ }
+
+ public PlaceReviewHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_id")]
+ internal static extern ErrorCode GetId(this PlaceHandle /* maps_place_h */ place, out string id);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_name")]
+ internal static extern ErrorCode GetName(this PlaceHandle /* maps_place_h */ place, out string name);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_uri")]
+ internal static extern ErrorCode GetUri(this PlaceHandle /* maps_place_h */ place, out string uri);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_distance")]
+ internal static extern ErrorCode GetDistance(this PlaceHandle /* maps_place_h */ place, out int distance);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_location")]
+ internal static extern ErrorCode GetLocation(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_coordinates_h */ location);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_address")]
+ internal static extern ErrorCode GetAddress(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_address_h */ address);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_rating")]
+ internal static extern ErrorCode GetRating(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_rating_h */ rating);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_supplier_link")]
+ internal static extern ErrorCode GetSupplierLink(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_link_object_h */ supplier);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_related_link")]
+ internal static extern ErrorCode GetRelatedLink(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_link_object_h */ related);
+
+ internal class PlaceHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool CategoriesCallback(int index, int total, IntPtr /* maps_place_category_h */ category, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool AttributesCallback(int index, int total, IntPtr /* maps_place_attribute_h */ attribute, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool ContactsCallback(int index, int total, IntPtr /* maps_place_contact_h */ contact, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool EditorialsCallback(int index, int total, IntPtr /* maps_place_editorial_h */ editorial, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool ImagesCallback(int index, int total, IntPtr /* maps_place_image_h */ image, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool ReviewsCallback(int index, int total, IntPtr /* maps_place_review_h */ review, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_property")]
+ internal static extern ErrorCode ForeachProperty(IntPtr /* maps_place_h */ place, PropertiesCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_category")]
+ internal static extern ErrorCode ForeachCategory(IntPtr /* maps_place_h */ place, CategoriesCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_attribute")]
+ internal static extern ErrorCode ForeachAttribute(IntPtr /* maps_place_h */ place, AttributesCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_contact")]
+ internal static extern ErrorCode ForeachContact(IntPtr /* maps_place_h */ place, ContactsCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_editorial")]
+ internal static extern ErrorCode ForeachEditorial(IntPtr /* maps_place_h */ place, EditorialsCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_image")]
+ internal static extern ErrorCode ForeachImage(IntPtr /* maps_place_h */ place, ImagesCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_review")]
+ internal static extern ErrorCode ForeachReview(IntPtr /* maps_place_h */ place, ReviewsCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_h */ place);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_clone")]
+ internal static extern ErrorCode Clone(IntPtr /* maps_place_h */ origin, out IntPtr /* maps_place_h */ cloned);
+
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ }
+
+ internal string Name
+ {
+ get { return NativeGet(this.GetName); }
+ }
+
+ internal string Uri
+ {
+ get { return NativeGet(this.GetUri); }
+ }
+
+ internal int Distance
+ {
+ get { return NativeGet<int>(this.GetDistance); }
+ }
+
+ internal CoordinatesHandle Coordinates
+ {
+ get { return NativeGet(this.GetLocation, CoordinatesHandle.Create); }
+ }
+
+ internal AddressHandle Address
+ {
+ get { return NativeGet(this.GetAddress, AddressHandle.Create); }
+ }
+
+ internal PlaceRatingHandle Rating
+ {
+ get { return NativeGet(this.GetRating, PlaceRatingHandle.Create); }
+ }
+
+ internal PlaceLinkObjectHandle Supplier
+ {
+ get { return NativeGet(this.GetSupplierLink, PlaceLinkObjectHandle.Create); }
+ }
+
+ internal PlaceLinkObjectHandle Related
+ {
+ get { return NativeGet(this.GetRelatedLink, PlaceLinkObjectHandle.Create); }
+ }
+
+ public PlaceHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static PlaceHandle CloneFrom(IntPtr nativeHandle)
+ {
+ IntPtr handle;
+ Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
+ return new PlaceHandle(handle, true);
+ }
+
+
+ internal void ForeachProperty(Action<string, string> action)
+ {
+ PropertiesCallback callback = (index, total, key, value, userData) =>
+ {
+ action(key, value);
+ return true;
+ };
+
+ ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get property list from native handle");
+ }
+
+ internal void ForeachCategory(Action<PlaceCategoryHandle> action)
+ {
+ // PlaceCategoryHandle is valid only in this callback and users should not keep its reference
+ CategoriesCallback callback = (index, total, handle, userData) =>
+ {
+ action(new PlaceCategoryHandle(handle, true));
+ return true;
+ };
+
+ ForeachCategory(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get category list from native handle");
+ }
+
+ internal void ForeachAttribute(Action<PlaceAttributeHandle> action)
+ {
+ // PlaceAttributeHandle is valid only in this callback and users should not keep its reference
+ AttributesCallback callback = (index, total, handle, userData) =>
+ {
+ action(new PlaceAttributeHandle(handle, true));
+ return true;
+ };
+
+ ForeachAttribute(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get attributes list from native handle");
+ }
+
+ internal void ForeachContact(Action<PlaceContactHandle> action)
+ {
+ // PlaceContactHandle is valid only in this callback and users should not keep its reference
+ ContactsCallback callback = (index, total, handle, userData) =>
+ {
+ action(new PlaceContactHandle(handle, true));
+ return true;
+ };
+
+ ForeachContact(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get contacts list from native handle");
+ }
+
+ internal void ForeachEditorial(Action<PlaceEditorialHandle> action)
+ {
+ // PlaceEditorialHandle is valid only in this callback and users should not keep its reference
+ EditorialsCallback callback = (index, total, handle, userData) =>
+ {
+ action(new PlaceEditorialHandle(handle, true));
+ return true;
+ };
+
+ ForeachEditorial(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get editorial list from native handle");
+ }
+
+ internal void ForeachImage(Action<PlaceImageHandle> action)
+ {
+ // PlaceImageHandle is valid only in this callback and users should not keep its reference
+ ImagesCallback callback = (index, total, handle, userData) =>
+ {
+ action(new PlaceImageHandle(handle, true));
+ return true;
+ };
+
+ ForeachImage(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get image list from native handle");
+ }
+
+ internal void ForeachReview(Action<PlaceReviewHandle> action)
+ {
+ // PlaceReviewHandle is valid only in this callback and users should not keep its reference
+ ReviewsCallback callback = (index, total, handle, userData) =>
+ {
+ action(new PlaceReviewHandle(handle, true));
+ return true;
+ };
+
+ ForeachReview(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get review list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal class PlaceListHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PlaceCallback(int index, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_list_h */ placeList);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_foreach")]
+ internal static extern ErrorCode Foreach(IntPtr /* maps_place_list_h */ placeList, PlaceCallback callback, IntPtr /* void */ userData);
+
+ public PlaceListHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) { }
+
+ internal void Foreach(Action<PlaceHandle> action)
+ {
+ PlaceCallback callback = (index, handle, userData) =>
+ {
+ action(PlaceHandle.CloneFrom(handle));
+ return true;
+ };
+
+ Foreach(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get place list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal enum DistanceUnit
+ {
+ Meter, // MAPS_DISTANCE_UNIT_M
+ Kilometer, // MAPS_DISTANCE_UNIT_KM
+ Foot, // MAPS_DISTANCE_UNIT_FT
+ Yard, // MAPS_DISTANCE_UNIT_YD
+ }
+
+ internal enum RouteOptimization
+ {
+ Fastest, // MAPS_ROUTE_TYPE_FASTEST
+ Shortest, // MAPS_ROUTE_TYPE_SHORTEST
+ Economic, // MAPS_ROUTE_TYPE_ECONOMIC
+ Scenic, // MAPS_ROUTE_TYPE_SCENIC
+ FastestNow, // MAPS_ROUTE_TYPE_FASTESTNOW
+ DirectDrive, // MAPS_ROUTE_TYPE_DIRECTDRIVE
+ }
+
+ internal enum RouteTransportMode
+ {
+ Car, // MAPS_ROUTE_TRANSPORT_MODE_CAR
+ Pedestrian, // MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN
+ Bicycle, // MAPS_ROUTE_TRANSPORT_MODE_BICYCLE
+ PublicTransit, // MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT
+ Truck, // MAPS_ROUTE_TRANSPORT_MODE_TRUCK
+ }
+
+ internal enum RouteFeatureWeight
+ {
+ Normal, // MAPS_ROUTE_FEATURE_WEIGHT_NORMAL
+ Prefer, // MAPS_ROUTE_FEATURE_WEIGHT_PREFER
+ Avoid, // MAPS_ROUTE_FEATURE_WEIGHT_AVOID
+ SoftExclude, // MAPS_ROUTE_FEATURE_WEIGHT_SOFTEXCLUDE
+ StrictExclude, // MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE
+ }
+
+ internal enum RouteRequestFeature
+ {
+ None, // MAPS_ROUTE_FEATURE_NO
+ Toll, // MAPS_ROUTE_FEATURE_TOLL
+ MotorWay, // MAPS_ROUTE_FEATURE_MOTORWAY
+ BoatFerry, // MAPS_ROUTE_FEATURE_BOATFERRY
+ RailFerry, // MAPS_ROUTE_FEATURE_RAILFERRY
+ PublicTransit, // MAPS_ROUTE_FEATURE_PUBLICTTRANSIT
+ Tunnel, // MAPS_ROUTE_FEATURE_TUNNEL
+ DirtRoad, // MAPS_ROUTE_FEATURE_DIRTROAD
+ Parks, // MAPS_ROUTE_FEATURE_PARKS
+ Hovlane, // MAPS_ROUTE_FEATURE_HOVLANE
+ Stairs, // MAPS_ROUTE_FEATURE_STAIRS
+ }
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_distance_unit")]
+ internal static extern ErrorCode GetDistanceUnit(this PreferenceHandle /* maps_preference_h */ preference, out DistanceUnit /* maps_distance_unit_e */ unit);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_distance_unit")]
+ internal static extern ErrorCode SetDistanceUnit(this PreferenceHandle /* maps_preference_h */ preference, DistanceUnit /* maps_distance_unit_e */ unit);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_language")]
+ internal static extern ErrorCode GetLanguage(this PreferenceHandle /* maps_preference_h */ preference, out string language);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_language")]
+ internal static extern ErrorCode SetLanguage(this PreferenceHandle /* maps_preference_h */ preference, string language);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_max_results")]
+ internal static extern ErrorCode GetMaxResults(this PreferenceHandle /* maps_preference_h */ preference, out int maxResults);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_max_results")]
+ internal static extern ErrorCode SetMaxResults(this PreferenceHandle /* maps_preference_h */ preference, int maxResults);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_country_code")]
+ internal static extern ErrorCode GetCountryCode(this PreferenceHandle /* maps_preference_h */ preference, out string countryCode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_country_code")]
+ internal static extern ErrorCode SetCountryCode(this PreferenceHandle /* maps_preference_h */ preference, string countryCode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_optimization")]
+ internal static extern ErrorCode GetRouteOptimization(this PreferenceHandle /* maps_preference_h */ preference, out RouteOptimization /* maps_route_optimization_e */ optimization);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_optimization")]
+ internal static extern ErrorCode SetRouteOptimization(this PreferenceHandle /* maps_preference_h */ preference, RouteOptimization /* maps_route_optimization_e */ optimization);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_transport_mode")]
+ internal static extern ErrorCode GetRouteTransportMode(this PreferenceHandle /* maps_preference_h */ preference, out RouteTransportMode /* maps_route_transport_mode_e */ transportMode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_transport_mode")]
+ internal static extern ErrorCode SetRouteTransportMode(this PreferenceHandle /* maps_preference_h */ preference, RouteTransportMode /* maps_route_transport_mode_e */ transportMode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_feature_weight")]
+ internal static extern ErrorCode GetRouteFeatureWeight(this PreferenceHandle /* maps_preference_h */ preference, out RouteFeatureWeight /* maps_route_feature_weight_e */ featureWeight);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_feature_weight")]
+ internal static extern ErrorCode SetRouteFeatureWeight(this PreferenceHandle /* maps_preference_h */ preference, RouteFeatureWeight /* maps_route_feature_weight_e */ featureWeight);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_feature")]
+ internal static extern ErrorCode GetRouteFeature(this PreferenceHandle /* maps_preference_h */ preference, out RouteRequestFeature /* maps_route_feature_e */ feature);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_feature")]
+ internal static extern ErrorCode SetRouteFeature(this PreferenceHandle /* maps_preference_h */ preference, RouteRequestFeature /* maps_route_feature_e */ feature);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_alternatives_enabled")]
+ internal static extern ErrorCode GetRouteAlternativesEnabled(this PreferenceHandle /* maps_preference_h */ preference, out bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_alternatives_enabled")]
+ internal static extern ErrorCode SetRouteAlternativesEnabled(this PreferenceHandle /* maps_preference_h */ preference, bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get")]
+ internal static extern ErrorCode GetProperty(this PreferenceHandle /* maps_preference_h */ preference, string key, out string value);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_property")]
+ internal static extern ErrorCode SetProperty(this PreferenceHandle /* maps_preference_h */ preference, string key, string value);
+
+ internal class PreferenceHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PropertiesCallback(int index, int total, string key, string value, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_foreach_property")]
+ internal static extern ErrorCode ForeachProperty(IntPtr /* maps_preference_h */ preference, PropertiesCallback callback, IntPtr /* void */ userData);
+
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_create")]
+ internal static extern ErrorCode Create(out IntPtr /* maps_preference_h */ preference);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_preference_h */ preference);
+
+ internal DistanceUnit Unit
+ {
+ get { return NativeGet<DistanceUnit>(this.GetDistanceUnit); }
+ set { NativeSet(this.SetDistanceUnit, value); }
+ }
+
+ internal string Language
+ {
+ get { return NativeGet(this.GetLanguage); }
+ set { NativeSet(this.SetLanguage, value); }
+ }
+
+ internal int MaxResult
+ {
+ get { return NativeGet<int>(this.GetMaxResults); }
+ set { NativeSet(this.SetMaxResults, value); }
+ }
+
+ internal string CountryCode
+ {
+ get { return NativeGet(this.GetCountryCode); }
+ set { NativeSet(this.SetCountryCode, value); }
+ }
+
+ internal RouteOptimization Optimization
+ {
+ get { return NativeGet<RouteOptimization>(this.GetRouteOptimization); }
+ set { NativeSet(this.SetRouteOptimization, value); }
+ }
+
+ internal RouteTransportMode TransportMode
+ {
+ get { return NativeGet<RouteTransportMode>(this.GetRouteTransportMode); }
+ set { NativeSet(this.SetRouteTransportMode, value); }
+ }
+
+ internal RouteRequestFeature Feature
+ {
+ get { return NativeGet<RouteRequestFeature>(this.GetRouteFeature); }
+ set { NativeSet(this.SetRouteFeature, value); }
+ }
+
+ internal RouteFeatureWeight FeatureWeight
+ {
+ get { return NativeGet<RouteFeatureWeight>(this.GetRouteFeatureWeight); }
+ set { NativeSet(this.SetRouteFeatureWeight, value); }
+ }
+
+ internal bool AlternativesEnabled
+ {
+ get { return NativeGet<bool>(this.GetRouteAlternativesEnabled); }
+ set { NativeSet(this.SetRouteAlternativesEnabled, value); }
+ }
+
+ internal PreferenceHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal PreferenceHandle() : this(IntPtr.Zero, true)
+ {
+ Create(out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal void ForeachProperty(Action<string, string> action)
+ {
+ PropertiesCallback callback = (index, total, key, value, userData) =>
+ {
+ action(key, value);
+ return true;
+ };
+
+ ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get property list from native handle");
+ }
+
+ internal static PreferenceHandle Create(IntPtr nativeHandle)
+ {
+ return new PreferenceHandle(nativeHandle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal enum RouteDirection
+ {
+ None, // MAPS_ROUTE_DIRECTION_NONE
+ North, // MAPS_ROUTE_DIRECTION_NORTH
+ NorthWest, // MAPS_ROUTE_DIRECTION_NORTHWEST
+ NorthEast, // MAPS_ROUTE_DIRECTION_NORTHEAST
+ South, // MAPS_ROUTE_DIRECTION_SOUTH
+ SouthEast, // MAPS_ROUTE_DIRECTION_SOUTHEAST
+ SouthWest, // MAPS_ROUTE_DIRECTION_SOUTHWEST
+ West, // MAPS_ROUTE_DIRECTION_WEST
+ East, // MAPS_ROUTE_DIRECTION_EAST
+ }
+
+ internal enum RouteTurnType
+ {
+ None, // MAPS_ROUTE_TURN_TYPE_NONE
+ Straight, // MAPS_ROUTE_TURN_TYPE_STRAIGHT
+ BearRight, // MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT
+ LightRight, // MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT
+ Right, // MAPS_ROUTE_TURN_TYPE_RIGHT
+ HardRight, // MAPS_ROUTE_TURN_TYPE_HARD_RIGHT
+ UturnRight, // MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT
+ UturnLeft, // MAPS_ROUTE_TURN_TYPE_UTURN_LEFT
+ HardLeft, // MAPS_ROUTE_TURN_TYPE_HARD_LEFT
+ Left, // MAPS_ROUTE_TURN_TYPE_LEFT
+ LightLeft, // MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT
+ BearLeft, // MAPS_ROUTE_TURN_TYPE_BEAR_LEFT
+ RightFork, // MAPS_ROUTE_TURN_TYPE_RIGHT_FORK
+ LeftFork, // MAPS_ROUTE_TURN_TYPE_LEFT_FORK
+ StraightFork, // MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK
+ }
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_direction_id")]
+ internal static extern ErrorCode GetDirectionId(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out RouteDirection /* maps_route_direction_e */ directionId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_turn_type")]
+ internal static extern ErrorCode GetTurnType(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out RouteTurnType /* maps_route_turn_type_e */ turnType);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_position")]
+ internal static extern ErrorCode GetPosition(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out IntPtr /* maps_coordinates_h */ position);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_road_name")]
+ internal static extern ErrorCode GetRoadName(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string roadName);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_instruction_text")]
+ internal static extern ErrorCode GetInstructionText(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string instructionText);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_locale")]
+ internal static extern ErrorCode GetLocale(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string locale);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_time_to_next_instruction")]
+ internal static extern ErrorCode GetTimeToNextInstruction(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out int timeToNextInstruction);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_distance_to_next_instruction")]
+ internal static extern ErrorCode GetDistanceToNextInstruction(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out double distanceToNextInstruction);
+
+ internal class RouteManeuverHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_route_maneuver_h */ maneuver);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_clone")]
+ internal static extern ErrorCode Clone(IntPtr /* maps_route_maneuver_h */ origin, out IntPtr /* maps_route_maneuver_h */ cloned);
+
+ internal string RoadName
+ {
+ get { return NativeGet(this.GetRoadName); }
+ }
+
+ internal string Instruction
+ {
+ get { return NativeGet(this.GetInstructionText); }
+ }
+
+ internal string Locale
+ {
+ get { return NativeGet(this.GetLocale); }
+ }
+
+ internal int TimeToNextInstruction
+ {
+ get { return NativeGet<int>(this.GetTimeToNextInstruction); }
+ }
+
+ internal double DistanceToNextInstruction
+ {
+ get { return NativeGet<double>(this.GetDistanceToNextInstruction); }
+ }
+
+ internal RouteDirection Direction
+ {
+ get { return NativeGet<RouteDirection>(this.GetDirectionId); }
+ }
+
+ internal RouteTurnType TurnType
+ {
+ get { return NativeGet<RouteTurnType>(this.GetTurnType); }
+ }
+
+ internal CoordinatesHandle Coordinates
+ {
+ get { return NativeGet(this.GetPosition, CoordinatesHandle.Create); }
+ }
+
+ public RouteManeuverHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static RouteManeuverHandle CloneFrom(IntPtr nativeHandle)
+ {
+ IntPtr handle;
+ Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
+ return new RouteManeuverHandle(handle, true);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_origin")]
+ internal static extern ErrorCode GetOrigin(this RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_coordinates_h */ origin);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_destination")]
+ internal static extern ErrorCode GetDestination(this RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_coordinates_h */ destination);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_bounding_box")]
+ internal static extern ErrorCode GetBoundingBox(this RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_area_h */ boundingBox);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_distance")]
+ internal static extern ErrorCode GetDistance(this RouteSegmentHandle /* maps_route_segment_h */ segment, out double distance);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_duration")]
+ internal static extern ErrorCode GetDuration(this RouteSegmentHandle /* maps_route_segment_h */ segment, out long duration);
+
+ internal class RouteSegmentHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool ManeuverCallback(int index, int total, IntPtr /* maps_route_maneuver_h */ maneuver, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_foreach_path")]
+ internal static extern ErrorCode ForeachPath(IntPtr /* maps_route_segment_h */ segment, PathCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_foreach_maneuver")]
+ internal static extern ErrorCode ForeachManeuver(IntPtr /* maps_route_segment_h */ segment, ManeuverCallback callback, IntPtr /* void */ userData);
+
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_route_segment_h */ segment);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_clone")]
+ internal static extern ErrorCode Clone(IntPtr /* maps_route_segment_h */ origin, out IntPtr /* maps_route_segment_h */ cloned);
+
+ internal double Distance
+ {
+ get { return NativeGet<double>(this.GetDistance); }
+ }
+
+ internal long Duration
+ {
+ get { return NativeGet<long>(this.GetDuration); }
+ }
+
+ internal CoordinatesHandle Origin
+ {
+ get { return NativeGet(this.GetOrigin, CoordinatesHandle.Create); }
+ }
+
+ internal CoordinatesHandle Destination
+ {
+ get { return NativeGet(this.GetDestination, CoordinatesHandle.Create); }
+ }
+
+ internal AreaHandle BoundingBox
+ {
+ get { return NativeGet(this.GetBoundingBox, AreaHandle.Create); }
+ }
+
+ public RouteSegmentHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static RouteSegmentHandle CloneFrom(IntPtr nativeHandle)
+ {
+ IntPtr handle;
+ Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
+ return new RouteSegmentHandle(handle, true);
+ }
+
+ internal void ForeachPath(Action<CoordinatesHandle> action)
+ {
+ PathCallback callback = (index, total, nativeHandle, userData) =>
+ {
+ if (handle != IntPtr.Zero)
+ {
+ action(CoordinatesHandle.CloneFrom(nativeHandle));
+ //Destroy(nativeHandle);
+ }
+ return true;
+ };
+
+ ForeachPath(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get path coordinates list from native handle");
+ }
+
+ internal void ForeachManeuver(Action<RouteManeuverHandle> action)
+ {
+ ManeuverCallback callback = (index, total, nativeHandle, userData) =>
+ {
+ if (handle != IntPtr.Zero)
+ {
+ action(RouteManeuverHandle.CloneFrom(nativeHandle));
+ //Destroy(nativeHandle);
+ }
+ return true;
+ };
+
+ ForeachManeuver(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get segment list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_route_id")]
+ internal static extern ErrorCode GetRouteId(this RouteHandle /* maps_route_h */ route, out string routeId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_origin")]
+ internal static extern ErrorCode GetOrigin(this RouteHandle /* maps_route_h */ route, out IntPtr /* maps_coordinates_h */ origin);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_destination")]
+ internal static extern ErrorCode GetDestination(this RouteHandle /* maps_route_h */ route, out IntPtr /* maps_coordinates_h */ destination);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_bounding_box")]
+ internal static extern ErrorCode GetBoundingBox(this RouteHandle /* maps_route_h */ route, out IntPtr /* maps_area_h */ boundingBox);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_transport_mode")]
+ internal static extern ErrorCode GetTransportMode(this RouteHandle /* maps_route_h */ route, out RouteTransportMode /* maps_route_transport_mode_e */ transportMode);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_total_distance")]
+ internal static extern ErrorCode GetTotalDistance(this RouteHandle /* maps_route_h */ route, out double totalDistance);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_total_duration")]
+ internal static extern ErrorCode GetTotalDuration(this RouteHandle /* maps_route_h */ route, out long totalDuration);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_distance_unit")]
+ internal static extern ErrorCode GetDistanceUnit(this RouteHandle /* maps_route_h */ route, out DistanceUnit /* maps_distance_unit_e */ distanceUnit);
+
+ internal class RouteHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool SegmentCallback(int index, int total, IntPtr /* maps_route_segment_h */ segment, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_foreach_property")]
+ internal static extern ErrorCode ForeachProperty(IntPtr /* maps_route_h */ route, PropertiesCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_foreach_path")]
+ internal static extern ErrorCode ForeachPath(IntPtr /* maps_route_h */ route, PathCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_foreach_segment")]
+ internal static extern ErrorCode ForeachSegment(IntPtr /* maps_route_h */ route, SegmentCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_route_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_route_h */ route);
+
+ internal string Id
+ {
+ get { return NativeGet(this.GetRouteId); }
+ }
+
+ internal double Distance
+ {
+ get { return NativeGet<double>(this.GetTotalDistance); }
+ }
+
+ internal long Duration
+ {
+ get { return NativeGet<long>(this.GetTotalDuration); }
+ }
+
+ internal DistanceUnit Unit
+ {
+ get { return NativeGet<DistanceUnit>(this.GetDistanceUnit); }
+ }
+
+ internal RouteTransportMode TransportMode
+ {
+ get { return NativeGet<RouteTransportMode>(this.GetTransportMode); }
+ }
+
+ internal CoordinatesHandle Origin
+ {
+ get { return NativeGet(this.GetOrigin, CoordinatesHandle.Create); }
+ }
+
+ internal CoordinatesHandle Destination
+ {
+ get { return NativeGet(this.GetDestination, CoordinatesHandle.Create); }
+ }
+
+ internal AreaHandle BoundingBox
+ {
+ get { return NativeGet(this.GetBoundingBox, AreaHandle.Create); }
+ }
+
+ public RouteHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal void ForeachProperty(Action<string, string> action)
+ {
+ PropertiesCallback callback = (index, total, key, value, userData) =>
+ {
+ action(key, value);
+ return true;
+ };
+
+ ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get property list from native handle");
+ }
+
+ internal void ForeachPath(Action<CoordinatesHandle> action)
+ {
+ PathCallback callback = (index, total, nativeHandle, userData) =>
+ {
+ if (handle != IntPtr.Zero)
+ {
+ action(CoordinatesHandle.CloneFrom(nativeHandle));
+ //Destroy(nativeHandle);
+ }
+ return true;
+ };
+
+ ForeachPath(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get path coordinates list from native handle");
+ }
+
+ internal void ForeachSegment(Action<RouteSegmentHandle> action)
+ {
+ SegmentCallback callback = (index, total, nativeHandle, userData) =>
+ {
+ if (handle != IntPtr.Zero)
+ {
+ action(RouteSegmentHandle.CloneFrom(nativeHandle));
+ //Destroy(nativeHandle);
+ }
+ return true;
+ };
+
+ ForeachSegment(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get segment list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+
+internal static partial class Interop
+{
+ private const string LogTag = "Tizen.Maps";
+
+ public delegate ErrorCode GetterMethod<T>(out T value);
+ public delegate ErrorCode GetterPtrMethod(out IntPtr value);
+ public delegate ErrorCode SetterMethod<T>(T value);
+
+ internal static T NativeGet<T>(GetterMethod<T> getter, [CallerMemberName] string propertyName = "")
+ {
+ T value;
+ var err = getter(out value);
+ if (err.IsSuccess())
+ {
+ return value;
+ }
+
+ //err.WarnIfFailed($"Native getter for {propertyName} failed");
+ return default(T);
+ }
+
+ internal static T NativeGet<T>(GetterMethod<IntPtr> getter, Func<IntPtr, T> ctor, [CallerMemberName] string propertyName = "") where T : SafeMapsHandle
+ {
+ return ctor(NativeGet(getter, propertyName));
+ }
+
+ internal static T NativeGet<T>(GetterMethod<IntPtr> getter, Func<IntPtr, bool, T> ctor, bool hasOwnership, [CallerMemberName] string propertyName = "") where T : SafeMapsHandle
+ {
+ return ctor(NativeGet(getter, propertyName), hasOwnership);
+ }
+
+ internal static string NativeGet(GetterMethod<string> getter, [CallerMemberName] string propertyName = "")
+ {
+ string value;
+ var err = getter(out value);
+ if (err.IsSuccess())
+ {
+ return value;
+ }
+
+ //err.WarnIfFailed($"Native getter for {propertyName} failed");
+ return string.Empty;
+ }
+
+ internal static void NativeSet<T>(SetterMethod<T> setter, T value, [CallerMemberName] string propertyName = "")
+ {
+ setter(value).WarnIfFailed($"Native setter for {propertyName} failed");
+ }
+
+ internal abstract class SafeMapsHandle : SafeHandle
+ {
+ protected delegate ErrorCode DestroyNativeHandleMethod(IntPtr handle);
+ protected DestroyNativeHandleMethod DestroyHandle;
+
+ protected SafeMapsHandle(IntPtr handle, bool needToRelease, DestroyNativeHandleMethod destroy) : base(handle, true)
+ {
+ HasOwnership = needToRelease;
+ DestroyHandle = destroy;
+ }
+
+ internal bool HasOwnership { get; set; }
+
+ public override bool IsInvalid { get { return handle == IntPtr.Zero; } }
+
+ protected override bool ReleaseHandle()
+ {
+ if (HasOwnership)
+ {
+ var err = DestroyHandle(handle);
+ err.WarnIfFailed($"Failed to delete native {GetType()} handle");
+ }
+
+ SetHandle(IntPtr.Zero);
+ return true;
+ }
+
+ public static implicit operator IntPtr(SafeMapsHandle otherHandle)
+ {
+ return otherHandle.handle;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal enum ServiceType
+ {
+ Geocode, // MAPS_SERVICE_GEOCODE
+ GeocodeInsideArea, // MAPS_SERVICE_GEOCODE_INSIDE_AREA
+ GeocodeByStructuredAddress, // MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS
+ ReverseGeocode, // MAPS_SERVICE_REVERSE_GEOCODE
+ SearchPlace, // MAPS_SERVICE_SEARCH_PLACE
+ SearchPlaceByArea, // MAPS_SERVICE_SEARCH_PLACE_BY_AREA
+ SearchPlaceByAddress, // MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS
+ SearchRoute, // MAPS_SERVICE_SEARCH_ROUTE
+ SearchRouteWaypoints, // MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS
+ CancelRequest, // MAPS_SERVICE_CANCEL_REQUEST
+ MultiReverseGeocode, // MAPS_SERVICE_MULTI_REVERSE_GEOCODE
+ SearchPlaceList, // MAPS_SERVICE_SEARCH_PLACE_LIST
+ SearchGetPlaceDetails, // MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS
+ View = 0x100, // MAPS_SERVICE_VIEW
+ ViewSnapshot, // MAPS_SERVICE_VIEW_SNAPSHOT
+ }
+
+ internal enum ServiceData
+ {
+ PlaceAddress, // MAPS_PLACE_ADDRESS
+ PlaceRating, // MAPS_PLACE_RATING
+ PlaceCategories, // MAPS_PLACE_CATEGORIES
+ PlaceAttributes, // MAPS_PLACE_ATTRIBUTES
+ PlaceContacts, // MAPS_PLACE_CONTACTS
+ PlaceEditorials, // MAPS_PLACE_EDITORIALS
+ PlaceReviews, // MAPS_PLACE_REVIEWS
+ PlaceImage, // MAPS_PLACE_IMAGE
+ PlaceSupplier, // MAPS_PLACE_SUPPLIER
+ PlaceRelated, // MAPS_PLACE_RELATED
+ RoutePath, // MAPS_ROUTE_PATH
+ RouteSegmentsPath, // MAPS_ROUTE_SEGMENTS_PATH
+ RouteSegmentsManeuvers, // MAPS_ROUTE_SEGMENTS_MANEUVERS
+ ViewTraffic = 0x100, // MAPS_VIEW_TRAFFIC
+ ViewPublicTransit, // MAPS_VIEW_PUBLIC_TRANSIT
+ ViewBuilding, // MAPS_VIEW_BUILDING
+ ViewScaleBar, // MAPS_VIEW_SCALEBAR
+ }
+
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool GeocodeCallback(ErrorCode /* maps_error_e */ result, int requestId, int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ReverseGeocodeCallback(ErrorCode /* maps_error_e */ result, int requestId, int index, int total, IntPtr /* maps_address_h */ address, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool MultiReverseGeocodeCallback(ErrorCode /* maps_error_e */ result, int requestId, int total, IntPtr /* maps_address_list_h */ addressList, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool SearchPlaceCallback(ErrorCode /* maps_error_e */ error, int requestId, int index, int total, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void SearchPlaceListCallback(ErrorCode /* maps_error_e */ error, int requestId, int total, IntPtr /* maps_place_list_h */ placeList, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void GetPlaceDetailsCallback(ErrorCode /* maps_error_e */ error, int requestId, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool SearchRouteCallback(ErrorCode /* maps_error_e */ error, int requestId, int index, int total, IntPtr /* maps_route_h */ route, IntPtr /* void */ userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void RequestUserConsentwithHandleCallback(bool consented, IntPtr /* void */ userData);
+
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_cancel_request")]
+ internal static extern ErrorCode CancelRequest(this ServiceHandle /* maps_service_h */ maps, int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_geocode")]
+ internal static extern ErrorCode Geocode(this ServiceHandle /* maps_service_h */ maps, string address, PreferenceHandle /* maps_preference_h */ preference, GeocodeCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_geocode_inside_area")]
+ internal static extern ErrorCode GeocodeInsideArea(this ServiceHandle /* maps_service_h */ maps, string address, AreaHandle /* maps_area_h */ bounds, PreferenceHandle /* maps_preference_h */ preference, GeocodeCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_geocode_by_structured_address")]
+ internal static extern ErrorCode GeocodeByStructuredAddress(this ServiceHandle /* maps_service_h */ maps, AddressHandle /* maps_address_h */ address, PreferenceHandle /* maps_preference_h */ preference, GeocodeCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_reverse_geocode")]
+ internal static extern ErrorCode ReverseGeocode(this ServiceHandle /* maps_service_h */ maps, double latitude, double longitude, PreferenceHandle /* maps_preference_h */ preference, ReverseGeocodeCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_multi_reverse_geocode")]
+ internal static extern ErrorCode MultiReverseGeocode(this ServiceHandle /* maps_service_h */ maps, CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, PreferenceHandle /* maps_preference_h */ preference, MultiReverseGeocodeCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place")]
+ internal static extern ErrorCode SearchPlace(this ServiceHandle /* maps_service_h */ maps, CoordinatesHandle /* maps_coordinates_h */ position, int distance, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place_by_area")]
+ internal static extern ErrorCode SearchPlaceByArea(this ServiceHandle /* maps_service_h */ maps, AreaHandle /* maps_area_h */ boundary, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place_by_address")]
+ internal static extern ErrorCode SearchPlaceByAddress(this ServiceHandle /* maps_service_h */ maps, string address, AreaHandle /* maps_area_h */ boundary, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place_list")]
+ internal static extern ErrorCode SearchPlaceList(this ServiceHandle /* maps_service_h */ maps, AreaHandle /* maps_area_h */ boundary, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceListCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_place_details")]
+ internal static extern ErrorCode GetPlaceDetails(this ServiceHandle /* maps_service_h */ maps, string uri, GetPlaceDetailsCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route")]
+ internal static extern ErrorCode SearchRoute(this ServiceHandle /* maps_service_h */ maps, CoordinatesHandle /* maps_coordinates_h */ origin, CoordinatesHandle /* maps_coordinates_h */ destination, PreferenceHandle /* maps_preference_h */ preference, SearchRouteCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route_waypoints")]
+ internal static extern ErrorCode SearchRouteWaypoints(this ServiceHandle /* maps_service_h */ maps, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] [In] IntPtr[] /* maps_coordinates_h */ waypointList, int waypointNum, PreferenceHandle /* maps_preference_h */ preference, SearchRouteCallback callback, IntPtr /* void */ userData, out int requestId);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_user_consent")]
+ internal static extern ErrorCode GetUserConsent(this ServiceHandle /* maps_service_h */ maps, out bool consent);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_set_provider_key")]
+ internal static extern ErrorCode SetProviderKey(this ServiceHandle /* maps_service_h */ maps, string providerKey);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_provider_key")]
+ internal static extern ErrorCode GetProviderKey(this ServiceHandle /* maps_service_h */ maps, out string providerKey);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_set_preference")]
+ internal static extern ErrorCode SetPreference(this ServiceHandle /* maps_service_h */ maps, PreferenceHandle /* maps_preference_h */ preference);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_preference")]
+ internal static extern ErrorCode GetPreference(this ServiceHandle /* maps_service_h */ maps, out IntPtr /* maps_preference_h */ preference);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_provider_is_service_supported")]
+ internal static extern ErrorCode IsServiceSupported(this ServiceHandle /* maps_service_h */ maps, ServiceType /* maps_service_e */ service, out bool supported);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_provider_is_data_supported")]
+ internal static extern ErrorCode IsDataSupported(this ServiceHandle /* maps_service_h */ maps, ServiceData /* maps_service_data_e */ data, out bool supported);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_request_user_consent_with_handle")]
+ internal static extern ErrorCode RequestUserConsent(this ServiceHandle /* maps_service_h */ maps, RequestUserConsentwithHandleCallback callback, IntPtr /* void */ userData);
+
+ internal class ServiceHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool ProviderInfoCallback(string mapsProvider, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_foreach_provider")]
+ internal static extern ErrorCode ForeachProvider(ProviderInfoCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_create_without_user_consent")]
+ internal static extern ErrorCode Create(string provider, out IntPtr /* maps_service_h */ maps);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_service_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_service_h */ maps);
+
+ internal bool UserConsented
+ {
+ get { return NativeGet<bool>(this.GetUserConsent); }
+ }
+
+ internal string ProviderKey
+ {
+ get { return NativeGet(this.GetProviderKey); }
+ set { NativeSet(this.SetProviderKey, value); }
+ }
+
+ internal PreferenceHandle Preferences
+ {
+ get { return NativeGet(this.GetPreference, PreferenceHandle.Create); }
+ set { NativeSet(this.SetPreference, value); }
+ }
+
+ public ServiceHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ public ServiceHandle(string serviceProvider) : this(IntPtr.Zero, true)
+ {
+ Create(serviceProvider, out handle).ThrowIfFailed($"Failed to create native handle for {serviceProvider}");
+ }
+
+ internal static void ForeachProvider(Action<string> action)
+ {
+ ProviderInfoCallback callback = (provider, userData) =>
+ {
+ action(provider);
+ return true;
+ };
+
+ ForeachProvider(callback, IntPtr.Zero).WarnIfFailed("Failed to get provider list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using ElmSharp;
+
+internal static partial class Interop
+{
+ internal enum ViewAction
+ {
+ None, // MAPS_VIEW_ACTION_NONE
+ Scroll, // MAPS_VIEW_ACTION_SCROLL
+ Zoom, // MAPS_VIEW_ACTION_ZOOM
+ ZoomIn, // MAPS_VIEW_ACTION_ZOOM_IN
+ ZoomOut, // MAPS_VIEW_ACTION_ZOOM_OUT
+ ZoomAndScroll, // MAPS_VIEW_ACTION_ZOOM_AND_SCROLL
+ Rotate, // MAPS_VIEW_ACTION_ROTATE
+ }
+
+ internal enum ViewGesture
+ {
+ None, // MAPS_VIEW_GESTURE_NONE
+ Scroll, // MAPS_VIEW_GESTURE_SCROLL
+ Zoom, // MAPS_VIEW_GESTURE_ZOOM
+ Click, // MAPS_VIEW_GESTURE_TAP
+ DoubleClick, // MAPS_VIEW_GESTURE_DOUBLE_TAP
+ TwoFingerClick, // MAPS_VIEW_GESTURE_2_FINGER_TAP
+ Rotation, // MAPS_VIEW_GESTURE_ROTATE
+ LongPress, // MAPS_VIEW_GESTURE_LONG_PRESS
+ }
+
+ internal enum ViewEventType
+ {
+ Gesture, // MAPS_VIEW_EVENT_GESTURE
+ Action, // MAPS_VIEW_EVENT_ACTION
+ Object, // MAPS_VIEW_EVENT_OBJECT
+ Ready, // MAPS_VIEW_EVENT_READY
+ }
+
+ internal static partial class ViewEventData
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_clone")]
+ internal static extern ErrorCode Clone(IntPtr /* maps_view_event_data_h */ origin, out IntPtr /* maps_view_event_data_h */ cloned);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_center")]
+ internal static extern ErrorCode GetCenter(IntPtr /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_coordinates_h */ center);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_delta")]
+ internal static extern ErrorCode GetDelta(IntPtr /* maps_view_event_data_h */ viewEvent, out int deltaX, out int deltaY);
+ }
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_type")]
+ internal static extern ErrorCode GetType(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out ViewEventType /* maps_view_event_type_e */ eventType);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_gesture_type")]
+ internal static extern ErrorCode GetGestureType(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out ViewGesture /* maps_view_gesture_e */ gestureType);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_action_type")]
+ internal static extern ErrorCode GetActionType(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out ViewAction /* maps_view_action_e */ actionType);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_position")]
+ internal static extern ErrorCode GetPosition(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out int x, out int y);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_fingers")]
+ internal static extern ErrorCode GetFingers(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out int fingers);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_object")]
+ internal static extern ErrorCode GetObject(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_view_object_h */ viewEventDataObject);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_coordinates")]
+ internal static extern ErrorCode GetCoordinates(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_zoom_factor")]
+ internal static extern ErrorCode GetZoomFactor(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out double zoomFactor);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_rotation_angle")]
+ internal static extern ErrorCode GetRotationAngle(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out double rotationAngle);
+
+ internal static ErrorCode GetPosition(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out Point position)
+ {
+ position = new Point();
+ return GetPosition(viewEvent, out position.X, out position.Y);
+ }
+
+ internal class EventDataHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_view_event_data_h */ viewEvent);
+
+ internal ViewEventType Type
+ {
+ get { return NativeGet<ViewEventType>(this.GetType); }
+ }
+
+ // event_data will be released automatically after this callback is terminated.
+ internal EventDataHandle(IntPtr handle) : base(handle, false, Destroy)
+ {
+ }
+ }
+
+ internal class ObjectEventDataHandle : EventDataHandle
+ {
+ internal ViewGesture GestureType
+ {
+ get { return NativeGet<ViewGesture>(this.GetGestureType); }
+ }
+
+ internal Point Position
+ {
+ get { return NativeGet<Point>(this.GetPosition); }
+ }
+
+ internal int FingerCount
+ {
+ get { return NativeGet<int>(this.GetFingers); }
+ }
+
+ internal ViewObjectHandle ViewObject
+ {
+ get { return NativeGet(this.GetObject, ViewObjectHandle.Create, false ); }
+ }
+
+ // event_data will be released automatically after this callback is terminated.
+ internal ObjectEventDataHandle(IntPtr handle) : base(handle)
+ {
+ }
+ }
+
+ internal class GestureEventDataHandle : EventDataHandle
+ {
+ internal ViewGesture GestureType
+ {
+ get { return NativeGet<ViewGesture>(this.GetGestureType); }
+ }
+
+ internal Point Position
+ {
+ get { return NativeGet<Point>(this.GetPosition); }
+ }
+
+ internal int FingerCount
+ {
+ get { return NativeGet<int>(this.GetFingers); }
+ }
+
+ internal double ZoomFactor
+ {
+ get { return NativeGet<double>(this.GetZoomFactor); }
+ }
+
+ internal double RotationAngle
+ {
+ get { return NativeGet<double>(this.GetRotationAngle); }
+ }
+
+ internal CoordinatesHandle Coordinates
+ {
+ get { return NativeGet(this.GetCoordinates, CoordinatesHandle.Create); }
+ }
+
+ internal GestureEventDataHandle(IntPtr handle) : base(handle)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using ElmSharp;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_type")]
+ internal static extern ErrorCode GetType(this MarkerHandle /* maps_view_object_h */ marker, out ViewMarkerType /* maps_view_marker_type_e */ type);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_coordinates")]
+ internal static extern ErrorCode GetCoordinates(this MarkerHandle /* maps_view_object_h */ marker, out IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_coordinates")]
+ internal static extern ErrorCode SetCoordinates(this MarkerHandle /* maps_view_object_h */ marker, CoordinatesHandle /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_image_file")]
+ internal static extern ErrorCode GetImageFile(this MarkerHandle /* maps_view_object_h */ marker, out string filePath);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_image_file")]
+ internal static extern ErrorCode SetImageFile(this MarkerHandle /* maps_view_object_h */ marker, string filePath);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_z_order")]
+ internal static extern ErrorCode GetZOrder(this MarkerHandle /* maps_view_object_h */ marker, out int zOrder);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_z_order")]
+ internal static extern ErrorCode SetZOrder(this MarkerHandle /* maps_view_object_h */ marker, int zOrder);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_size")]
+ internal static extern ErrorCode GetSize(this MarkerHandle /* maps_view_object_h */ marker, out int width, out int height);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_resize")]
+ internal static extern ErrorCode Resize(this MarkerHandle /* maps_view_object_h */ marker, int width, int height);
+
+ internal static ErrorCode GetSize(this MarkerHandle /* maps_view_object_h */ marker, out Size size)
+ {
+ size = new Size(0, 0);
+ return GetSize(marker, out size.Width, out size.Height);
+ }
+
+ internal static ErrorCode SetSize(this MarkerHandle /* maps_view_object_h */ marker, Size size)
+ {
+ return Resize(marker, size.Width, size.Height);
+ }
+
+ internal class MarkerHandle : ViewObjectHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_marker")]
+ internal static extern ErrorCode CreateMarker(CoordinatesHandle /* maps_coordinates_h */ coordinates, string imageFilePath, ViewMarkerType /* maps_view_marker_type_e */ type, out IntPtr /* maps_view_object_h */ marker);
+
+ internal ViewMarkerType Type
+ {
+ get { return NativeGet<ViewMarkerType>(this.GetType); }
+ }
+
+ internal string ImageFile
+ {
+ get { return NativeGet(this.GetImageFile); }
+ set { NativeSet(this.SetImageFile, value); }
+ }
+
+ internal int ZOrder
+ {
+ get { return NativeGet<int>(this.GetZOrder); }
+ set { NativeSet(this.SetZOrder, value); }
+ }
+
+ internal Size MarkerSize
+ {
+ get { return NativeGet<Size>(this.GetSize); }
+ set { NativeSet(this.SetSize, value); }
+ }
+
+ internal CoordinatesHandle Coordinates
+ {
+ get { return NativeGet(this.GetCoordinates, CoordinatesHandle.Create); }
+ set { NativeSet(this.SetCoordinates, value); }
+ }
+
+ internal MarkerHandle(CoordinatesHandle coordinates, string imagePath, ViewMarkerType type) : base(IntPtr.Zero, true)
+ {
+ var clonedCoordinatesHandle = CoordinatesHandle.CloneFrom(coordinates);
+ CreateMarker(clonedCoordinatesHandle, imagePath, type, out handle).ThrowIfFailed("Failed to create native handle for marker");
+ clonedCoordinatesHandle.HasOwnership = false;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using ElmSharp;
+
+internal static partial class Interop
+{
+ internal enum ViewObjectType
+ {
+ Polyline, // MAPS_VIEW_OBJECT_POLYLINE
+ Polygon, // MAPS_VIEW_OBJECT_POLYGON
+ Marker, // MAPS_VIEW_OBJECT_MARKER
+ Overlay, // MAPS_VIEW_OBJECT_OVERLAY
+ }
+
+ internal enum ViewMarkerType
+ {
+ Pin, // MAPS_VIEW_MARKER_PIN
+ Sticker, // MAPS_VIEW_MARKER_STICKER
+ }
+
+ internal enum ViewOverlayType
+ {
+ Normal, // MAPS_VIEW_OVERLAY_NORMAL
+ Bubble, // MAPS_VIEW_OVERLAY_BUBBLE
+ Box, // MAPS_VIEW_OVERLAY_BOX
+ }
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_type")]
+ internal static extern ErrorCode GetType(this ViewObjectHandle /* maps_view_object_h */ viewObject, out ViewObjectType /* maps_view_object_type_e */ type);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_set_visible")]
+ internal static extern ErrorCode SetVisible(this ViewObjectHandle /* maps_view_object_h */ viewObject, bool visible);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_visible")]
+ internal static extern ErrorCode GetVisible(this ViewObjectHandle /* maps_view_object_h */ viewObject, out bool visible);
+
+ internal class ViewObjectHandle : SafeMapsHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_view_object_h */ viewObject);
+
+ internal bool IsVisible
+ {
+ get { return NativeGet<bool>(this.GetVisible); }
+ set { NativeSet(this.SetVisible, value); }
+ }
+
+ public ViewObjectHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static ViewObjectHandle Create(IntPtr nativeHandle, bool needToRelease)
+ {
+ return new ViewObjectHandle(nativeHandle, needToRelease);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using ElmSharp;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_coordinates")]
+ internal static extern ErrorCode SetCoordinates(this OverlayHandle /* maps_view_object_h */ overlay, CoordinatesHandle /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_coordinates")]
+ internal static extern ErrorCode GetCoordinates(this OverlayHandle /* maps_view_object_h */ overlay, out IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_min_zoom_level")]
+ internal static extern ErrorCode SetMinZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, int zoom);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_min_zoom_level")]
+ internal static extern ErrorCode GetMinZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, out int zoom);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_max_zoom_level")]
+ internal static extern ErrorCode SetMaxZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, int zoom);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_max_zoom_level")]
+ internal static extern ErrorCode GetMaxZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, out int zoom);
+
+ internal class OverlayHandle : ViewObjectHandle
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_overlay")]
+ internal static extern ErrorCode CreateOverlay(CoordinatesHandle /* maps_coordinates_h */ coordinates, IntPtr viewObject, ViewOverlayType /* maps_view_overlay_type_e */ type, out IntPtr /* maps_view_object_h */ overlay);
+
+ internal int MinZoomLevel
+ {
+ get { return NativeGet<int>(this.GetMinZoomLevel); }
+ set { NativeSet(this.SetMinZoomLevel, value); }
+ }
+
+ internal int MaxZoomLevel
+ {
+ get { return NativeGet<int>(this.GetMaxZoomLevel); }
+ set { NativeSet(this.SetMaxZoomLevel, value); }
+ }
+
+
+ internal CoordinatesHandle Coordinates
+ {
+ get { return NativeGet(this.GetCoordinates, CoordinatesHandle.Create); }
+ set { NativeSet(this.SetCoordinates, value); }
+ }
+
+ internal OverlayHandle(CoordinatesHandle coordinates, EvasObject viewObject, ViewOverlayType type) : base(IntPtr.Zero, true)
+ {
+ var clonedCoordinatesHandle = CoordinatesHandle.CloneFrom(coordinates);
+ CreateOverlay(clonedCoordinatesHandle, viewObject, type, out handle).ThrowIfFailed("Failed to create native overlay handle");
+ clonedCoordinatesHandle.HasOwnership = false;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using ElmSharp;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_set_polygon")]
+ internal static extern ErrorCode SetPolygon(this PolygonHandle /* maps_view_object_h */ polygon, CoordinatesListHandle /* maps_coordinates_list_h */ points);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_get_fill_color")]
+ internal static extern ErrorCode GetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, out byte r, out byte g, out byte b, out byte a);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_set_fill_color")]
+ internal static extern ErrorCode SetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, byte r, byte g, byte b, byte a);
+
+ internal static ErrorCode GetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, out Color color)
+ {
+ byte r, g, b, a;
+ var err = polygon.GetFillColor(out r, out g, out b, out a);
+ color = new Color(r, g, b, a);
+ return err;
+ }
+
+ internal static ErrorCode SetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, Color color)
+ {
+ return polygon.SetFillColor((byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A);
+ }
+
+ internal class PolygonHandle : ViewObjectHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool CoordinatesCallback(int index, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_foreach_point")]
+ internal static extern ErrorCode ForeachPoint(IntPtr /* maps_view_object_h */ polygon, CoordinatesCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_polygon")]
+ internal static extern ErrorCode CreatePolygon(CoordinatesListHandle /* maps_coordinates_list_h */ coordinates, byte r, byte g, byte b, byte a, out IntPtr /* maps_view_object_h */ polygon);
+
+ internal Color FillColor
+ {
+ get { return NativeGet<Color>(this.GetFillColor); }
+ set { NativeSet(this.SetFillColor, value); }
+ }
+
+ internal PolygonHandle(CoordinatesListHandle coordinates, Color color) : base(IntPtr.Zero, true)
+ {
+ CreatePolygon(coordinates, (byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A, out handle).ThrowIfFailed("Failed to create native polygon handle");
+ coordinates.HasOwnership = false;
+ }
+
+ internal void ForeachPoint(Action<CoordinatesHandle> action)
+ {
+ CoordinatesCallback callback = (index, handle, userData) =>
+ {
+ action(CoordinatesHandle.CloneFrom(handle));
+ return true;
+ };
+
+ ForeachPoint(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get coordinates list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using ElmSharp;
+
+internal static partial class Interop
+{
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_polyline")]
+ internal static extern ErrorCode SetPolyline(this PolylineHandle /* maps_view_object_h */ polyline, CoordinatesListHandle /* maps_coordinates_list_h */ points);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_color")]
+ internal static extern ErrorCode SetColor(this PolylineHandle /* maps_view_object_h */ polyline, byte r, byte g, byte b, byte a);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_get_color")]
+ internal static extern ErrorCode GetColor(this PolylineHandle /* maps_view_object_h */ polyline, out byte r, out byte g, out byte b, out byte a);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_width")]
+ internal static extern ErrorCode SetWidth(this PolylineHandle /* maps_view_object_h */ polyline, int width);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_get_width")]
+ internal static extern ErrorCode GetWidth(this PolylineHandle /* maps_view_object_h */ polyline, out int width);
+
+ internal static ErrorCode GetColor(this PolylineHandle /* maps_view_object_h */ polyline, out Color color)
+ {
+ byte r, g, b, a;
+ var err = polyline.GetColor(out r, out g, out b, out a);
+ color = new Color(r, g, b, a);
+ return err;
+ }
+
+ internal static ErrorCode SetColor(this PolylineHandle /* maps_view_object_h */ polyline, Color color)
+ {
+ return polyline.SetColor((byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A);
+ }
+
+ internal class PolylineHandle : ViewObjectHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool CoordinatesCallback(int index, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_polyline")]
+ internal static extern ErrorCode CreatePolyline(CoordinatesListHandle /* maps_coordinates_list_h */ coordinates, byte r, byte g, byte b, byte a, int width, out IntPtr /* maps_view_object_h */ polyline);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_foreach_point")]
+ internal static extern ErrorCode ForeachPoint(IntPtr /* maps_view_object_h */ polyline, CoordinatesCallback callback, IntPtr /* void */ userData);
+
+ internal Color LineColor
+ {
+ get { return NativeGet<Color>(this.GetColor); }
+ set { NativeSet(this.SetColor, value); }
+ }
+
+ internal int LineWidth
+ {
+ get { return NativeGet<int>(this.GetWidth); }
+ set { NativeSet(this.SetWidth, value); }
+ }
+
+ internal PolylineHandle(CoordinatesListHandle coordinates, Color color, int width) : base(IntPtr.Zero, true)
+ {
+ CreatePolyline(coordinates, (byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A, width, out handle).ThrowIfFailed("Failed to create native polyline handle");
+ coordinates.HasOwnership = false;
+ }
+
+ internal void ForeachPoint(Action<CoordinatesHandle> action)
+ {
+ CoordinatesCallback callback = (index, handle, userData) =>
+ {
+ action(CoordinatesHandle.CloneFrom(handle));
+ return true;
+ };
+
+ ForeachPoint(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get coordinates list from native handle");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal enum ViewSnapshotFormatType
+ {
+ ViewSnapshotBmp, // MAPS_VIEW_SNAPSHOT_BMP
+ ViewSnapshotJpeg, // MAPS_VIEW_SNAPSHOT_JPEG
+ }
+
+ internal static partial class ViewSnapshot
+ {
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_capture_snapshot")]
+ internal static extern ErrorCode ViewCaptureSnapshot(ViewHandle /* maps_view_h */ view, ViewSnapshotFormatType /* maps_view_snapshot_format_type_e */ type, int quality, string path);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using ElmSharp;
+
+internal static partial class Interop
+{
+ internal enum ViewType
+ {
+ Normal, // MAPS_VIEW_TYPE_NORMAL
+ Satellite, // MAPS_VIEW_TYPE_SATELLITE
+ Terrain, // MAPS_VIEW_TYPE_TERRAIN
+ Hybrid, // MAPS_VIEW_TYPE_HYBRID
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ViewOnEventCallback(ViewEventType /* maps_view_event_type_e */ type, IntPtr /* maps_view_event_data_h */ eventData, IntPtr /* void */ userData);
+
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_zoom_level")]
+ internal static extern ErrorCode GetZoomLevel(this ViewHandle /* maps_view_h */ view, out int level);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_zoom_level")]
+ internal static extern ErrorCode SetZoomLevel(this ViewHandle /* maps_view_h */ view, int level);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_min_zoom_level")]
+ internal static extern ErrorCode GetMinZoomLevel(this ViewHandle /* maps_view_h */ view, out int minZoomLevel);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_min_zoom_level")]
+ internal static extern ErrorCode SetMinZoomLevel(this ViewHandle /* maps_view_h */ view, int minZoomLevel);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_max_zoom_level")]
+ internal static extern ErrorCode GetMaxZoomLevel(this ViewHandle /* maps_view_h */ view, out int maxZoomLevel);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_max_zoom_level")]
+ internal static extern ErrorCode SetMaxZoomLevel(this ViewHandle /* maps_view_h */ view, int maxZoomLevel);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_orientation")]
+ internal static extern ErrorCode GetOrientation(this ViewHandle /* maps_view_h */ view, out double rotationAngle);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_orientation")]
+ internal static extern ErrorCode SetOrientation(this ViewHandle /* maps_view_h */ view, double rotationAngle);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_language")]
+ internal static extern ErrorCode GetLanguage(this ViewHandle /* maps_view_h */ view, out string language);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_language")]
+ internal static extern ErrorCode SetLanguage(this ViewHandle /* maps_view_h */ view, string language);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_type")]
+ internal static extern ErrorCode SetMapType(this ViewHandle /* maps_view_h */ view, ViewType /* maps_view_type_e */ type);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_type")]
+ internal static extern ErrorCode GetMapType(this ViewHandle /* maps_view_h */ view, out ViewType /* maps_view_type_e */ type);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_buildings_enabled")]
+ internal static extern ErrorCode GetBuildingsEnabled(this ViewHandle /* maps_view_h */ view, out bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_buildings_enabled")]
+ internal static extern ErrorCode SetBuildingsEnabled(this ViewHandle /* maps_view_h */ view, bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_traffic_enabled")]
+ internal static extern ErrorCode GetTrafficEnabled(this ViewHandle /* maps_view_h */ view, out bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_traffic_enabled")]
+ internal static extern ErrorCode SetTrafficEnabled(this ViewHandle /* maps_view_h */ view, bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_public_transit_enabled")]
+ internal static extern ErrorCode GetPublicTransitEnabled(this ViewHandle /* maps_view_h */ view, out bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_public_transit_enabled")]
+ internal static extern ErrorCode SetPublicTransitEnabled(this ViewHandle /* maps_view_h */ view, bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_scalebar_enabled")]
+ internal static extern ErrorCode GetScaleBarEnabled(this ViewHandle /* maps_view_h */ view, out bool enabled);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_scalebar_enabled")]
+ internal static extern ErrorCode SetScaleBarEnabled(this ViewHandle /* maps_view_h */ view, bool enable);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_screen_location")]
+ internal static extern ErrorCode GetScreenLocation(this ViewHandle /* maps_view_h */ view, out int x, out int y, out int width, out int height);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_screen_location")]
+ internal static extern ErrorCode SetScreenLocation(this ViewHandle /* maps_view_h */ view, int x, int y, int width, int height);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_visibility")]
+ internal static extern ErrorCode GetVisibility(this ViewHandle /* maps_view_h */ view, out bool visible);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_visibility")]
+ internal static extern ErrorCode SetVisibility(this ViewHandle /* maps_view_h */ view, bool visible);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_viewport")]
+ internal static extern ErrorCode GetViewport(this ViewHandle /* maps_view_h */ view, out IntPtr viewport);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_center")]
+ internal static extern ErrorCode GetCenter(this ViewHandle /* maps_view_h */ view, out IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_center")]
+ internal static extern ErrorCode SetCenter(this ViewHandle /* maps_view_h */ view, CoordinatesHandle /* maps_coordinates_h */ coordinates);
+
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_gesture_enabled")]
+ internal static extern ErrorCode GetGestureEnabled(this ViewHandle /* maps_view_h */ view, ViewGesture /* maps_view_gesture_e */ gesture, out bool enabled);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_gesture_enabled")]
+ internal static extern ErrorCode SetGestureEnabled(this ViewHandle /* maps_view_h */ view, ViewGesture /* maps_view_gesture_e */ gesture, bool enabled);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_event_cb")]
+ internal static extern ErrorCode SetEventCb(this ViewHandle /* maps_view_h */ view, ViewEventType /* maps_view_event_type_e */ type, ViewOnEventCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_unset_event_cb")]
+ internal static extern ErrorCode UnsetEventCb(this ViewHandle /* maps_view_h */ view, ViewEventType /* maps_view_event_type_e */ type);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_screen_to_geolocation")]
+ internal static extern ErrorCode ScreenToGeolocation(this ViewHandle /* maps_view_h */ view, int x, int y, out IntPtr /* maps_coordinates_h */ coordinates);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_geolocation_to_screen")]
+ internal static extern ErrorCode GeolocationToScreen(this ViewHandle /* maps_view_h */ view, CoordinatesHandle /* maps_coordinates_h */ coordinates, out int x, out int y);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_move")]
+ internal static extern ErrorCode Move(this ViewHandle /* maps_view_h */ view, int x, int y);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_resize")]
+ internal static extern ErrorCode Resize(this ViewHandle /* maps_view_h */ view, int width, int height);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_add_object")]
+ internal static extern ErrorCode AddObject(this ViewHandle /* maps_view_h */ view, ViewObjectHandle /* maps_view_object_h */ viewObject);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_remove_object")]
+ internal static extern ErrorCode RemoveObject(this ViewHandle /* maps_view_h */ view, ViewObjectHandle /* maps_view_object_h */ viewObject);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_remove_all_objects")]
+ internal static extern ErrorCode RemoveAllObjects(this ViewHandle /* maps_view_h */ view);
+
+ internal class ViewHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool ViewObjectCallback(int index, int total, IntPtr /* maps_view_object_h */ viewObject, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_foreach_object")]
+ internal static extern ErrorCode ForeachObject(ViewHandle /* maps_view_h */ view, ViewObjectCallback callback, IntPtr /* void */ userData);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_create")]
+ internal static extern ErrorCode Create(ServiceHandle /* maps_service_h */ maps, IntPtr obj, out IntPtr /* maps_view_h */ view);
+
+ [DllImport(Libraries.MapService, EntryPoint = "maps_view_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_view_h */ view);
+
+ internal int ZoomLevel
+ {
+ get { return NativeGet<int>(this.GetZoomLevel); }
+ set { NativeSet(this.SetZoomLevel, value); }
+ }
+
+ internal int MinimumZoomLevel
+ {
+ get { return NativeGet<int>(this.GetMinZoomLevel); }
+ set { NativeSet(this.SetMinZoomLevel, value); }
+ }
+
+ internal int MaximumZoomLevel
+ {
+ get { return NativeGet<int>(this.GetMaxZoomLevel); }
+ set { NativeSet(this.SetMaxZoomLevel, value); }
+ }
+
+ internal double Orientation
+ {
+ get { return NativeGet<double>(this.GetOrientation); }
+ set { NativeSet(this.SetOrientation, value); }
+ }
+
+ internal ViewType MapType
+ {
+ get { return NativeGet<ViewType>(this.GetMapType); }
+ set { NativeSet(this.SetMapType, value); }
+ }
+
+ internal bool BuildingsEnabled
+ {
+ get { return NativeGet<bool>(this.GetBuildingsEnabled); }
+ set { NativeSet(this.SetBuildingsEnabled, value); }
+ }
+
+ internal bool TrafficEnabled
+ {
+ get { return NativeGet<bool>(this.GetTrafficEnabled); }
+ set { NativeSet(this.SetTrafficEnabled, value); }
+ }
+
+ internal bool PublicTransitEnabled
+ {
+ get { return NativeGet<bool>(this.GetPublicTransitEnabled); }
+ set { NativeSet(this.SetPublicTransitEnabled, value); }
+ }
+ internal bool ScaleBarEnabled
+ {
+ get { return NativeGet<bool>(this.GetScaleBarEnabled); }
+ set { NativeSet(this.SetScaleBarEnabled, value); }
+ }
+
+ internal string Language
+ {
+ get { return NativeGet(this.GetLanguage); }
+ set { NativeSet(this.SetLanguage, value); }
+ }
+
+ internal bool IsVisible
+ {
+ get { return NativeGet<bool>(this.GetVisibility); }
+ set { NativeSet(this.SetVisibility, value); }
+ }
+
+ internal CoordinatesHandle Center
+ {
+ get { return NativeGet(this.GetCenter, CoordinatesHandle.Create); }
+ set { NativeSet(this.SetCenter, value); }
+ }
+
+ public ViewHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ public ViewHandle(ServiceHandle maps, IntPtr evasObject) : this(IntPtr.Zero, true)
+ {
+ Create(maps, evasObject, out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal CoordinatesHandle ScreenToGeolocation(Point position)
+ {
+ IntPtr coordinates;
+ this.ScreenToGeolocation(position.X, position.Y, out coordinates).WarnIfFailed("Failed to convert screen position to geocoordinates");
+ return CoordinatesHandle.Create(coordinates);
+ }
+
+ internal Point GeolocationToScreen(CoordinatesHandle coordinates)
+ {
+ int x, y;
+ this.GeolocationToScreen(coordinates, out x, out y).WarnIfFailed("Failed to convert geocoordinates to screen position");
+ return new Point() { X = x, Y = y };
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <Version>1.0.16</Version>
+ <Authors>Samsung Electronics</Authors>
+ <Copyright>© Samsung Electronics Co., Ltd All Rights Reserved</Copyright>
+ <Description>Map Services API for Tizen .NET</Description>
+ <PackageProjectUrl>https://www.tizen.org/</PackageProjectUrl>
+ <PackageLicenseUrl>https://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
+ <PackageIconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</PackageIconUrl>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Maps.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="System.ComponentModel" Version="4.3.0" />
+ <PackageReference Include="Tizen" Version="1.0.5" />
+ <PackageReference Include="ElmSharp" Version="1.2.2" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Class representing geographical area
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Area : IDisposable
+ {
+ internal Interop.AreaHandle handle;
+
+ /// <summary>
+ /// Constructs rectangular area.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="topLeft">Top-left coordinates of the area</param>
+ /// <param name="bottomRight">Bottom-left coordinate 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 native operation failed to allocate memory.</exception>
+ public Area(Geocoordinates topLeft, Geocoordinates bottomRight)
+ {
+ handle = new Interop.AreaHandle(topLeft?.handle, bottomRight?.handle);
+ }
+
+ /// <summary>
+ /// Constructs 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 native operation failed to allocate memory.</exception>
+ public Area(Geocoordinates center, double radius)
+ {
+ handle = new Interop.AreaHandle(center?.handle, radius);
+ }
+
+ internal Area(Interop.AreaHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Direction types for route maneuver
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum DirectionType
+ {
+ /// <summary>
+ /// Indicates unknown direction.
+ /// </summary>
+ None = Interop.RouteDirection.None,
+ /// <summary>
+ /// Indicates north direction.
+ /// </summary>
+ North = Interop.RouteDirection.North,
+ /// <summary>
+ /// Indicates north-west direction.
+ /// </summary>
+ NorthWest = Interop.RouteDirection.NorthWest,
+ /// <summary>
+ /// Indicates north-east direction.
+ /// </summary>
+ NorthEast = Interop.RouteDirection.NorthEast,
+ /// <summary>
+ /// Indicates south direction.
+ /// </summary>
+ South = Interop.RouteDirection.South,
+ /// <summary>
+ /// Indicates south-East direction.
+ /// </summary>
+ SouthEast = Interop.RouteDirection.SouthEast,
+ /// <summary>
+ /// Indicates south-West direction.
+ /// </summary>
+ SouthWest = Interop.RouteDirection.SouthWest,
+ /// <summary>
+ /// Indicates west direction.
+ /// </summary>
+ West = Interop.RouteDirection.West,
+ /// <summary>
+ /// Indicates east direction.
+ /// </summary>
+ East = Interop.RouteDirection.East,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Allowed distance units
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum DistanceUnit
+ {
+ /// <summary>
+ /// Indicates meter unit.
+ /// </summary>
+ Meter = Interop.DistanceUnit.Meter,
+ /// <summary>
+ /// Indicates kilometer unit.
+ /// </summary>
+ Kilometer = Interop.DistanceUnit.Kilometer,
+ /// <summary>
+ /// Indicates foot unit.
+ /// </summary>
+ Foot = Interop.DistanceUnit.Foot,
+ /// <summary>
+ /// Indicates yard unit.
+ /// </summary>
+ Yard = Interop.DistanceUnit.Yard,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Geocode request for map service
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class GeocodeRequest : MapServiceRequest<Geocoordinates>
+ {
+ private Interop.GeocodeCallback _geocodeCallback;
+ private List<Geocoordinates> _coordinateList = new List<Geocoordinates>();
+
+ internal GeocodeRequest(MapService service, string address) : this(service, ServiceRequestType.Geocode)
+ {
+ startExecutionAction = new Action(() =>
+ {
+ int requestID;
+ errMessage = $"Failed to get coordinates for given address {address}";
+ errorCode = _service.handle.Geocode(address, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID);
+ if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
+ {
+ _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ }
+ _requestID = requestID;
+ });
+ }
+
+ internal GeocodeRequest(MapService service, string address, Area boundry) : this(service, ServiceRequestType.GeocodeInsideArea)
+ {
+ startExecutionAction = new Action(() =>
+ {
+ int requestID;
+ errMessage = $"Failed to get coordinates for given address {address}";
+ errorCode = _service.handle.GeocodeInsideArea(address, boundry.handle, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID);
+ if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
+ {
+ _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ }
+ _requestID = requestID;
+ });
+ }
+
+ internal GeocodeRequest(MapService service, PlaceAddress address) : this(service, ServiceRequestType.GeocodeByStructuredAddress)
+ {
+ startExecutionAction = new Action(() =>
+ {
+ int requestID;
+ errMessage = $"Failed to get coordinates for given address {address}";
+ errorCode = _service.handle.GeocodeByStructuredAddress(address.handle, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID);
+ if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
+ {
+ _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ }
+ _requestID = requestID;
+ });
+ }
+
+ private GeocodeRequest(MapService service, ServiceRequestType type) : base(service, type)
+ {
+ // The Maps Service invokes this callback while iterating through the list of obtained coordinates of the specified place.
+ _geocodeCallback = (result, id, index, total, coordinates, userData) =>
+ {
+ errorCode = result;
+ if (result.IsSuccess())
+ {
+ // The parameter coordinates must be released using maps_coordinates_destroy()
+ var coordinatesHandle = new Interop.CoordinatesHandle(coordinates, needToRelease: true);
+ _coordinateList.Add(new Geocoordinates(coordinatesHandle));
+ if (_coordinateList.Count == total)
+ {
+ _requestTask?.TrySetResult(_coordinateList);
+ }
+ return true;
+ }
+ else
+ {
+ // If search is failed, the value of total is 0 and coordinates is NULL
+ _requestTask?.TrySetException(result.GetException(errMessage));
+ return false;
+ }
+ };
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Class representing geographical coordinates.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Geocoordinates : IDisposable
+ {
+ internal Interop.CoordinatesHandle handle;
+
+ /// <summary>
+ /// Constructs map coordinates object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="latitude">Latitude value, must be between (-90.0 ~ 90.0) degrees</param>
+ /// <param name="longitude">Longitude value, must be between (-180.0 ~ 180.0) degrees</param>
+ /// <exception cref="System.ArgumentException">Thrown when values for latitude and longitude are not valid.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
+ public Geocoordinates(double latitude, double longitude)
+ {
+ handle = new Interop.CoordinatesHandle(latitude, longitude);
+ }
+
+ internal Geocoordinates(Interop.CoordinatesHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Gets latitude of the coordinates.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Latitude
+ {
+ get
+ {
+ return handle.Latitude;
+ }
+ }
+
+ /// <summary>
+ /// Gets longitude of the coordinates.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Longitude
+ {
+ get
+ {
+ return handle.Longitude;
+ }
+ }
+
+ /// <summary>
+ /// Returns a string that represents this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Returns a string which presents this object.</returns>
+ public override string ToString()
+ {
+ return $"[{Latitude}, {Longitude}]";
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// List of <see cref="Geocoordinates"/> objects to be used in <see cref="MapService"/> APIs
+ /// </summary>
+ internal class GeocoordinatesList : IDisposable
+ {
+ internal Interop.CoordinatesListHandle handle;
+
+ internal GeocoordinatesList(IEnumerable<Geocoordinates> coordinateList, bool ownerShip = false)
+ {
+ handle = new Interop.CoordinatesListHandle(ownerShip);
+ foreach (var coordinates in coordinateList)
+ {
+ handle.Add(coordinates.handle);
+ }
+ }
+
+ /// <summary>
+ /// Iterator for coordinates in this list
+ /// </summary>
+ internal IEnumerable<Geocoordinates> Coordinates
+ {
+ get
+ {
+ List<Geocoordinates> list = new List<Geocoordinates>();
+ handle.ForEach(coordinateHandle => list.Add(new Geocoordinates(coordinateHandle)));
+ return list;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Enumeration of user gestures over map view
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum GestureType
+ {
+ /// <summary>
+ /// Indicates empty gesture.
+ /// </summary>
+ None = Interop.ViewGesture.None,
+ /// <summary>
+ /// Indicates the move map user gesture.
+ /// </summary>
+ Scroll = Interop.ViewGesture.Scroll,
+ /// <summary>
+ /// Indicates the zoom user gesture.
+ /// </summary>
+ Zoom = Interop.ViewGesture.Zoom,
+ /// <summary>
+ /// Indicates the click user gesture
+ /// </summary>
+ Click = Interop.ViewGesture.Click,
+ /// <summary>
+ /// Indicates the double click user gesture
+ /// </summary>
+ DoubleClick = Interop.ViewGesture.DoubleClick,
+ /// <summary>
+ /// Indicates the two-finger click user gesture
+ /// </summary>
+ TwoFingerClick = Interop.ViewGesture.TwoFingerClick,
+ /// <summary>
+ /// Indicates the rotation user gesture.
+ /// </summary>
+ Rotation = Interop.ViewGesture.Rotation,
+ /// <summary>
+ /// Indicates the long press user gesture.
+ /// </summary>
+ LongPress = Interop.ViewGesture.LongPress,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Preferences for geocode searches
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public interface IGeocodePreference
+ {
+ /// <summary>
+ /// Gets or sets a string that presents preferred language.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Language should be specified as an ISO 3166 alpha-2 two letter country-code
+ /// followed by ISO 639-1 for the two-letter language code.<br/>e.g. "ko-KR", "en-US".</remarks>
+ string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum number of results.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Setting negative value will not have any effect on MaxResults value.</remarks>
+ int MaxResults { get; set; }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Preferences for place searches
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public interface IPlaceSearchPreference
+ {
+ /// <summary>
+ /// Gets or sets distance unit.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ DistanceUnit Unit { get; set; }
+
+ /// <summary>
+ /// Gets or sets preferred language.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Language should be specified as an ISO 3166 alpha-2 two letter country-code
+ /// followed by ISO 639-1 for the two-letter language code.<br/>e.g. "ko-KR", "en-US".</remarks>
+ string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum number of results.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ int MaxResults { get; set; }
+
+ /// <summary>
+ /// Gets or sets a string that represents code of preferred country.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ string CountryCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets search properties as key value pair.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ IReadOnlyDictionary<string, string> Properties { get; set; }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Preferences for route searches
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public interface IRouteSearchPreference
+ {
+ /// <summary>
+ /// Gets or sets distance unit.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ DistanceUnit Unit { get; set; }
+
+ /// <summary>
+ /// Gets or sets route optimization.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ RouteOptimization Optimization { get; set; }
+
+ /// <summary>
+ /// Gets or sets route transport mode.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ TransportMode Mode { get; set; }
+
+ /// <summary>
+ /// Gets or sets route feature weight.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ RouteFeatureWeight RouteFeatureWeight { get; set; }
+
+ /// <summary>
+ /// Gets or sets route feature.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ RouteFeature RouteFeature { get; set; }
+
+ /// <summary>
+ /// Gets or sets if searching for alternative routes is enabled.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ bool SearchAlternativeRoutes { get; set; }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Tizen.Maps
+{
+ internal static class Log
+ {
+ private static String tag = "Tizen.Maps";
+
+ public static void Debug(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ Tizen.Log.Debug(tag, message, file, func, line);
+ }
+
+ public static void Error(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ Tizen.Log.Error(tag, message, file, func, line);
+ }
+
+ public static void Fatal(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ Tizen.Log.Fatal(tag, message, file, func, line);
+ }
+
+ public static void Info(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ Tizen.Log.Info(tag, message, file, func, line);
+ }
+
+ public static void Verbose(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ Tizen.Log.Verbose(tag, message, file, func, line);
+ }
+
+ public static void Warn(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
+ {
+ Tizen.Log.Warn(tag, message, file, func, line);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using ElmSharp;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Event arguments for gesture type map events
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class MapGestureEventArgs : EventArgs
+ {
+ 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);
+ }
+ }
+
+ /// <summary>
+ /// Gets type of gesture event.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public GestureType GestureType { get; }
+
+ /// <summary>
+ /// Gets screen coordinates in the event.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Point Position { get; }
+
+ /// <summary>
+ /// Gets the number of fingers detected in the event.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int TouchCount { get; }
+
+ /// <summary>
+ /// Gets zoom factor for zoom gesture event.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double ZoomFactor { get; }
+
+ /// <summary>
+ /// Gets angle of rotation for rotate gesture event.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double RotationAngle { get; }
+
+ /// <summary>
+ /// Gets geographical coordinates for the event.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Geocoordinates { get; }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public abstract class MapObject
+ {
+ internal MapObject() { }
+
+ /// <summary>
+ /// Gets or sets visibility of the map object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public abstract bool IsVisible { get; set; }
+
+ internal abstract void HandleClickedEvent();
+
+ internal abstract void InvalidateMapObject();
+
+ internal abstract Interop.ViewObjectHandle GetHandle();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Map service class for service request
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public partial class MapService : IDisposable
+ {
+ internal Interop.ServiceHandle handle;
+
+ private PlaceFilter _filter;
+ private SearchPreference _searchPreference;
+
+ private static List<string> s_providers;
+ private string _serviceProvider;
+
+
+ /// <summary>
+ /// Creates a new Maps Service object for given service provider.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="serviceProvider">A string which representing name of map service provider</param>
+ /// <param name="serviceProviderKey">A string which representing certificate key to use the map service provider</param>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ /// <exception cref="System.ArgumentException">Thrown when parameters are invalid.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
+ /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
+ public MapService(string serviceProvider, string serviceProviderKey)
+ {
+ _serviceProvider = serviceProvider;
+ handle = new Interop.ServiceHandle(serviceProvider);
+ ProviderKey = serviceProviderKey;
+ PlaceSearchFilter = new PlaceFilter();
+ Preferences = new SearchPreference();
+ }
+
+ /// <summary>
+ /// Gets list of available map service providers.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <value>The list of map service providers.</value>
+ /// <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 privileges to access this property.</exception>
+ public static IEnumerable<string> Providers
+ {
+ get
+ {
+ if (s_providers != null) return s_providers;
+
+ s_providers = new List<string>();
+ Interop.ServiceHandle.ForeachProvider(provider => s_providers.Add(provider));
+ return s_providers;
+ }
+ }
+
+ /// <summary>
+ /// Gets name of map service provider.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Provider { get { return _serviceProvider; } }
+
+ /// <summary>
+ /// Gets a user consent for map service provider
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ public bool UserConsented
+ {
+ get
+ {
+ return handle.UserConsented;
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets a string representing keys for map service provider
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Typically, the provider key is issued by each maps provider, after signing up for a plan in the web site.
+ /// Depending on the plan and its provider which you have signed, you might pay for the network traffic.</remarks>
+ public string ProviderKey
+ {
+ get
+ {
+ return handle.ProviderKey;
+ }
+ set
+ {
+ handle.ProviderKey = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets a filter used for place search result.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceFilter PlaceSearchFilter
+ {
+ get
+ {
+ return _filter;
+ }
+ set
+ {
+ if (value != null)
+ {
+ _filter = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets search preferences used for <see cref="GeocodeRequest"/> or <see cref="ReverseGeocodeRequest"/>.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IGeocodePreference GeocodePreferences
+ {
+ get
+ {
+ return Preferences as IGeocodePreference;
+ }
+ }
+
+ /// <summary>
+ /// Gets search preferences used for <see cref="PlaceSearchRequest"/>.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IPlaceSearchPreference PlaceSearchPreferences
+ {
+ get
+ {
+ return Preferences as IPlaceSearchPreference;
+ }
+ }
+
+ /// <summary>
+ /// Gets search preferences used for <see cref="RouteSearchRequest"/>.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IRouteSearchPreference RouteSearchPreferences
+ {
+ get
+ {
+ return Preferences as IRouteSearchPreference;
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets search preferences.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public SearchPreference Preferences
+ {
+ get
+ {
+ if (_searchPreference == null)
+ {
+ _searchPreference = new SearchPreference(handle.Preferences);
+ }
+ return _searchPreference;
+ }
+ set
+ {
+ if (value != null)
+ {
+ handle.Preferences = value.handle;
+ _searchPreference = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the user's consent to use maps data.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <returns>Returns true if user agreed that the application can use maps data, otherwise false.</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>
+ public async Task<bool> RequestUserConsent()
+ {
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
+ Interop.RequestUserConsentwithHandleCallback cb = (consented, userData) =>
+ {
+ tcs.TrySetResult(consented);
+ };
+
+ var err = handle.RequestUserConsent(cb, IntPtr.Zero);
+ if (err.IsFailed())
+ {
+ tcs.TrySetException(err.GetException("Failed to get user consent"));
+ }
+ return await tcs.Task.ConfigureAwait(false);
+ }
+
+ /// <summary>
+ /// Checks if the Maps Service supports given request.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="type">Request type to check</param>
+ /// <returns>Returns true if the Maps Service supports a request, otherwise false.</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>
+ public bool IsSupported(ServiceRequestType type)
+ {
+ bool result;
+ var err = handle.IsServiceSupported((Interop.ServiceType)type, out result);
+ err.WarnIfFailed($"Failed to get if {type} is supported");
+ return (err.IsSuccess()) ? result : false;
+ }
+
+ /// <summary>
+ /// Checks if the Maps Service supports given data feature.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="data">Data feature to check</param>
+ /// <returns>Returns true if the Maps Service supports a data feature, otherwise false.</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>
+ public bool IsSupported(ServiceData data)
+ {
+ bool result;
+ var err = handle.IsDataSupported((Interop.ServiceData)data, out result);
+ err.WarnIfFailed($"Failed to get if {data} data is supported");
+ return (err.IsSuccess()) ? result : false;
+ }
+
+ /// <summary>
+ /// Creates geocode search request for given free-formed address string.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="address">A string which representing free-formed address</param>
+ /// <returns>GeocodeRequest object created with address string</returns>
+ public GeocodeRequest CreateGeocodeRequest(string address)
+ {
+ return new GeocodeRequest(this, address);
+ }
+
+ /// <summary>
+ /// Creates geocode search request for given free-formed address string, within the specified boundary.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="address">A string which representing free-formed address</param>
+ /// <param name="boundary">An instance of Area object which representing interested area</param>
+ /// <seealso cref="Area"/>
+ /// <returns>GeocodeRequest object created with address string and specified boundary</returns>
+ public GeocodeRequest CreateGeocodeRequest(string address, Area boundary)
+ {
+ return new GeocodeRequest(this, address, boundary);
+ }
+
+ /// <summary>
+ /// Creates geocode search request for given structured address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="address">A string which representing address of interest</param>
+ /// <returns>Returns GeocodeRequest object created with structured address</returns>
+ public GeocodeRequest CreateGeocodeRequest(PlaceAddress address)
+ {
+ return new GeocodeRequest(this, address);
+ }
+
+ /// <summary>
+ /// Creates a reverse geocode search request for given latitude and longitude.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="latitude">Latitude of interested place</param>
+ /// <param name="longitude">Longitude of interested place</param>
+ /// <returns>Returns ReverseGeocodeRequest object created with location coordinates</returns>
+ public ReverseGeocodeRequest CreateReverseGeocodeRequest(double latitude, double longitude)
+ {
+ return new ReverseGeocodeRequest(this, latitude, longitude);
+ }
+
+ /// <summary>
+ /// Creates a reverse geocode search request for given position coordinates list.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="coordinates">Coordinates list with [2 ~ 100] coordinates</param>
+ /// <returns>Returns MultiReverseGeocodeRequest object created with list of location coordinates</returns>
+ public MultiReverseGeocodeRequest CreateMultiReverseGeocodeRequest(IEnumerable<Geocoordinates> coordinates)
+ {
+ return new MultiReverseGeocodeRequest(this, coordinates);
+ }
+
+ /// <summary>
+ /// Creates a route search request for origin and destination points.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="from">Starting point</param>
+ /// <param name="to">Destination</param>
+ /// <returns>Returns RouteSearchRequest object created with origin and destination coordinates</returns>
+ public RouteSearchRequest CreateRouteSearchRequest(Geocoordinates from, Geocoordinates to)
+ {
+ return new RouteSearchRequest(this, from, to);
+ }
+
+ /// <summary>
+ /// Creates a place search request for specified search radius around a given coordinates position.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="coordinates">A geographical coordinates of center</param>
+ /// <param name="distance">A double value which representing radius of area to search places</param>
+ /// <returns>Returns PlaceSearchRequest object created with location coordinates and search radius</returns>
+ public PlaceSearchRequest CreatePlaceSearchRequest(Geocoordinates coordinates, int distance)
+ {
+ return new PlaceSearchRequest(this, coordinates, distance);
+ }
+
+ /// <summary>
+ /// Creates a place search request for places within specified boundary.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="boundary">An instance of Area object which representing area to search interested places</param>
+ /// <returns>Returns PlaceSearchRequest object created with specified boundary</returns>
+ public PlaceSearchRequest CreatePlaceSearchRequest(Area boundary)
+ {
+ return new PlaceSearchRequest(this, boundary);
+ }
+
+ /// <summary>
+ /// Creates a place search request for free-formed address within boundary.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="address">A string which representing free-formed address</param>
+ /// <param name="boundary">An instance of Area object which representing area to search interested places</param>
+ /// <returns>Returns PlaceSearchRequest object created with address string and specified boundary</returns>
+ public PlaceSearchRequest CreatePlaceSearchRequest(string address, Area boundary)
+ {
+ return new PlaceSearchRequest(this, address, boundary);
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ _filter.Dispose();
+ _searchPreference.Dispose();
+ }
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Base class for map service request
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <typeparam name="T"></typeparam>
+ public abstract class MapServiceRequest<T> : IDisposable
+ {
+ protected TaskCompletionSource<IEnumerable<T>> _requestTask;
+ protected string errMessage;
+ protected int? _requestID;
+ protected ServiceRequestType _type;
+
+ internal Action startExecutionAction;
+ internal Interop.ErrorCode errorCode;
+
+ internal MapService _service;
+
+ /// <summary>
+ /// Creates a map service request.
+ /// </summary>
+ /// <param name="service">map service object</param>
+ /// <param name="type">Request type</param>
+ internal MapServiceRequest(MapService service, ServiceRequestType type)
+ {
+ _service = service;
+ _type = type;
+ }
+
+ /// <summary>
+ /// Sends a request to map service provider.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Response from map service provider</returns>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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.InvalidOperationException">Thrown when the result is invalid.</exception>
+ /// <exception cref="System.ArgumentException">Thrown when arguments are invalid</exception>
+ public async Task<IEnumerable<T>> GetResponseAsync()
+ {
+ IEnumerable<T> task = null;
+ if (_requestTask == null || _requestTask.Task.IsCanceled)
+ {
+ _requestTask = new TaskCompletionSource<IEnumerable<T>>();
+ startExecutionAction();
+ task = await _requestTask.Task.ConfigureAwait(false);
+ }
+ errorCode.WarnIfFailed(errMessage);
+ return task;
+ }
+
+ internal void Cancel()
+ {
+ if (_requestTask?.Task.IsCompleted == false)
+ {
+ _requestTask?.SetCanceled();
+ if (_requestID != null)
+ {
+ var err = Interop.CancelRequest(_service.handle, (int)_requestID);
+ err.ThrowIfFailed($"Unable to cancel service request, Type: {_type}, ID: {_requestID}");
+ }
+
+ errorCode = Interop.ErrorCode.Canceled;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ Cancel();
+ _service.Dispose();
+ }
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Map View Type (theme)
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum MapTypes
+ {
+ /// <summary>
+ /// Indicates normal street theme.
+ /// </summary>
+ Normal = Interop.ViewType.Normal,
+ /// <summary>
+ /// Indicates satellite theme.
+ /// </summary>
+ Satellite = Interop.ViewType.Satellite,
+ /// <summary>
+ /// Indicates terrain theme.
+ /// </summary>
+ Terrain = Interop.ViewType.Terrain,
+ /// <summary>
+ /// Indicates hybrid theme, has both satellite and normal theme.
+ /// </summary>
+ Hybrid = Interop.ViewType.Hybrid,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using ElmSharp;
+using Layout = ElmSharp.Layout;
+using EvasObject = ElmSharp.EvasObject;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Map View class to show a map on the screen.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class MapView : Layout, IDisposable
+ {
+ internal Interop.ViewHandle handle;
+ private MapService _service;
+
+ private Dictionary<IntPtr, MapObject> _handleToObjectTable = new Dictionary<IntPtr, MapObject>();
+
+ private Interop.ViewOnEventCallback _gestureEventCallback;
+ private Interop.ViewOnEventCallback _objectEventCallback;
+ private Interop.ViewOnEventCallback _viewReadyEventCallback;
+
+ private event EventHandler<MapGestureEventArgs> _scrolledEventHandler;
+ private event EventHandler<MapGestureEventArgs> _twoFingerZoomedEventHandler;
+ private event EventHandler<MapGestureEventArgs> _clickedEventHandler;
+ private event EventHandler<MapGestureEventArgs> _doubleClickedEventHandler;
+ private event EventHandler<MapGestureEventArgs> _twoFingerClickedEventHandler;
+ private event EventHandler<MapGestureEventArgs> _twoFingerRotatedEventHandler;
+ private event EventHandler<MapGestureEventArgs> _longPressedEventHandler;
+ private event EventHandler _viewReadyEventHandler;
+
+ /// <summary>
+ /// Creates the view and link it to the instance of map service.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="parent">An instance of <see cref="EvasObject"/> object which map view will be drawn</param>
+ /// <param name="service">An instance of <see cref="MapService"/> object</param>
+ /// <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 parameters are invalid</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service</exception>
+ public MapView(EvasObject parent, MapService service) : base(parent)
+ {
+ handle = new Interop.ViewHandle(service.handle, this);
+ Log.Info(string.Format("MapView is created"));
+
+ _service = service;
+ this.Resize(1, 1);
+
+ // We need to keep Gesture Tap event enabled for object event to work
+ handle.SetGestureEnabled(Interop.ViewGesture.Click, true);
+ SetObjectEventCallback();
+ }
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver scrolled gesture event.
+ /// </summary>
+ /// <value>Event handlers to get scrolled gesture event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler<MapGestureEventArgs> Scrolled
+ {
+ add
+ {
+ SetGestureEventCallback();
+ handle.SetGestureEnabled(Interop.ViewGesture.Scroll, true);
+ _scrolledEventHandler += value;
+ Log.Info(string.Format("Scrolled event handler is added"));
+ }
+ remove
+ {
+ _scrolledEventHandler -= value;
+ Log.Info(string.Format("Scrolled event handler is removed"));
+ if (_scrolledEventHandler == null)
+ {
+ handle.SetGestureEnabled(Interop.ViewGesture.Scroll, false);
+ UnsetGestureEventCallback();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver zoomed gesture event.
+ /// </summary>
+ /// <value>Event handlers to get zoomed gesture event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler<MapGestureEventArgs> TwoFingerZoomed
+ {
+ add
+ {
+ SetGestureEventCallback();
+ handle.SetGestureEnabled(Interop.ViewGesture.Zoom, true);
+ _twoFingerZoomedEventHandler += value;
+ Log.Info(string.Format("TwoFingerZoomed event handler is added"));
+ }
+ remove
+ {
+ _twoFingerZoomedEventHandler -= value;
+ Log.Info(string.Format("TwoFingerZoomed event handler is removed"));
+ if (_twoFingerZoomedEventHandler == null)
+ {
+ handle.SetGestureEnabled(Interop.ViewGesture.Zoom, false);
+ UnsetGestureEventCallback();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver clicked gesture event.
+ /// </summary>
+ /// <value>Event handlers to get clicked gesture event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler<MapGestureEventArgs> Clicked
+ {
+ add
+ {
+ SetGestureEventCallback();
+ //handle.SetGestureEnabled(Interop.ViewGesture.Click, true);
+ _clickedEventHandler += value;
+ Log.Info(string.Format("Clicked event handler is added"));
+ }
+ remove
+ {
+ _clickedEventHandler -= value;
+ Log.Info(string.Format("Clicked event handler is removed"));
+ if (_clickedEventHandler == null)
+ {
+ //handle.SetGestureEnabled(Interop.ViewGesture.Click, false);
+ UnsetGestureEventCallback();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver double-clicked gesture event.
+ /// </summary>
+ /// <value>Event handlers to get double-clicked gesture event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler<MapGestureEventArgs> DoubleClicked
+ {
+ add
+ {
+ SetGestureEventCallback();
+ handle.SetGestureEnabled(Interop.ViewGesture.DoubleClick, true);
+ _doubleClickedEventHandler += value;
+ Log.Info(string.Format("DoubleClicked event handler is removed"));
+ }
+ remove
+ {
+ _doubleClickedEventHandler -= value;
+ Log.Info(string.Format("DoubleClicked event handler is removed"));
+ if (_doubleClickedEventHandler == null)
+ {
+ handle.SetGestureEnabled(Interop.ViewGesture.DoubleClick, false);
+ UnsetGestureEventCallback();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver clicked gesture event with two-fingers.
+ /// </summary>
+ /// <value>Event handlers to get clicked gesture event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler<MapGestureEventArgs> TwoFingerClicked
+ {
+ add
+ {
+ SetGestureEventCallback();
+ handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerClick, true);
+ _twoFingerClickedEventHandler += value;
+ Log.Info(string.Format("TwoFingerClicked event handler is added"));
+ }
+ remove
+ {
+ _twoFingerClickedEventHandler -= value;
+ Log.Info(string.Format("TwoFingerClicked event handler is removed"));
+ if (_twoFingerClickedEventHandler == null)
+ {
+ handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerClick, false);
+ UnsetGestureEventCallback();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver rotated gesture event.
+ /// </summary>
+ /// <value>Event handlers to get rotated gesture event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler<MapGestureEventArgs> TwoFingerRotated
+ {
+ add
+ {
+ SetGestureEventCallback();
+ handle.SetGestureEnabled(Interop.ViewGesture.Rotation, true);
+ _twoFingerRotatedEventHandler += value;
+ Log.Info(string.Format("Rotated event handler is added"));
+ }
+ remove
+ {
+ _twoFingerRotatedEventHandler -= value;
+ Log.Info(string.Format("Rotated event handler is removed"));
+ if (_twoFingerRotatedEventHandler == null)
+ {
+ handle.SetGestureEnabled(Interop.ViewGesture.Rotation, false);
+ UnsetGestureEventCallback();
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver long-pressed gesture event.
+ /// </summary>
+ /// <value>Event handlers to get long-pressed gesture event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler<MapGestureEventArgs> LongPressed
+ {
+ add
+ {
+ SetGestureEventCallback();
+ handle.SetGestureEnabled(Interop.ViewGesture.LongPress, true);
+ _longPressedEventHandler += value;
+ Log.Info(string.Format("LongPressed event handler is added"));
+ }
+ remove
+ {
+ _longPressedEventHandler -= value;
+ Log.Info(string.Format("LongPressed event handler is removed"));
+ if (_longPressedEventHandler == null)
+ {
+ handle.SetGestureEnabled(Interop.ViewGesture.LongPress, false);
+ UnsetGestureEventCallback();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds or removes event handlers to deliver a event representing the view is ready to be used.
+ /// </summary>
+ /// <value>Event handlers to get view ready event</value>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ public event EventHandler ViewReady
+ {
+ add
+ {
+ SetViewReadyEventCallback();
+ _viewReadyEventHandler += value;
+ Log.Info(string.Format("ViewReady event handler is added"));
+ }
+ remove
+ {
+ _viewReadyEventHandler -= value;
+ Log.Info(string.Format("ViewReady event handler is removed"));
+ UnsetGestureEventCallback();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets current zoom level.
+ /// </summary>
+ /// <value>It is an integer value that representing current zoom level.</value>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public int ZoomLevel
+ {
+ get
+ {
+ return handle.ZoomLevel;
+ }
+ set
+ {
+ Log.Info(string.Format("ZoomLevel is changed from {0} to {1}", handle.ZoomLevel, value));
+ handle.ZoomLevel = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets minimum zoom level.
+ /// </summary>
+ /// <value>It is an integer value that limits minimal zoom level within range of current map plug-in supported.</value>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public int MinimumZoomLevel
+ {
+ get
+ {
+ return handle.MinimumZoomLevel;
+ }
+ set
+ {
+ Log.Info(string.Format("MinimumZoomLevel is changed from {0} to {1}", handle.MinimumZoomLevel, value));
+ handle.MinimumZoomLevel = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets maximum zoom level.
+ /// </summary>
+ /// <value>It is an integer value that limits maximum zoom level within range of current map plug-in supported.</value>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public int MaximumZoomLevel
+ {
+ get
+ {
+ return handle.MaximumZoomLevel;
+ }
+ set
+ {
+ Log.Info(string.Format("MaximumZoomLevel is changed from {0} to {1}", handle.MaximumZoomLevel, value));
+ handle.MaximumZoomLevel = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets orientation on the map view.
+ /// </summary>
+ /// <value>It is an integer value from 0 to 360 that indicates orientation of the map view</value>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public double Orientation
+ {
+ get
+ {
+ return handle.Orientation;
+ }
+ set
+ {
+ Log.Info(string.Format("Orientation is changed from {0} to {1}", handle.Orientation, value));
+ handle.Orientation = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets theme type of the map view.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public MapTypes MapType
+ {
+ get
+ {
+ return (MapTypes)handle.MapType;
+ }
+ set
+ {
+ Log.Info(string.Format("MapType is changed from {0} to {1}", handle.MapType, value));
+ handle.MapType = (Interop.ViewType)value;
+ }
+ }
+
+ /// <summary>
+ /// Indicates whether the map should show the 3D buildings layer.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public bool BuildingsEnabled
+ {
+ get
+ {
+ return handle.BuildingsEnabled;
+ }
+ set
+ {
+ Log.Info(string.Format("Showing the 3D buildings is {0}", (value ? "enabled" : "disabled")));
+ handle.BuildingsEnabled = value;
+ }
+ }
+
+ /// <summary>
+ /// Indicates whether the map should show the traffic layer.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public bool TrafficEnabled
+ {
+ get
+ {
+ return handle.TrafficEnabled;
+ }
+ set
+ {
+ Log.Info(string.Format("Showing the traffic is {0}", (value ? "enabled" : "disabled")));
+ handle.TrafficEnabled = value;
+ }
+ }
+
+ /// <summary>
+ /// Indicates whether the map should show the public transit layer.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public bool PublicTransitEnabled
+ {
+ get
+ {
+ return handle.PublicTransitEnabled;
+ }
+ set
+ {
+ Log.Info(string.Format("Showing the public transit is {0}", (value ? "enabled" : "disabled")));
+ handle.PublicTransitEnabled = value;
+ }
+ }
+
+ /// <summary>
+ /// Indicates whether the scale-bar is enabled or not.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public bool ScaleBarEnabled
+ {
+ get
+ {
+ return handle.ScaleBarEnabled;
+ }
+ set
+ {
+ Log.Info(string.Format("Showing the scale-bar is {0}", (value ? "enabled" : "disabled")));
+ handle.ScaleBarEnabled = value;
+ }
+ }
+
+ /// <summary>
+ /// Sets language of map view.
+ /// </summary>
+ /// <value>The display language in the map.
+ /// A language is specified as an ISO 3166 alpha-2 two letter country-code
+ /// followed by ISO 639-1 for the two-letter language code.
+ /// Each language tag is composed of one or more "subtags" separated by hyphens (-).
+ /// Each subtag is composed of basic Latin letters or digits only.
+ /// For example, "ko-KR" for Korean, "en-US" for American English.</value>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public string Language
+ {
+ get
+ {
+ return handle.Language;
+ }
+ set
+ {
+ Log.Info(string.Format("Language is changed from {0} to {1}", handle.Language, value));
+ handle.Language = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets geographical coordinates for map view's center.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <privilege>http://tizen.org/privilege/mapservice</privilege>
+ /// <privilege>http://tizen.org/privilege/internet</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</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>
+ public Geocoordinates Center
+ {
+ get
+ {
+ return new Geocoordinates(handle.Center);
+ }
+ set
+ {
+ Log.Info(string.Format("Center is changed from {0} to {1}", handle.Center.ToString(), value.ToString()));
+ handle.Center = value.handle;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of map object added to map view.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<MapObject> Children
+ {
+ get
+ {
+ return _handleToObjectTable.Values;
+ }
+ }
+
+ /// <summary>
+ /// Changes geographical coordinates to screen coordinates.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="coordinates">Geographical coordinates</param>
+ /// <returns>Returns an instance of 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 native operation failed to allocate memory, connect to service.</exception>
+ public Point GeolocationToScreen(Geocoordinates coordinates)
+ {
+ return handle.GeolocationToScreen(coordinates.handle);
+ }
+
+ /// <summary>
+ /// Changes screen coordinates to geographical coordinates.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="screenCoordinates">Screen coordinates</param>
+ /// <returns>Returns an instance of geographical coordinates object.</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 native operation failed to allocate memory, connect to service.</exception>
+ public Geocoordinates ScreenToGeolocation(Point screenCoordinates)
+ {
+ return new Geocoordinates(handle.ScreenToGeolocation(screenCoordinates));
+ }
+
+ /// <summary>
+ /// Adds a map object to map view.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="child">An instance of map object to be added</param>
+ /// <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 native operation failed to allocate memory, connect to service.</exception>
+ public void Add(MapObject child)
+ {
+ Log.Info(string.Format("Add a object"));
+ var objectHandle = child.GetHandle();
+ if (!_handleToObjectTable.ContainsKey(objectHandle))
+ {
+ _handleToObjectTable[objectHandle] = child;
+ handle.AddObject(objectHandle);
+
+ // MapView take ownership of added map objects
+ objectHandle.HasOwnership = false;
+ }
+ }
+
+ /// <summary>
+ /// Removes a map object from map view.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="child">An instance of map object to be removed</param>
+ /// <remarks>Once removed, the child object will be become invalid</remarks>
+ /// <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 native operation failed to allocate memory, connect to service.</exception>
+ public void Remove(MapObject child)
+ {
+ Log.Info(string.Format("Remove a object"));
+ var objectHandle = child.GetHandle();
+ if (_handleToObjectTable.Remove(objectHandle))
+ {
+ handle.RemoveObject(child.GetHandle());
+
+ // The object handle will be released automatically by the View, once RemoveObject call is successful
+ child.InvalidateMapObject();
+ }
+ }
+
+ /// <summary>
+ /// Removes all map objects from map view.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <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.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
+ public void RemoveAll()
+ {
+ Log.Info(string.Format("Remove all of objects"));
+ foreach (var child in _handleToObjectTable.Values)
+ {
+ child.InvalidateMapObject();
+ }
+ _handleToObjectTable.Clear();
+ handle.RemoveAllObjects();
+ }
+
+ /// <summary>
+ /// Captures a snapshot of map view
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="type">Type of file format</param>
+ /// <param name="quality">A integer value which representing quality for encoding, from 1 to 100</param>
+ /// <param name="path">A string which representing The file path for snapshot</param>
+ /// <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 native operation failed to allocate memory, connect to service.</exception>
+ public void CaptureSnapshot(SnapshotType type, int quality, string path)
+ {
+ var err = Interop.ViewSnapshot.ViewCaptureSnapshot(handle, (Interop.ViewSnapshotFormatType)type, quality, path);
+ err.ThrowIfFailed("Failed to create snapshot for the view");
+ }
+
+ private void SetGestureEventCallback()
+ {
+ if (_gestureEventCallback == null)
+ {
+ _gestureEventCallback = (type, eventData, userData) =>
+ {
+ if (type != Interop.ViewEventType.Gesture) return;
+ var eventArg = new MapGestureEventArgs(eventData);
+ switch (eventArg.GestureType)
+ {
+ case GestureType.Scroll: _scrolledEventHandler?.Invoke(this, eventArg); break;
+ case GestureType.Zoom: _twoFingerZoomedEventHandler?.Invoke(this, eventArg); break;
+ case GestureType.Click: _clickedEventHandler?.Invoke(this, eventArg); break;
+ case GestureType.DoubleClick: _doubleClickedEventHandler?.Invoke(this, eventArg); break;
+ case GestureType.TwoFingerClick: _twoFingerClickedEventHandler?.Invoke(this, eventArg); break;
+ case GestureType.Rotation: _twoFingerRotatedEventHandler?.Invoke(this, eventArg); break;
+ case GestureType.LongPress: _longPressedEventHandler?.Invoke(this, eventArg); break;
+ }
+ };
+ handle.SetEventCb(Interop.ViewEventType.Gesture, _gestureEventCallback, IntPtr.Zero);
+ Log.Info(string.Format("Gesture event callback is set"));
+ }
+ }
+
+ private void UnsetGestureEventCallback()
+ {
+ if (_scrolledEventHandler != null || _twoFingerZoomedEventHandler != null
+ || _clickedEventHandler != null || _doubleClickedEventHandler != null
+ || _twoFingerClickedEventHandler != null || _twoFingerRotatedEventHandler != null
+ || _longPressedEventHandler != null)
+ {
+ return;
+ }
+
+ handle.UnsetEventCb(Interop.ViewEventType.Gesture);
+ _gestureEventCallback = null;
+ Log.Info(string.Format("Gesture event callback is unset"));
+ }
+
+ private void SetObjectEventCallback()
+ {
+ if (_objectEventCallback == null)
+ {
+ _objectEventCallback = (type, eventData, userData) =>
+ {
+ if (type != Interop.ViewEventType.Object) return;
+ var eventArg = new Interop.ObjectEventDataHandle(eventData);
+ switch (eventArg.GestureType)
+ {
+ case Interop.ViewGesture.Click:
+ {
+ var mapObject = _handleToObjectTable[eventArg.ViewObject];
+ mapObject?.HandleClickedEvent();
+ break;
+ }
+ }
+ };
+ handle.SetEventCb(Interop.ViewEventType.Object, _objectEventCallback, IntPtr.Zero);
+ Log.Info(string.Format("Object event callback is set"));
+ }
+ }
+
+ private void SetViewReadyEventCallback()
+ {
+ if (_viewReadyEventCallback == null)
+ {
+ _viewReadyEventCallback = (type, eventData, userData) =>
+ {
+ _viewReadyEventHandler?.Invoke(this, EventArgs.Empty);
+ };
+ handle.SetEventCb(Interop.ViewEventType.Ready, _viewReadyEventCallback, IntPtr.Zero);
+ Log.Info(string.Format("ViewReady event callback is set"));
+ }
+ }
+
+ private void UnsetViewReadyEventCallback()
+ {
+ if (_viewReadyEventHandler == null)
+ {
+ handle.UnsetEventCb(Interop.ViewEventType.Ready);
+ _viewReadyEventCallback = null;
+ Log.Info(string.Format("ViewReady event callback is unset"));
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ _service.Dispose();
+ }
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using ElmSharp;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Marker map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Marker : MapObject, IDisposable
+ {
+ internal Interop.MarkerHandle handle;
+
+ 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);
+ }
+
+ /// <summary>
+ /// Gets or sets clicked event handlers.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public event EventHandler Clicked;
+
+ /// <summary>
+ /// Gets or sets marker's visibility.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public override bool IsVisible
+ {
+ get
+ {
+ return handle.IsVisible;
+ }
+ set
+ {
+ handle.IsVisible = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets geographical coordinates for this marker.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Coordinates
+ {
+ get
+ {
+ return new Geocoordinates(handle.Coordinates);
+ }
+ set
+ {
+ handle.Coordinates = value.handle;
+
+ // Marker takes ownership of the native handle.
+ value.handle.HasOwnership = false;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a string representing image file path for this marker.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string ImagePath
+ {
+ get
+ {
+ return handle.ImageFile;
+ }
+ set
+ {
+ handle.ImageFile = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets screen size for this marker.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Size MarkerSize
+ {
+ get
+ {
+ return handle.MarkerSize;
+ }
+ set
+ {
+ handle.MarkerSize = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets z-order for this marker.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <value>The integer value is 0 in default, and must be in range of from -100 to 100.</value>
+ public int ZOrder
+ {
+ get
+ {
+ return handle.ZOrder;
+ }
+ set
+ {
+ handle.ZOrder = value;
+ }
+ }
+
+ /// <summary>
+ /// Changes marker size.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="newSize">New size</param>
+ public void Resize(Size newSize)
+ {
+ MarkerSize = newSize;
+ }
+
+ /// <summary>
+ /// Changes marker coordinates.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <param name="newPosition">New position for marker</param>
+ public void Move(Geocoordinates newPosition)
+ {
+ Coordinates = newPosition;
+ }
+
+ internal override void HandleClickedEvent()
+ {
+ Clicked?.Invoke(this, EventArgs.Empty);
+ }
+
+ internal override void InvalidateMapObject()
+ {
+ handle = null;
+ }
+
+ internal override Interop.ViewObjectHandle GetHandle()
+ {
+ return handle;
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+
+ #endregion
+ }
+
+ /// <summary>
+ /// Pin type marker map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Pin : Marker
+ {
+ private const string defaultImagePath = "/usr/share/dotnet.tizen/framework/res/maps_marker_pin_48.png";
+
+ /// <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)
+ {
+ }
+
+ /// <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 Marker</param>
+ /// <remarks>
+ /// http://tizen.org/privilege/mediastorage is needed if the file path are relevant to media storage.
+ /// http://tizen.org/privilege/externalstorage is needed if the file 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 input coordinates or imagePath are invalid.</exception>
+ public Pin(Geocoordinates coordinates, string imagePath)
+ : base(coordinates, imagePath, Interop.ViewMarkerType.Pin)
+ {
+ }
+ }
+
+ /// <summary>
+ /// Sticker type marker map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Sticker : Marker
+ {
+ private const string defaultImagePath = "/usr/share/dotnet.tizen/framework/res/maps_marker_sticker_48.png";
+
+ /// <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)
+ {
+ }
+
+ /// <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 input or output path are relevant to media storage.
+ /// http://tizen.org/privilege/externalstorage is needed if 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 input coordinates or imagePath are invalid.</exception>
+ public Sticker(Geocoordinates coordinates, string imagePath)
+ : base(coordinates, imagePath, Interop.ViewMarkerType.Sticker)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Multiple Reverse geocode Request for Tizen map service
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class MultiReverseGeocodeRequest : MapServiceRequest<PlaceAddress>
+ {
+ private Interop.MultiReverseGeocodeCallback _geocodeCallback;
+ private List<PlaceAddress> _addressesList = new List<PlaceAddress>();
+
+ 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;
+ });
+ }
+ }
+}
--- /dev/null
+/**
+<summary>
+The Tizen.Maps namespace provides classes to get the information of Place, Geocoding, Route by querying,
+or to show them on the map view with interactive gestural interface.
+</summary>
+
+
+
+<remarks>
+
+<h2>Overview</h2>
+<para>
+Maps API provides a developer with a set of functions, helping to create Maps aware applications.<p/>
+
+Maps API comprises of following features:<br/>
+- Geocoding and reverse Geocoding<br/>
+- Discoverying Place information<br/>
+- Calculating Route<br/>
+- View
+</para>
+
+
+<para>
+Maps API allows a Developer to choose one of Map Providers which are being included as plugins.<p/>
+
+<para>
+<h3>Geocoding</h3>
+The Maps Geocoding API allows translating an address to its geographical
+location defined in terms of latitude and longitude; the input can be a
+qualified and structured address or a free-formed search text with full or
+partial address information.<p/>
+
+The example below shows a structured address:<br/>
+ - housenumber=117,<br/>
+ - street=Invaliden street<br/>
+ - city=Berlin,<br/>
+ - postalcode=10115,<br/>
+ - country=Germany,<br/>
+ - state=Berlin
+</para>
+
+
+<para>
+<h3>Reverse Geocoding</h3>
+The Maps Reverse Geocoding API allows to inverse translating a geographical
+location (longitude, latitude) to an address; it can be used to answer the
+question "Where am I?".
+</para>
+
+
+<para>
+<h3>Route</h3>
+The Maps Route API provides ways to calculate a route that defines a path
+between a start and a destination and may, optionally, pass through specific
+intermediate locations.<p/>
+
+Route Preferences:<br/>
+ - Travel Mode (car, pedestrian, public transit, truck),<br/>
+ - Optimization (fastest, shortest),<br/>
+ - Avoid/Prefer Preferences (toll road, motorway, ferry, public transit,
+ tunnel, dirt road, parks, car-pool lane).<br/>
+ - Route Calculations<br/>
+ - Way points and preferences as input values,<br/>
+ - Route geometry and maneuver (instructions for guidance) as result values:
+ Geometry consists of points that visually represent the determined route,
+ Maneuver contains turn-by-turn instruction and position.
+</para>
+
+
+<para>
+<h3>Places</h3>
+The Maps Place API allows you to find place information.<p/>
+
+Place search<br/>
+ - Depending on the location context, the number of relevant places might
+ be large. Therefore this query may not only return places, but also
+ suggestions for additional filter criteria that allow users to interactively
+ refine the classes of places they are interested in.<br/>
+ - Nearby Search: search for places within a specified area.
+ You can refine your search request by supplying keywords, Name of Points
+ of Interests, or Proximity.<br/>
+ - Category Search: search for popular places for the given location context and matching the category filter criteria.
+ You can refine your search request by specifying the categories of place you are searching for.<br/>
+Result item type of searching<br/>
+ - ID, name, location, distance, URI, rating, category.<br/>
+Place information allows to fetch details about a place. The following place content is supported:<br/>
+ - Base Attribute includes name, location, categories, contacts, ID, ratings, icon path,
+ image content, review content, and editorial content.<br/>
+ - Extended Attribute refers to opening hours, payment methods, annual closings, disabled access.
+</para>
+
+
+<para>
+<h3>View</h3>
+The Maps View API provides a developer with a set of functions, bringing
+basic interactive visual user interface in maps applications.<p/>
+
+View widget: Drawing a map image on the map port, the specified rectangular
+area of the maps application GUI.<p/>
+
+Zoom and rotation: Changing zoom and orientation of the view in response
+to user gestures, such as scrolling, tapping, zooming, rotating, etc.<p/>
+
+Conversion of screen coordinates to geographical and vise versa.<p/>
+
+User's gesture support:<br/>
+ - Receive the event of the user gesture.<br/>
+ - Enable or disable the specified gesture.<br/>
+ - Re-assign the action, which should be taken in response to the user's gesture.<p/>
+
+Various Properties:<br/>
+ - Visibility and size on the screen.<br/>
+ - Theme: Day, satellite, or terrain.<br/>
+ - Language: English, Russian, Chinese, Italian, German, Spanish, etc.
+</para>
+</para>
+
+
+
+<h2>Related Features</h2>
+<para>
+To guarantee that the Maps application runs on a device with Maps profile feature,
+declare the following feature requirements in the config file:<br/>
+http://tizen.org/feature/maps<br/>
+http://tizen.org/feature/internet
+</para>
+
+</remarks>
+*/
+
+namespace Tizen.Maps {}
+
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using EvasObject = ElmSharp.EvasObject;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Overlay map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Overlay : MapObject, IDisposable
+ {
+ internal Interop.OverlayHandle handle;
+
+ /// <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 input coordinates or objectToContain are invalid</exception>
+ public Overlay(Geocoordinates coordinates, EvasObject objectToContain)
+ : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal)
+ {
+ }
+
+ 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);
+ }
+
+ /// <summary>
+ /// Gets or sets visibility of overlay map object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public override bool IsVisible
+ {
+ get { return handle.IsVisible; }
+ set { handle.IsVisible = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets geographical coordinates for overlay map object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Coordinates
+ {
+ get
+ {
+ return new Geocoordinates(handle.Coordinates);
+ }
+ set
+ {
+ // Overlay takes ownership of the native handle.
+ handle.Coordinates = value.handle;
+ value.handle.HasOwnership = false;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets minimum zoom level for overlay map object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int MinimumZoomLevel
+ {
+ get
+ {
+ return handle.MinZoomLevel;
+ }
+ set
+ {
+ handle.MinZoomLevel = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets maximum zoom lever for overlay map object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int MaximumZoomLevel
+ {
+ get
+ {
+ return handle.MaxZoomLevel;
+ }
+ set
+ {
+ handle.MaxZoomLevel = value;
+ }
+ }
+
+ // Overlay object does not support click events
+ internal override void HandleClickedEvent()
+ {
+ throw new NotSupportedException("Overlay object does not support click events");
+ }
+
+ internal override void InvalidateMapObject()
+ {
+ handle = null;
+ }
+
+ internal override Interop.ViewObjectHandle GetHandle()
+ {
+ return handle;
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+
+ /// <summary>
+ /// Bubble overlay map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class BubbleOverlay : Overlay
+ {
+ /// <summary>
+ /// Creates a Bubble 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 input coordinates or objectToContain are invalid</exception>
+ public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain)
+ : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble)
+ {
+ }
+ }
+
+ /// <summary>
+ /// Box Overlay map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class BoxOverlay : Overlay
+ {
+ /// <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 input coordinates or objectToContain are invalid</exception>
+ public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain)
+ : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)
+ {
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place information, used in Place Discovery and Search
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Place : IDisposable
+ {
+ internal Interop.PlaceHandle handle;
+
+ internal Place(Interop.PlaceHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Gets ID string for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Id
+ {
+ get
+ {
+ return handle.Id;
+ }
+ }
+
+ /// <summary>
+ /// Gets name string for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Name
+ {
+ get
+ {
+ return handle.Name;
+ }
+ }
+
+ /// <summary>
+ /// Gets view URI for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Uri
+ {
+ get
+ {
+ return handle.Uri;
+ }
+ }
+
+ /// <summary>
+ /// Gets distance for the place from the center.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int Distance
+ {
+ get
+ {
+ return handle.Distance;
+ }
+ }
+
+ /// <summary>
+ /// Gets geographical location for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Coordinates
+ {
+ get
+ {
+ return new Geocoordinates(handle.Coordinates);
+ }
+ }
+
+ /// <summary>
+ /// Gets address for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceAddress Address
+ {
+ get
+ {
+ return new PlaceAddress(handle.Address);
+ }
+ }
+
+ /// <summary>
+ /// Gets rating for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceRating Rating
+ {
+ get
+ {
+ return new PlaceRating(handle.Rating);
+ }
+ }
+
+ /// <summary>
+ /// Gets supplier link for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceLink Supplier
+ {
+ get
+ {
+ return new PlaceLink(handle.Supplier);
+ }
+ }
+
+ /// <summary>
+ /// Gets related link for the place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceLink Related
+ {
+ get
+ {
+ return new PlaceLink(handle.Related);
+ }
+ }
+
+ /// <summary>
+ /// Gets all properties attached to this place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IDictionary<string, string> Properties
+ {
+ get
+ {
+ var properties = new Dictionary<string, string>();
+ handle.ForeachProperty((key, value) => properties[key] = value);
+ return properties;
+ }
+ }
+
+ /// <summary>
+ /// Gets all categories attached to this place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<PlaceCategory> Categories
+ {
+ get
+ {
+ var categories = new List<PlaceCategory>();
+ handle.ForeachCategory((categoryHandle) => categories.Add(new PlaceCategory(categoryHandle)));
+ return categories;
+ }
+ }
+
+ /// <summary>
+ /// Gets all attributes attached to this place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<PlaceAttribute> Attributes
+ {
+ get
+ {
+ var attributes = new List<PlaceAttribute>();
+ handle.ForeachAttribute((attributeHandle) => attributes.Add(new PlaceAttribute(attributeHandle)));
+ return attributes;
+ }
+ }
+
+ /// <summary>
+ /// Gets all contacts attached to this place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<PlaceContact> Contacts
+ {
+ get
+ {
+ var contacts = new List<PlaceContact>();
+ handle.ForeachContact((contactHandle) => contacts.Add(new PlaceContact(contactHandle)));
+ return contacts;
+ }
+ }
+
+ /// <summary>
+ /// Gets all editorials attached to this place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<PlaceEditorial> Editorials
+ {
+ get
+ {
+ var editorials = new List<PlaceEditorial>();
+ handle.ForeachEditorial((editorialHandle) => editorials.Add(new PlaceEditorial(editorialHandle)));
+ return editorials;
+ }
+ }
+
+ /// <summary>
+ /// Gets all images attached to this place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<PlaceImage> Images
+ {
+ get
+ {
+ var images = new List<PlaceImage>();
+ handle.ForeachImage((imageHandle) => images.Add(new PlaceImage(imageHandle)));
+ return images;
+ }
+ }
+
+ /// <summary>
+ /// Gets all reviews attached to this place.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<PlaceReview> Reviews
+ {
+ get
+ {
+ var reviews = new List<PlaceReview>();
+ handle.ForeachReview((reviewHandle) => reviews.Add(new PlaceReview(reviewHandle)));
+ return reviews;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.ComponentModel;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Address information for the map point used in Geocode and Reverse Geocode requests.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceAddress : IDisposable
+ {
+ internal Interop.AddressHandle handle;
+
+ /// <summary>
+ /// Constructs map address object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
+ public PlaceAddress()
+ {
+ handle = new Interop.AddressHandle();
+ }
+
+ internal PlaceAddress(Interop.AddressHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Gets a building number for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Building
+ {
+ get
+ {
+ return handle.Building;
+ }
+ set
+ {
+ handle.Building = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a city name for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string City
+ {
+ get
+ {
+ return handle.City;
+ }
+ set
+ {
+ handle.City = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a country name for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Country
+ {
+ get
+ {
+ return handle.Country;
+ }
+ set
+ {
+ handle.Country = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a country code for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string CountryCode
+ {
+ get
+ {
+ return handle.CountryCode;
+ }
+ set
+ {
+ handle.CountryCode = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a county for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string County
+ {
+ get
+ {
+ return handle.County;
+ }
+ set
+ {
+ handle.County = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a district name for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string District
+ {
+ get
+ {
+ return handle.District;
+ }
+ set
+ {
+ handle.District = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a free text associated with this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string FreeText
+ {
+ get
+ {
+ return handle.FreeText;
+ }
+ set
+ {
+ handle.FreeText = value;
+ }
+ }
+
+ [EditorBrowsableAttribute(EditorBrowsableState.Never)]
+ [Obsolete("Freetext is deprecated. Please use FreeText instead.")]
+ public string Freetext
+ {
+ get
+ {
+ return FreeText;
+ }
+ set
+ {
+ FreeText = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a postal code for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string PostalCode
+ {
+ get
+ {
+ return handle.PostalCode;
+ }
+ set
+ {
+ handle.PostalCode = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a state name for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string State
+ {
+ get
+ {
+ return handle.State;
+ }
+ set
+ {
+ handle.State = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a street name for this address.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Street
+ {
+ get
+ {
+ return handle.Street;
+ }
+ set
+ {
+ handle.Street = value;
+ }
+ }
+
+ /// <summary>
+ /// Returns a string that represents this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Returns a string which presents this object.</returns>
+ public override string ToString()
+ {
+ return $"{FreeText}";
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// List of <see cref="PlaceAddress"/> objects to be used in <see cref="MapService"/> APIs
+ /// </summary>
+ internal class PlaceAddressList : IDisposable
+ {
+ internal Interop.AddressListHandle handle;
+ private List<PlaceAddress> _list;
+
+ /// <summary>
+ /// Constructs a map address list object.
+ /// </summary>
+ /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
+ /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
+ public PlaceAddressList()
+ {
+ handle = new Interop.AddressListHandle();
+ }
+
+ internal PlaceAddressList(Interop.AddressListHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Gets an iterator for addresses in this list.
+ /// </summary>
+ public IEnumerable<PlaceAddress> Addresses
+ {
+ get
+ {
+ if (_list == null)
+ {
+ _list = new List<PlaceAddress>();
+ handle.Foreach(addressHandle => _list.Add(new PlaceAddress(addressHandle)));
+ }
+ return _list;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Attributes information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceAttribute
+ {
+ private string _id;
+ private string _label;
+ private string _text;
+
+ internal PlaceAttribute(Interop.PlaceAttributeHandle nativeHandle)
+ {
+ _id = nativeHandle.Id;
+ _label = nativeHandle.Label;
+ _text = nativeHandle.Text;
+ }
+
+ internal PlaceAttribute(IntPtr nativeHandle, bool needToRelease)
+ : this(new Interop.PlaceAttributeHandle(nativeHandle, needToRelease))
+ {
+ }
+
+ /// <summary>
+ /// Gets an ID for the place attribute.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Id { get { return _id; } }
+
+ /// <summary>
+ /// Gets a label for the place attribute.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Label { get { return _label; } }
+
+ /// <summary>
+ /// Gets a text for the place attribute.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Text { get { return _text; } }
+
+ /// <summary>
+ /// Returns a string that represents this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Returns a string which presents this object.</returns>
+ public override string ToString()
+ {
+ return $"{Label}: {Text}";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Category information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceCategory : IDisposable
+ {
+ internal Interop.PlaceCategoryHandle handle;
+
+ /// <summary>
+ /// Constructs search category object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
+ public PlaceCategory()
+ {
+ handle = new Interop.PlaceCategoryHandle();
+ }
+
+ internal PlaceCategory(Interop.PlaceCategoryHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+
+ /// <summary>
+ /// Gets or sets an ID for this category.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Id
+ {
+ get { return handle.Id; }
+ set { handle.Id = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets a name for this category.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Name
+ {
+ get { return handle.Name; }
+ set { handle.Name = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets an URL for this category.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Url
+ {
+ get { return handle.Url; }
+ set { handle.Url = value; }
+ }
+
+ /// <summary>
+ /// Returns a string that represents this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Returns a string which presents this object.</returns>
+ public override string ToString()
+ {
+ return $"{Name}";
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Contact information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceContact
+ {
+ private string _label;
+ private string _type;
+ private string _value;
+
+ internal PlaceContact(Interop.PlaceContactHandle handle)
+ {
+ _label = handle.Label;
+ _type = handle.Type;
+ _value = handle.Value;
+ }
+
+ internal PlaceContact(IntPtr nativeHandle, bool needToRelease) : this(new Interop.PlaceContactHandle(nativeHandle, needToRelease))
+ {
+ }
+
+ /// <summary>
+ /// Gets an ID for this place contact.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Id { get { return _type; } }
+
+ /// <summary>
+ /// Gets a label for this place contact.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Label { get { return _label; } }
+
+ /// <summary>
+ /// Gets a value for this place contact.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Value { get { return _value; } }
+
+ /// <summary>
+ /// Returns a string that represents this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Returns a string which presents this object.</returns>
+ public override string ToString()
+ {
+ return $"{Label}: {Value}";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Editorial information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceEditorial
+ {
+ private string _description;
+ private string _language;
+ private PlaceMedia _media;
+
+ internal PlaceEditorial(Interop.PlaceEditorialHandle handle)
+ {
+ _description = handle.Description;
+ _language = handle.Language;
+ _media = new PlaceMedia(handle.Media);
+ }
+
+ internal PlaceEditorial(IntPtr nativeHandle, bool needToRelease) : this(new Interop.PlaceEditorialHandle(nativeHandle, needToRelease))
+ {
+ }
+
+ /// <summary>
+ /// Gets a description for this place editorial.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Description { get { return _description; } }
+
+ /// <summary>
+ /// Gets a language for this place editorial.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Language { get { return _language; } }
+
+ /// <summary>
+ /// Gets an instance of <see cref="PlaceMedia"/> object which representing media for this place editorial.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceMedia Media { get { return _media; } }
+
+ /// <summary>
+ /// Returns a string that represents this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Returns a string which presents this object.</returns>
+ public override string ToString()
+ {
+ return $"{Description}";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Filter information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceFilter : IDisposable
+ {
+ internal Interop.PlaceFilterHandle handle;
+
+ /// <summary>
+ /// Constructs new place filter.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
+ public PlaceFilter()
+ {
+ handle = new Interop.PlaceFilterHandle();
+ }
+
+ /// <summary>
+ /// Gets or sets an free-formed address string for this place filter.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Depending on maps provider which the application has selected,
+ /// it may treat <see cref="PlaceFilter.Name"/>, <see cref="PlaceFilter.Keyword"/> and <see cref="PlaceFilter.Address"/>
+ /// as same kind of strings to search places.</remarks>
+ public string Address
+ {
+ get
+ {
+ return handle.PlaceAddress;
+ }
+ set
+ {
+ handle.PlaceAddress = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets an instance of <see cref="PlaceCategory"/> object for this place filter.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceCategory Category
+ {
+ get
+ {
+ return new PlaceCategory(handle.Category);
+ }
+ set
+ {
+ handle.Category = value.handle;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a keyword for this place filter.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Depending on maps provider which the application has selected,
+ /// it may treat <see cref="PlaceFilter.Name"/>, <see cref="PlaceFilter.Keyword"/> and <see cref="PlaceFilter.Address"/>
+ /// as same kind of strings to search places.</remarks>
+ public string Keyword
+ {
+ get
+ {
+ return handle.Keyword;
+ }
+ set
+ {
+ handle.Keyword = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a name for this place filter.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Depending on maps provider which the application has selected,
+ /// it may treat <see cref="PlaceFilter.Name"/>, <see cref="PlaceFilter.Keyword"/> and <see cref="PlaceFilter.Address"/>
+ /// as same kind of strings to search places.</remarks>
+ public string Name
+ {
+ get
+ {
+ return handle.PlaceName;
+ }
+ set
+ {
+ handle.PlaceName = value;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Image information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceImage
+ {
+ private string _id;
+ private string _url;
+ private int _width;
+ private int _height;
+ private PlaceLink _userLink;
+ private PlaceMedia _media;
+
+ internal PlaceImage(Interop.PlaceImageHandle handle)
+ {
+ _id = handle.Id;
+ _url = handle.Url;
+ _width = handle.Width;
+ _height = handle.Height;
+ _userLink = new PlaceLink(handle.User);
+ _media = new PlaceMedia(handle.Media);
+ }
+
+ /// <summary>
+ /// Gets an ID for this place image.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Id { get { return _id; } }
+
+ /// <summary>
+ /// Gets an URL for this place image.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Url { get { return _url; } }
+
+ /// <summary>
+ /// Gets width for this place image.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int Width { get { return _width; } }
+
+ /// <summary>
+ /// Gets height for this place image.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int Height { get { return _height; } }
+
+ /// <summary>
+ /// Gets an object which representing user link for this place image.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceLink UserLink { get { return _userLink; } }
+
+ /// <summary>
+ /// Gets an object which representing image media for this place image.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceMedia ImageMedia { get { return _media; } }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Link Object information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceLink
+ {
+ private string _id;
+ private string _name;
+ private string _link;
+ private string _type;
+
+ internal PlaceLink(Interop.PlaceLinkObjectHandle handle)
+ {
+ _id = handle.Id;
+ _name = handle.Name;
+ _link = handle.Link;
+ _type = handle.Type;
+ }
+
+ /// <summary>
+ /// Gets a string which representing ID for this place link.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Id { get { return _id; } }
+
+ /// <summary>
+ /// Gets a string which representing name for this place link.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Name { get { return _name; } }
+
+ /// <summary>
+ /// Gets a string which representing link for this place link.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Link { get { return _link; } }
+
+ /// <summary>
+ /// Gets a string which representing type for this place link.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Type { get { return _type; } }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// List of <see cref="Place"/> objects to be used in <see cref="MapService"/> APIs
+ /// </summary>
+ internal class PlaceList : IDisposable
+ {
+ internal Interop.PlaceListHandle handle;
+ private List<Place> _list;
+
+ internal PlaceList(Interop.PlaceListHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Gets an iterator for addresses in this list.
+ /// </summary>
+ public IEnumerable<Place> Places
+ {
+ get
+ {
+ if (_list == null)
+ {
+ _list = new List<Place>();
+ handle.Foreach(placeHandle => _list.Add(new Place(placeHandle)));
+ }
+ return _list;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Media information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceMedia
+ {
+ private string _attribution;
+ private PlaceLink _supplier;
+ private PlaceLink _via;
+
+ internal PlaceMedia(Interop.PlaceMediaHandle handle)
+ {
+ _attribution = handle.Attribution;
+ _supplier = new PlaceLink(handle.Supplier);
+ _via = new PlaceLink(handle.Via);
+ }
+
+ /// <summary>
+ /// Gets a string which representing attribution for this place media.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Attribution { get { return _attribution; } }
+
+ /// <summary>
+ /// Gets an instance of <see cref="PlaceLink"/> object which representing supplier for this place media.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceLink Supplier { get { return _supplier; } }
+
+ /// <summary>
+ /// Gets an instance of <see cref="PlaceLink"/> object which representing via data for this place media.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceLink Via { get { return _via; } }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Rating information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceRating
+ {
+ private int _count;
+ private double _average;
+
+ internal PlaceRating(Interop.PlaceRatingHandle handle)
+ {
+ _count = handle.Count;
+ _average = handle.Average;
+ }
+
+ /// <summary>
+ /// Gets the number of users rated for this place rating.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int UserCount { get { return _count; } }
+
+ /// <summary>
+ /// Gets average value of this place rating.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Average { get { return _average; } }
+
+ /// <summary>
+ /// Returns a string that represents this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <returns>Returns a string which presents this object.</returns>
+ public override string ToString()
+ {
+ return $"{Average}({UserCount} reviews)";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Review information, used in Place Discovery and Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceReview
+ {
+ private DateTime _date;
+ private string _title;
+ private double _rating;
+ private string _description;
+ private string _language;
+ private PlaceMedia _media;
+ private PlaceLink _userLink;
+
+ internal PlaceReview(Interop.PlaceReviewHandle handle)
+ {
+ string date = handle.Date;
+ if (DateTime.TryParse(date, out _date) == false)
+ {
+ Interop.ErrorCode.InvalidParameter.WarnIfFailed($"Wrong date format: {date}");
+ }
+
+ _title = handle.Title;
+ _rating = handle.Rating;
+ _description = handle.Description;
+ _language = handle.Language;
+ _media = new PlaceMedia(handle.Media);
+ _userLink = new PlaceLink(handle.User);
+ }
+
+ /// <summary>
+ /// Gets an instance of <see cref="DateTime"/> object which representing time of this review.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public DateTime Date { get { return _date; } }
+
+ /// <summary>
+ /// Gets a string which representing title of this review.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Title { get { return _title; } }
+
+ /// <summary>
+ /// Gets a value which representing rating of this review.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Rating { get { return _rating; } }
+
+ /// <summary>
+ /// Gets a string which representing description of this review.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Description { get { return _description; } }
+
+ /// <summary>
+ /// Gets a string which representing language of this review.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Language { get { return _language; } }
+
+ /// <summary>
+ /// Gets an instance of <see cref="PlaceMedia"/> object which representing review media of this review.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceMedia ReviewMedia { get { return _media; } }
+
+ /// <summary>
+ /// Gets an instance of <see cref="PlaceLink"/> object which representing user link of this review.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public PlaceLink UserLink { get { return _userLink; } }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place search request for Tizen map service
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class PlaceSearchRequest : MapServiceRequest<Place>
+ {
+ private Interop.SearchPlaceCallback _placeCallback;
+ private List<Place> _placeList = new List<Place>();
+
+ 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;
+ });
+ }
+
+ internal PlaceSearchRequest(MapService service, Area boundary) : this(service, ServiceRequestType.SearchPlaceByArea)
+ {
+ startExecutionAction = new Action(() =>
+ {
+ int requestID;
+ errMessage = $"Failed to get place list for given boundary";
+ errorCode = _service.handle.SearchPlaceByArea(boundary.handle, _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;
+ });
+ }
+
+ internal PlaceSearchRequest(MapService service, string address, Area boundary) : this(service, ServiceRequestType.SearchPlaceByAddress)
+ {
+ startExecutionAction = new Action(() =>
+ {
+ int requestID;
+ errMessage = $"Failed to get coordinates for address {address} in given boundary";
+ errorCode = _service.handle.SearchPlaceByAddress(address, boundary.handle, _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;
+ });
+ }
+
+ private PlaceSearchRequest(MapService service, ServiceRequestType type) : base(service, type)
+ {
+ // The Maps Service invokes this callback while iterating through the set of obtained Place data.
+ _placeCallback = (result, id, index, total, place, userData) =>
+ {
+ errorCode = result;
+ if (result.IsSuccess())
+ {
+ // The parameter place must be released using maps_place_destroy().
+ var placeHandle = new Interop.PlaceHandle(place, needToRelease: true);
+ _placeList.Add(new Place(placeHandle));
+ if (_placeList.Count == total)
+ {
+ _requestTask?.TrySetResult(_placeList);
+ }
+ return true;
+ }
+ else
+ {
+ // If search is failed, the value of total is 0 and place is NULL
+ _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ return false;
+ }
+ };
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Color = ElmSharp.Color;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Polygon map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Polygon : MapObject, IDisposable
+ {
+ internal Interop.PolygonHandle handle;
+ private List<Geocoordinates> _coordinateList;
+
+ /// <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);
+ }
+
+ /// <summary>
+ /// Adds or removes clicked event handlers.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public event EventHandler Clicked;
+
+ /// <summary>
+ /// Gets or sets visibility for the polygon.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public override bool IsVisible
+ {
+ get { return handle.IsVisible; }
+ set { handle.IsVisible = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets a list of geographical coordinates of polygon vertices.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<Geocoordinates> Coordinates
+ {
+ get
+ {
+ return _coordinateList;
+ }
+ set
+ {
+ var coordinates = value.ToList();
+ var err = Interop.ErrorCode.InvalidParameter;
+ if (coordinates == null || coordinates.Count() < 3)
+ {
+ err.ThrowIfFailed("given coordinates list should contain at least 3 coordinates");
+ }
+
+ var geocoordinateList = new GeocoordinatesList(coordinates, false);
+ if (handle.SetPolygon(geocoordinateList.handle).IsSuccess())
+ {
+ _coordinateList = coordinates;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets background color to fill the polygon.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Color FillColor
+ {
+ get
+ {
+ return handle.FillColor;
+ }
+ set
+ {
+ handle.FillColor = value;
+ }
+ }
+
+ internal override void HandleClickedEvent()
+ {
+ Clicked?.Invoke(this, EventArgs.Empty);
+ }
+
+ internal override void InvalidateMapObject()
+ {
+ handle = null;
+ }
+
+ internal override Interop.ViewObjectHandle GetHandle()
+ {
+ return handle;
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ _coordinateList.Clear();
+ }
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Color = ElmSharp.Color;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Polyline map object
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Polyline : MapObject, IDisposable
+ {
+ internal Interop.PolylineHandle handle;
+ private List<Geocoordinates> _coordinateList;
+
+ /// <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);
+ }
+
+ /// <summary>
+ /// Adds or removes clicked event handlers.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public event EventHandler Clicked;
+
+ /// <summary>
+ /// Gets or sets visibility for the polyline.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public override bool IsVisible
+ {
+ get { return handle.IsVisible; }
+ set { handle.IsVisible = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets a list of geographical coordinates for polyline vertices.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<Geocoordinates> Coordinates
+ {
+ get
+ {
+ return _coordinateList;
+ }
+ set
+ {
+ var coordinates = value.ToList();
+ var err = Interop.ErrorCode.InvalidParameter;
+ if (coordinates == null || coordinates.Count() < 2)
+ {
+ err.ThrowIfFailed("given coordinates list should contain at least 2 coordinates");
+ }
+
+ var geocoordinateList = new GeocoordinatesList(coordinates, false);
+ if (handle.SetPolyline(geocoordinateList.handle).IsSuccess())
+ {
+ _coordinateList = coordinates;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets line color.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Color LineColor
+ {
+ get
+ {
+ return handle.LineColor;
+ }
+ set
+ {
+ handle.LineColor = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets line width from 1 to 100 pixels.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int Width
+ {
+ get
+ {
+ return handle.LineWidth;
+ }
+ set
+ {
+ handle.LineWidth = value;
+ }
+ }
+
+ internal override void HandleClickedEvent()
+ {
+ Clicked?.Invoke(this, EventArgs.Empty);
+ }
+
+ internal override void InvalidateMapObject()
+ {
+ handle = null;
+ }
+
+ internal override Interop.ViewObjectHandle GetHandle()
+ {
+ return handle;
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ _coordinateList.Clear();
+ }
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Reverse geocode request for map service.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class ReverseGeocodeRequest : MapServiceRequest<PlaceAddress>
+ {
+ private Interop.ReverseGeocodeCallback _geocodeCallback;
+ private List<PlaceAddress> _addressList = new List<PlaceAddress>();
+
+ internal ReverseGeocodeRequest(MapService service, double latitude, double longitute) : base(service, ServiceRequestType.ReverseGeocode)
+ {
+ // The Maps Service invokes this callback when the address is obtained from the specified coordinates.
+ _geocodeCallback = (result, id, index, total, address, userData) =>
+ {
+ errorCode = result;
+ if (result.IsSuccess())
+ {
+ // The parameter address must be released using maps_address_destroy().
+ var addressHandle = new Interop.AddressHandle(address, needToRelease: true);
+ _addressList.Add(new PlaceAddress(addressHandle));
+ if (_addressList.Count == total)
+ {
+ _requestTask?.TrySetResult(_addressList);
+ }
+ }
+ else
+ {
+ // If search is failed, the value of total is 0 and address is NULL
+ _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ }
+ };
+
+ startExecutionAction = new Action(() =>
+ {
+ int requestID;
+ errMessage = $"Failed to get coordinates for given coordinates: {latitude}:{longitute}";
+ errorCode = _service.handle.ReverseGeocode(latitude, longitute, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID);
+ if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled)
+ {
+ _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ }
+ _requestID = requestID;
+ });
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Route information, used in Route Search requests.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class Route : IDisposable
+ {
+ internal Interop.RouteHandle handle;
+
+ internal Route(Interop.RouteHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Gets an instance of <see cref="Geocoordinates"/> object which representing destination coordinates for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Destination
+ {
+ get
+ {
+ return new Geocoordinates(handle.Destination);
+ }
+ }
+
+ /// <summary>
+ /// Gets total distance for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Distance
+ {
+ get
+ {
+ return handle.Distance;
+ }
+ }
+
+ /// <summary>
+ /// Get total duration to cover this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Duration
+ {
+ get
+ {
+ return handle.Duration;
+ }
+ }
+
+ /// <summary>
+ /// Gets an ID for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Id
+ {
+ get
+ {
+ return handle.Id;
+ }
+ }
+
+ /// <summary>
+ /// Gets transport mode for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public TransportMode Mode
+ {
+ get
+ {
+ return (TransportMode)handle.TransportMode;
+ }
+ }
+
+ /// <summary>
+ /// Gets origin coordinates for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Origin
+ {
+ get
+ {
+ return new Geocoordinates(handle.Origin);
+ }
+ }
+
+ /// <summary>
+ /// Gets a coordinates list for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<Geocoordinates> Path
+ {
+ get
+ {
+ var path = new List<Geocoordinates>();
+ handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle)));
+ return path;
+ }
+ }
+
+ /// <summary>
+ /// Gets a segment list for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<RouteSegment> Segments
+ {
+ get
+ {
+ var segments = new List<RouteSegment>();
+ handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle)));
+ return segments;
+ }
+ }
+
+ /// <summary>
+ /// Gets distance unit for this route.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public DistanceUnit Unit
+ {
+ get
+ {
+ return (DistanceUnit)handle.Unit;
+ }
+ }
+
+ /// <summary>
+ /// Gets an instance of <see cref="Area"/> object which representing bounding area for this route.
+ /// </summary>
+ private Area BoundingBox
+ {
+ get
+ {
+ return new Area(handle.BoundingBox);
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Route features, used for route search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum RouteFeature
+ {
+ /// <summary>
+ /// Indicates no route features (are selected).
+ /// </summary>
+ None = Interop.RouteRequestFeature.None,
+ /// <summary>
+ /// Indicates toll roads (toll gates/booths).
+ /// </summary>
+ Toll = Interop.RouteRequestFeature.Toll,
+ /// <summary>
+ /// Indicates motorway.
+ /// </summary>
+ Motorway = Interop.RouteRequestFeature.MotorWay,
+ /// <summary>
+ /// Indicates a boat ferry.
+ /// </summary>
+ BoatFerry = Interop.RouteRequestFeature.BoatFerry,
+ /// <summary>
+ /// Indicates rail (train) ferry.
+ /// </summary>
+ RailFerry = Interop.RouteRequestFeature.RailFerry,
+ /// <summary>
+ /// Indicates public transport.
+ /// </summary>
+ PublicTransit = Interop.RouteRequestFeature.PublicTransit,
+ /// <summary>
+ /// Indicates tunnel.
+ /// </summary>
+ Tunnel = Interop.RouteRequestFeature.Tunnel,
+ /// <summary>
+ /// Indicates dirt road.
+ /// </summary>
+ DirtRoad = Interop.RouteRequestFeature.DirtRoad,
+ /// <summary>
+ /// Indicates park.
+ /// </summary>
+ Parks = Interop.RouteRequestFeature.Parks,
+ /// <summary>
+ /// Indicates a high-occupancy vehicle lane.
+ /// </summary>
+ Hovlane = Interop.RouteRequestFeature.Hovlane,
+ /// <summary>
+ /// Indicates stairs.
+ /// </summary>
+ Stairs = Interop.RouteRequestFeature.Stairs,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Route feature weights used in route search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum RouteFeatureWeight
+ {
+ /// <summary>
+ /// Indicates normal weighting.
+ /// </summary>
+ Normal = Interop.RouteFeatureWeight.Normal,
+ /// <summary>
+ /// Indicates that a feature is preferred.
+ /// </summary>
+ Prefer = Interop.RouteFeatureWeight.Prefer,
+ /// <summary>
+ /// Indicates that a feature is to be avoided.
+ /// </summary>
+ Avoid = Interop.RouteFeatureWeight.Avoid,
+ /// <summary>
+ /// Indicates that soft-exclude applies to the feature.
+ /// </summary>
+ SoftExclude = Interop.RouteFeatureWeight.SoftExclude,
+ /// <summary>
+ /// Indicates that the feature is to be strictly excluded.
+ /// </summary>
+ StrictExclude = Interop.RouteFeatureWeight.StrictExclude,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Route Maneuver information, used in Route Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class RouteManeuver
+ {
+ private Interop.RouteDirection _direction;
+ private Interop.RouteTurnType _turntype;
+ private Geocoordinates _coordinates;
+ private string _road;
+ private string _instruction;
+ private string _locale;
+ private int _timeToNextInstruction;
+ private double _distanceToNextInstruction;
+
+ 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;
+ }
+
+ /// <summary>
+ /// Gets direction type for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public DirectionType Direction { get { return (DirectionType)_direction; } }
+
+ /// <summary>
+ /// Gets turn type for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public TurnInstruction Turn { get { return (TurnInstruction)_turntype; } }
+
+ /// <summary>
+ /// Gets a geographical coordinates position for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Position { get { return _coordinates; } }
+
+ /// <summary>
+ /// Gets a name of the road for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Road { get { return _road; } }
+
+ /// <summary>
+ /// Gets an instruction text for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Instruction { get { return _instruction; } }
+
+ /// <summary>
+ /// Gets a locale for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string Locale { get { return _locale; } }
+
+ /// <summary>
+ /// Gets time to next instruction for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public int TimeToNextInstruction { get { return _timeToNextInstruction; } }
+
+ /// <summary>
+ /// Gets distance to next instruction for this maneuver.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double DistanceToNextInstruction { get { return _distanceToNextInstruction; } }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Allowed route optimization option used in route search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>
+ /// Depending on loaded maps plug-in using <see cref="MapService"/>, some features may have no effect or differences with descriptions.
+ /// </remarks>
+ public enum RouteOptimization
+ {
+ /// <summary>
+ /// Indicates that searching for fastest routes.
+ /// </summary>
+ Fastest = Interop.RouteOptimization.Fastest,
+ /// <summary>
+ /// Indicates that searching for shortest routes (car mode only).
+ /// </summary>
+ Shortest = Interop.RouteOptimization.Shortest,
+ /// <summary>
+ /// Indicates that searching for most economic routes (car mode only).
+ /// </summary>
+ Economic = Interop.RouteOptimization.Economic,
+ /// <summary>
+ /// Indicates that searching for most scenic routes.
+ /// </summary>
+ Scenic = Interop.RouteOptimization.Scenic,
+ /// <summary>
+ /// Indicates that searching for most fastest routes now, based on current traffic condition.
+ /// </summary>
+ FastestNow = Interop.RouteOptimization.FastestNow,
+ /// <summary>
+ /// Indicates that searching for direct drive routes.
+ /// </summary>
+ DirectDrive = Interop.RouteOptimization.DirectDrive,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Route search request for Tizen map service requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class RouteSearchRequest : MapServiceRequest<Route>
+ {
+ private Interop.SearchRouteCallback _routeCallback;
+ private List<Route> _routeList = new List<Route>();
+
+ private Geocoordinates _to;
+ private Geocoordinates _from;
+ private List<Geocoordinates> _waypoints = new List<Geocoordinates>();
+
+ 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;
+ });
+ }
+
+
+ private RouteSearchRequest(MapService service, ServiceRequestType type) : base(service, type)
+ {
+ // The Maps Service invokes this callback while iterating through the set of obtained Routes.
+ _routeCallback = (result, id, index, total, route, userData) =>
+ {
+ errorCode = result;
+ if (result.IsSuccess())
+ {
+ // The parameter route must be released using maps_route_destroy().
+ var routeHandle = new Interop.RouteHandle(route, needToRelease: true);
+ _routeList.Add(new Route(routeHandle));
+ if (_routeList.Count == total)
+ {
+ _requestTask?.TrySetResult(_routeList);
+ }
+ return true;
+ }
+ else
+ {
+ // If search is failed, the value of total is 0 and route is NULL.
+ _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ return false;
+ }
+ };
+ }
+
+ /// <summary>
+ /// Gets or sets a list of way-points to cover between origin and destination.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<Geocoordinates> Waypoints
+ {
+ get
+ {
+ return _waypoints;
+ }
+ set
+ {
+ _waypoints = value.ToList();
+ }
+ }
+
+ private IntPtr[] GetCoordinateListForWaypoints()
+ {
+ var waypoints = new IntPtr[_waypoints.Count + 2];
+ waypoints[0] = _from.handle;
+ for (int i = 0; i < _waypoints.Count; ++i)
+ {
+ waypoints[i + 1] = _waypoints[i].handle;
+ }
+ waypoints[waypoints.Length - 1] = _to.handle;
+ return waypoints;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Place Segment information, used in Route Search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class RouteSegment
+ {
+ private Geocoordinates _origin;
+ private Geocoordinates _destination;
+ private double _distance;
+ private double _duration;
+ private Area _boundingBox;
+
+ private List<RouteManeuver> _maneuvers = new List<RouteManeuver>();
+ private List<Geocoordinates> _path = new List<Geocoordinates>();
+
+ 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)));
+ }
+
+ /// <summary>
+ /// Gets an origin coordinates for this segment.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Origin { get { return _origin; } }
+
+ /// <summary>
+ /// Gets a destination coordinates for this segment.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public Geocoordinates Destination { get { return _destination; } }
+
+ /// <summary>
+ /// Gets total distance for this segment.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Distance { get { return _distance; } }
+
+ /// <summary>
+ /// Gets total duration to cover this segment.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public double Duration { get { return _duration; } }
+
+ /// <summary>
+ /// Gets a maneuver list for this segment.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<RouteManeuver> Maneuvers { get { return _maneuvers; } }
+
+ /// <summary>
+ /// Gets a coordinates list for this segment.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IEnumerable<Geocoordinates> Path { get { return _path; } }
+
+ private Area BoundingBox { get { return _boundingBox; } }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Preferences for route search requests
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public class SearchPreference : IGeocodePreference, IPlaceSearchPreference, IRouteSearchPreference, IDisposable
+ {
+ internal Interop.PreferenceHandle handle;
+ private IDictionary<string, string> _properties = new Dictionary<string, string>();
+
+ /// <summary>
+ /// Constructors a new search preference.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public SearchPreference()
+ {
+ handle = new Interop.PreferenceHandle();
+ }
+
+ /// <summary>
+ /// Constructors a new search preference.
+ /// </summary>
+ internal SearchPreference(Interop.PreferenceHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Gets or sets preferred language.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Language should be specified as an ISO 3166 alpha-2 two letter country-code
+ /// followed by ISO 639-1 for the two-letter language code.<br/>e.g. "ko-KR", "en-US".</remarks>
+ public string Language
+ {
+ get
+ {
+ return handle.Language;
+ }
+ set
+ {
+ Log.Info(string.Format("Language is changed from {0} to {1}", handle.Language, value));
+ handle.Language = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the maximum result count for each service request.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ /// <remarks>Setting negative value will not have any effect on MaxResults value</remarks>
+ public int MaxResults
+ {
+ get
+ {
+ return handle.MaxResult;
+ }
+ set
+ {
+ Log.Info(string.Format("MaxResult is changed from {0} to {1}", handle.MaxResult, value));
+ handle.MaxResult = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets distance unit.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public DistanceUnit Unit
+ {
+ get
+ {
+ return (DistanceUnit)handle.Unit;
+ }
+ set
+ {
+ Log.Info(string.Format("Unit is changed from {0} to {1}", handle.Unit, value));
+ handle.Unit = (Interop.DistanceUnit)value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets preferred country.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public string CountryCode
+ {
+ get
+ {
+ return handle.CountryCode;
+ }
+ set
+ {
+ Log.Info(string.Format("CountryCode is changed from {0} to {1}", handle.CountryCode, value));
+ handle.CountryCode = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets search properties as key value pair.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public IReadOnlyDictionary<string, string> Properties
+ {
+ get
+ {
+ Action<string, string> action = (key, value) =>
+ {
+ _properties[key] = value;
+ };
+
+ handle.ForeachProperty(action);
+ return (IReadOnlyDictionary<string, string>)_properties;
+ }
+ set
+ {
+ foreach (var prop in value)
+ {
+ _properties[prop.Key] = prop.Value;
+ handle.SetProperty(prop.Key, prop.Value);
+ Log.Info(string.Format("Properties is changed to [{0}, {1}]", prop.Key, prop.Value));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets route optimization.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public RouteOptimization Optimization
+ {
+ get
+ {
+ return (RouteOptimization)handle.Optimization;
+ }
+ set
+ {
+ Log.Info(string.Format("Optimization is changed from {0} to {1}", handle.Optimization, value));
+ handle.Optimization = (Interop.RouteOptimization)value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets route transport mode.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public TransportMode Mode
+ {
+ get
+ {
+ return (TransportMode)handle.TransportMode;
+ }
+ set
+ {
+ Log.Info(string.Format("TransportMode is changed from {0} to {1}", handle.TransportMode, value));
+ handle.TransportMode = (Interop.RouteTransportMode)value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets route feature weight.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public RouteFeatureWeight RouteFeatureWeight
+ {
+ get
+ {
+ return (RouteFeatureWeight)handle.FeatureWeight;
+ }
+ set
+ {
+ Log.Info(string.Format("RouteFeatureWeight is changed from {0} to {1}", handle.FeatureWeight, value));
+ handle.FeatureWeight = (Interop.RouteFeatureWeight)value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets route feature.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public RouteFeature RouteFeature
+ {
+ get
+ {
+ return (RouteFeature)handle.Feature;
+ }
+ set
+ {
+ Log.Info(string.Format("RouteFeature is changed from {0} to {1}", handle.Feature, value));
+ handle.Feature = (Interop.RouteRequestFeature)value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets if searching for alternative routes is enabled.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public bool SearchAlternativeRoutes
+ {
+ get
+ {
+ return handle.AlternativesEnabled;
+ }
+ set
+ {
+ Log.Info(string.Format("SearchAlternativeRoutes is {0}", (value ? "enabled" : "disabled")));
+ handle.AlternativesEnabled = value;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ /// <summary>
+ /// Releases all resources used by this object.
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Features available in the Map Service
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum ServiceData
+ {
+ /// <summary>
+ /// Indicates availability of address value in the Place data.
+ /// </summary>
+ PlaceAddress = Interop.ServiceData.PlaceAddress,
+ /// <summary>
+ /// Indicates availability of rating value in the Place data.
+ /// </summary>
+ PlaceRating = Interop.ServiceData.PlaceRating,
+ /// <summary>
+ /// Indicates availability of place category list in the Place data.
+ /// </summary>
+ PlaceCategories = Interop.ServiceData.PlaceCategories,
+ /// <summary>
+ /// Indicates availability of place attribute list in the Place data.
+ /// </summary>
+ PlaceAttributes = Interop.ServiceData.PlaceAttributes,
+ /// <summary>
+ /// Indicates availability of place contact list in the Place data.
+ /// </summary>
+ PlaceContacts = Interop.ServiceData.PlaceContacts,
+ /// <summary>
+ /// Indicates availability of place editorial list in the Place data.
+ /// </summary>
+ PlaceEditorials = Interop.ServiceData.PlaceEditorials,
+ /// <summary>
+ /// Indicates availability of place review list in the Place data.
+ /// </summary>
+ PlaceReviews = Interop.ServiceData.PlaceReviews,
+ /// <summary>
+ /// Indicates availability of place image in Place the data.
+ /// </summary>
+ PlaceImage = Interop.ServiceData.PlaceImage,
+ /// <summary>
+ /// Indicates availability of place supplier link value in the Place data.
+ /// </summary>
+ PlaceSupplier = Interop.ServiceData.PlaceSupplier,
+ /// <summary>
+ /// Indicates availability of related place link in the Place data.
+ /// </summary>
+ PlaceRelated = Interop.ServiceData.PlaceRelated,
+
+ /// <summary>
+ /// Indicates that the Route Data Structure is defined as a Path (a list of geographical coordinates).
+ /// </summary>
+ RoutePath = Interop.ServiceData.RoutePath,
+ /// <summary>
+ /// Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a Path.
+ /// </summary>
+ RouteSegmentsPath = Interop.ServiceData.RouteSegmentsPath,
+ /// <summary>
+ /// Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a list of Maneuvers.
+ /// </summary>
+ RouteSegmentsManeuvers = Interop.ServiceData.RouteSegmentsManeuvers,
+
+ /// <summary>
+ /// Indicates availability of traffic information on the Map.
+ /// </summary>
+ ViewTraffic = Interop.ServiceData.ViewTraffic,
+ /// <summary>
+ /// Indicates availability of public transit information on the Map.
+ /// </summary>
+ ViewPublicTransit = Interop.ServiceData.ViewPublicTransit,
+ /// <summary>
+ /// Indicates availability of 3D building drawable on the Map.
+ /// </summary>
+ ViewBuilding = Interop.ServiceData.ViewBuilding,
+ /// <summary>
+ /// Indicates availability of scale bar on the Map.
+ /// </summary>
+ ViewScaleBar = Interop.ServiceData.ViewScaleBar,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Service Requests available in the Maps Service
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum ServiceRequestType
+ {
+ /// <summary>
+ /// Indicates that service request to get position <see cref="Geocoordinates"/> for a given free-formed address string is allowed.
+ /// </summary>
+ Geocode = Interop.ServiceType.Geocode,
+ /// <summary>
+ /// Indicates that service request to get position <see cref="Geocoordinates"/> for a given address, within the specified bounding <see cref="Area"/>, is allowed.
+ /// </summary>
+ GeocodeInsideArea = Interop.ServiceType.GeocodeInsideArea,
+ /// <summary>
+ /// Indicates that service request to get position <see cref="Geocoordinates"/> for a given <see cref="PlaceAddress"/> is allowed.
+ /// </summary>
+ GeocodeByStructuredAddress = Interop.ServiceType.GeocodeByStructuredAddress,
+ /// <summary>
+ /// Indicates that service request to get <see cref="PlaceAddress"/> for a given <see cref="Geocoordinates"/> is allowed.
+ /// </summary>
+ ReverseGeocode = Interop.ServiceType.ReverseGeocode,
+ /// <summary>
+ /// Indicates that service request to get <see cref="PlaceAddress"/> for a given <see cref="GeocoordinatesList"/> is allowed.
+ /// </summary>
+ MultiReverseGeocode = Interop.ServiceType.MultiReverseGeocode,
+
+ /// <summary>
+ /// Indicates that service request to query <see cref="Place"/> information for a given <see cref="Geocoordinates"/> is allowed.
+ /// </summary>
+ SearchPlace = Interop.ServiceType.SearchPlace,
+ /// <summary>
+ /// Indicates that service request to query <see cref="Place"/> information for a given <see cref="Area"/> is allowed.
+ /// </summary>
+ SearchPlaceByArea = Interop.ServiceType.SearchPlaceByArea,
+ /// <summary>
+ /// Indicates that service request to query <see cref="Place"/> information for a given free-formed address string is allowed.
+ /// </summary>
+ SearchPlaceByAddress = Interop.ServiceType.SearchPlaceByAddress,
+ /// <summary>
+ /// Indicates that service request to query <see cref="Place"/> information list for all places in a given <see cref="Area"/> is allowed.
+ /// </summary>
+ SearchPlaceList = Interop.ServiceType.SearchPlaceList,
+ /// <summary>
+ /// Indicates that service request to get detailed <see cref="Place"/> information for a given <see cref="PlaceList"/> is allowed.
+ /// </summary>
+ SearchGetPlaceDetails = Interop.ServiceType.SearchGetPlaceDetails,
+
+ /// <summary>
+ /// Indicates that service request to query <see cref="Route"/> information from a given origin <see cref="Geocoordinates"/> and destination <see cref="Geocoordinates"/> is allowed.
+ /// </summary>
+ SearchRoute = Interop.ServiceType.SearchRoute,
+ /// <summary>
+ /// Indicates that service request to query <see cref="Route"/> information passing through specified way-points <see cref="GeocoordinatesList"/> is allowed.
+ /// </summary>
+ SearchRouteWithWaypoints = Interop.ServiceType.SearchRouteWaypoints,
+
+ /// <summary>
+ /// Indicates that map view service is allowed.
+ /// </summary>
+ View = Interop.ServiceType.View,
+ /// <summary>
+ /// Indicates that map view snapshot service is allowed.
+ /// </summary>
+ ViewSnapshot = Interop.ServiceType.ViewSnapshot,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Enumeration for snapshot file formats
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum SnapshotType
+ {
+ /// <summary>
+ /// Indicates BMP file format.
+ /// </summary>
+ BMP = Interop.ViewSnapshotFormatType.ViewSnapshotBmp,
+ /// <summary>
+ /// Indicates JPEG file format.
+ /// </summary>
+ JPEG = Interop.ViewSnapshotFormatType.ViewSnapshotJpeg,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Route types
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum TransportMode
+ {
+ /// <summary>
+ /// Indicates that route is to be traveled by car.
+ /// </summary>
+ Car = Interop.RouteTransportMode.Car,
+ /// <summary>
+ /// Indicates that route is for a pedestrian.
+ /// </summary>
+ Pedestrian = Interop.RouteTransportMode.Pedestrian,
+ /// <summary>
+ /// Indicates that route is for a cyclist.
+ /// </summary>
+ Bicycle = Interop.RouteTransportMode.Bicycle,
+ /// <summary>
+ /// Indicates that route is to be traveled using public transport.
+ /// </summary>
+ PublicTransit = Interop.RouteTransportMode.PublicTransit,
+ /// <summary>
+ /// Indicates that route is for a truck.
+ /// </summary>
+ Truck = Interop.RouteTransportMode.Truck,
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Maps
+{
+ /// <summary>
+ /// Turn Instruction type for route maneuver
+ /// </summary>
+ /// <since_tizen>3</since_tizen>
+ public enum TurnInstruction
+ {
+ /// <summary>
+ /// Indicates unknown instruction.
+ /// </summary>
+ None = Interop.RouteTurnType.None,
+ /// <summary>
+ /// Indicates instruction to move straight.
+ /// </summary>
+ Straight = Interop.RouteTurnType.Straight,
+ /// <summary>
+ /// Indicates instruction to bear right.
+ /// </summary>
+ BearRight = Interop.RouteTurnType.BearRight,
+ /// <summary>
+ /// Indicates instruction to turn slightly to the right.
+ /// </summary>
+ LightRight = Interop.RouteTurnType.LightRight,
+ /// <summary>
+ /// Indicates instruction to turn right.
+ /// </summary>
+ Right = Interop.RouteTurnType.Right,
+ /// <summary>
+ /// Indicates instruction to turn hard to the right.
+ /// </summary>
+ HardRight = Interop.RouteTurnType.HardRight,
+ /// <summary>
+ /// Indicates instruction to u-turn to the right.
+ /// </summary>
+ UturnRight = Interop.RouteTurnType.UturnRight,
+ /// <summary>
+ /// Indicates instruction to u-turn to the left.
+ /// </summary>
+ UturnLeft = Interop.RouteTurnType.UturnLeft,
+ /// <summary>
+ /// Indicates instruction to turn hard to the left.
+ /// </summary>
+ HardLeft = Interop.RouteTurnType.HardLeft,
+ /// <summary>
+ /// Indicates instruction to turn left.
+ /// </summary>
+ Left = Interop.RouteTurnType.Left,
+ /// <summary>
+ /// Indicates instruction to turn slightly to the left.
+ /// </summary>
+ LightLeft = Interop.RouteTurnType.LightLeft,
+ /// <summary>
+ /// Indicates instruction to bear left.
+ /// </summary>
+ BearLeft = Interop.RouteTurnType.BearLeft,
+ /// <summary>
+ /// Indicates instruction to take right fork.
+ /// </summary>
+ RightFork = Interop.RouteTurnType.RightFork,
+ /// <summary>
+ /// Indicates instruction to take left fork.
+ /// </summary>
+ LeftFork = Interop.RouteTurnType.LeftFork,
+ /// <summary>
+ /// Indicates instruction to take straight fork.
+ /// </summary>
+ StraightFork = Interop.RouteTurnType.StraightFork,
+ }
+}