summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDinesh Dwivedi <dinesh.d@samsung.com>2017-01-12 18:06:07 +0530
committerchanywa <cbible.kim@samsung.com>2017-01-16 14:07:16 +0900
commit5ad9d879c93105e14348c1d3a81314907acd4109 (patch)
treef6ac4dc9437ee54448e78b12c1e549c871a789ea
parent533e9a7b179f91a54071993cb6df457a6b2a1591 (diff)
downloadmaps-5ad9d879c93105e14348c1d3a81314907acd4109.tar.gz
maps-5ad9d879c93105e14348c1d3a81314907acd4109.tar.bz2
maps-5ad9d879c93105e14348c1d3a81314907acd4109.zip
Change-Id: I29122c67ef9507516da317b535b2337f35cb8a2e Signed-off-by: Dinesh Dwivedi <dinesh.d@samsung.com>
-rwxr-xr-xTizen.Maps/Interop/Interop.Address.cs205
-rwxr-xr-xTizen.Maps/Interop/Interop.AddressList.cs66
-rwxr-xr-xTizen.Maps/Interop/Interop.Area.cs44
-rwxr-xr-xTizen.Maps/Interop/Interop.Coordinates.cs86
-rwxr-xr-xTizen.Maps/Interop/Interop.CoordinatesList.cs72
-rwxr-xr-xTizen.Maps/Interop/Interop.ErrorCode.cs7
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Attribute.cs39
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Category.cs66
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Contact.cs39
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Editorial.cs39
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Filter.cs109
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Image.cs66
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Link.Object.cs51
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Media.cs42
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Rating.cs34
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.Review.cs76
-rwxr-xr-xTizen.Maps/Interop/Interop.Place.cs237
-rwxr-xr-xTizen.Maps/Interop/Interop.PlaceList.cs46
-rwxr-xr-xTizen.Maps/Interop/Interop.Preference.cs184
-rwxr-xr-xTizen.Maps/Interop/Interop.Route.Maneuver.cs90
-rwxr-xr-xTizen.Maps/Interop/Interop.Route.Segment.cs106
-rwxr-xr-xTizen.Maps/Interop/Interop.Route.cs151
-rwxr-xr-xTizen.Maps/Interop/Interop.SafeMapsHandle.cs66
-rwxr-xr-xTizen.Maps/Interop/Interop.Service.cs176
-rwxr-xr-xTizen.Maps/Interop/Interop.View.Event.Data.cs133
-rwxr-xr-xTizen.Maps/Interop/Interop.View.Marker.cs102
-rwxr-xr-xTizen.Maps/Interop/Interop.View.Object.cs124
-rwxr-xr-xTizen.Maps/Interop/Interop.View.Overlay.cs72
-rwxr-xr-xTizen.Maps/Interop/Interop.View.Polygon.cs79
-rwxr-xr-xTizen.Maps/Interop/Interop.View.Polyline.cs91
-rwxr-xr-xTizen.Maps/Interop/Interop.View.cs272
-rwxr-xr-xTizen.Maps/Tizen.Maps.Net45.csproj15
-rwxr-xr-xTizen.Maps/Tizen.Maps.csproj15
-rw-r--r--Tizen.Maps/Tizen.Maps.nuspec2
-rwxr-xr-xTizen.Maps/Tizen.Maps/Area.cs34
-rwxr-xr-xTizen.Maps/Tizen.Maps/GeocodePreference.cs95
-rwxr-xr-xTizen.Maps/Tizen.Maps/GeocodeRequest.cs24
-rwxr-xr-xTizen.Maps/Tizen.Maps/Geocoordinates.cs59
-rwxr-xr-xTizen.Maps/Tizen.Maps/GeocoordinatesList.cs54
-rwxr-xr-xTizen.Maps/Tizen.Maps/IGeocodePreference.cs39
-rwxr-xr-xTizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs55
-rwxr-xr-xTizen.Maps/Tizen.Maps/IRouteSearchPreference.cs55
-rwxr-xr-xTizen.Maps/Tizen.Maps/MapGestureEventArgs.cs38
-rwxr-xr-xTizen.Maps/Tizen.Maps/MapObject.cs57
-rwxr-xr-xTizen.Maps/Tizen.Maps/MapObjectEventArgs.cs69
-rwxr-xr-xTizen.Maps/Tizen.Maps/MapService.cs116
-rwxr-xr-xTizen.Maps/Tizen.Maps/MapServiceRequest.cs33
-rwxr-xr-xTizen.Maps/Tizen.Maps/MapView.cs210
-rwxr-xr-xTizen.Maps/Tizen.Maps/Marker.cs107
-rwxr-xr-xTizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs14
-rwxr-xr-xTizen.Maps/Tizen.Maps/Overlay.cs83
-rwxr-xr-xTizen.Maps/Tizen.Maps/Place.cs255
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceAddress.cs175
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceAddressList.cs44
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceAttribute.cs17
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceCategory.cs79
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceContact.cs25
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceEditorial.cs21
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceFilter.cs86
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceImage.cs24
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceLink.cs16
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceList.cs40
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceMedia.cs18
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceRating.cs13
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceReview.cs34
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceSearchPreference.cs165
-rwxr-xr-xTizen.Maps/Tizen.Maps/PlaceSearchRequest.cs24
-rwxr-xr-xTizen.Maps/Tizen.Maps/Polygon.cs77
-rwxr-xr-xTizen.Maps/Tizen.Maps/Polyline.cs82
-rwxr-xr-xTizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs14
-rwxr-xr-xTizen.Maps/Tizen.Maps/Route.cs170
-rwxr-xr-xTizen.Maps/Tizen.Maps/RouteManeuver.cs67
-rwxr-xr-xTizen.Maps/Tizen.Maps/RouteSearchPreference.cs196
-rwxr-xr-xTizen.Maps/Tizen.Maps/RouteSearchRequest.cs21
-rwxr-xr-xTizen.Maps/Tizen.Maps/RouteSegment.cs74
-rwxr-xr-xTizen.Maps/Tizen.Maps/SearchPreference.cs218
-rw-r--r--packaging/csapi-maps.spec2
77 files changed, 3485 insertions, 2616 deletions
diff --git a/Tizen.Maps/Interop/Interop.Address.cs b/Tizen.Maps/Interop/Interop.Address.cs
index 4882035..3612b57 100755
--- a/Tizen.Maps/Interop/Interop.Address.cs
+++ b/Tizen.Maps/Interop/Interop.Address.cs
@@ -19,107 +19,156 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class Address
- {
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool AddressCallback(int index, IntPtr /* maps_address_h */ addressHandle, IntPtr /* void */ userData);
-
- [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);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_building_number")]
- internal static extern ErrorCode GetBuildingNumber(AddressHandle /* maps_address_h */ address, out string buildingNumber);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_street")]
- internal static extern ErrorCode GetStreet(AddressHandle /* maps_address_h */ address, out string street);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_district")]
- internal static extern ErrorCode GetDistrict(AddressHandle /* maps_address_h */ address, out string district);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_city")]
- internal static extern ErrorCode GetCity(AddressHandle /* maps_address_h */ address, out string city);
+ [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_get_state")]
- internal static extern ErrorCode GetState(AddressHandle /* maps_address_h */ address, out string state);
+ [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_country")]
- internal static extern ErrorCode GetCountry(AddressHandle /* maps_address_h */ address, out string country);
+ [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_get_country_code")]
- internal static extern ErrorCode GetCountryCode(AddressHandle /* maps_address_h */ address, out string countryCode);
+ [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_county")]
- internal static extern ErrorCode GetCounty(AddressHandle /* maps_address_h */ address, out string county);
+ [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_get_postal_code")]
- internal static extern ErrorCode GetPostalCode(AddressHandle /* maps_address_h */ address, out string postalCode);
+ [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_freetext")]
- internal static extern ErrorCode GetFreetext(AddressHandle /* maps_address_h */ address, out string freetext);
+ [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_building_number")]
- internal static extern ErrorCode SetBuildingNumber(AddressHandle /* maps_address_h */ address, string buildingNumber);
+ [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_set_street")]
- internal static extern ErrorCode SetStreet(AddressHandle /* maps_address_h */ address, string street);
+ [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_district")]
- internal static extern ErrorCode SetDistrict(AddressHandle /* maps_address_h */ address, string district);
+ [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_set_city")]
- internal static extern ErrorCode SetCity(AddressHandle /* maps_address_h */ address, string city);
+ [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_state")]
- internal static extern ErrorCode SetState(AddressHandle /* maps_address_h */ address, string state);
+ [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_set_country")]
- internal static extern ErrorCode SetCountry(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(AddressHandle /* maps_address_h */ address, 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_set_county")]
- internal static extern ErrorCode SetCounty(AddressHandle /* maps_address_h */ address, string county);
+ [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_postal_code")]
- internal static extern ErrorCode SetPostalCode(AddressHandle /* maps_address_h */ address, string postalCode);
+ [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_set_freetext")]
- internal static extern ErrorCode SetFreetext(AddressHandle /* maps_address_h */ address, string freetext);
+ [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_list_create")]
- internal static extern ErrorCode ListCreate(out IntPtr /* maps_address_list_h */ addressList);
+ [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_list_append")]
- internal static extern ErrorCode ListAppend(AddressListHandle /* maps_address_list_h */ addressList, AddressHandle /* maps_address_h */ address);
+ [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_list_remove")]
- internal static extern ErrorCode ListRemove(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(AddressListHandle /* maps_address_list_h */ addressList, out int length);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_foreach")]
- internal static extern ErrorCode ListForeach(AddressListHandle /* maps_address_list_h */ addressList, AddressCallback callback, IntPtr /* void */ userData);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_destroy")]
- internal static extern ErrorCode ListDestroy(IntPtr /* maps_address_list_h */ addressList);
- }
+ [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
{
- public AddressHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Address.Destroy; }
- }
+ [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);
- internal class AddressListHandle : SafeMapsHandle
- {
- public AddressListHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Address.ListDestroy; }
+ [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);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.AddressList.cs b/Tizen.Maps/Interop/Interop.AddressList.cs
new file mode 100755
index 0000000..ebbc6d3
--- /dev/null
+++ b/Tizen.Maps/Interop/Interop.AddressList.cs
@@ -0,0 +1,66 @@
+/*
+ * 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");
+ }
+ }
+}
diff --git a/Tizen.Maps/Interop/Interop.Area.cs b/Tizen.Maps/Interop/Interop.Area.cs
index 6ba654e..bd05164 100755
--- a/Tizen.Maps/Interop/Interop.Area.cs
+++ b/Tizen.Maps/Interop/Interop.Area.cs
@@ -19,30 +19,44 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal enum AreaType
- {
- None, // MAPS_AREA_NONE
- Rectangle, // MAPS_AREA_RECTANGLE
- Circle, // MAPS_AREA_CIRCLE
- }
-
- internal static partial class Area
+ internal class AreaHandle : SafeMapsHandle
{
[DllImport(Libraries.MapService, EntryPoint = "maps_area_create_rectangle")]
- internal static extern ErrorCode CreateRectangle(CoordinatesHandle /* maps_coordinates_h */ topLeft, CoordinatesHandle /* maps_coordinates_h */ bottomRight, out IntPtr /* maps_area_h */ area);
+ 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(CoordinatesHandle /* maps_coordinates_h */ center, double radius, out IntPtr /* maps_area_h */ area);
+ 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(AreaHandle /* maps_area_h */ origin, out IntPtr /* maps_area_h */ cloned);
- }
+ internal static extern ErrorCode Clone(IntPtr /* maps_area_h */ origin, out IntPtr /* maps_area_h */ cloned);
- internal class AreaHandle : SafeMapsHandle
- {
- public AreaHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Area.Destroy; }
+ internal AreaHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal AreaHandle(CoordinatesHandle topLeft, CoordinatesHandle bottomRight) : this(IntPtr.Zero, true)
+ {
+ CreateRectangle(topLeft, bottomRight, out handle).ThrowIfFailed("Failed to create native handle");
+ }
+
+ internal AreaHandle(CoordinatesHandle topLeft, double radius) : this(IntPtr.Zero, true)
+ {
+ CreateCircle(topLeft, 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);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Coordinates.cs b/Tizen.Maps/Interop/Interop.Coordinates.cs
index 5f975ba..a427727 100755
--- a/Tizen.Maps/Interop/Interop.Coordinates.cs
+++ b/Tizen.Maps/Interop/Interop.Coordinates.cs
@@ -19,11 +19,14 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class Coordinates
- {
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool CoordinatesCallback(int index, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+ [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);
@@ -33,50 +36,35 @@ internal static partial class Interop
[DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_clone")]
internal static extern ErrorCode Clone(IntPtr /* maps_coordinates_h */ origin, out IntPtr /* maps_coordinates_h */ cloned);
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_get_latitude")]
- internal static extern ErrorCode GetLatitude(CoordinatesHandle /* maps_coordinates_h */ coordinates, out double latitude);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_get_longitude")]
- internal static extern ErrorCode GetLongitude(CoordinatesHandle /* maps_coordinates_h */ coordinates, out double longitude);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_get_latitude_longitude")]
- internal static extern ErrorCode GetLatitudeLongitude(CoordinatesHandle /* maps_coordinates_h */ coordinates, out double latitude, out double longitude);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_set_latitude")]
- internal static extern ErrorCode SetLatitude(CoordinatesHandle /* maps_coordinates_h */ coordinates, double latitude);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_set_longitude")]
- internal static extern ErrorCode SetLongitude(CoordinatesHandle /* maps_coordinates_h */ coordinates, double longitude);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_set_latitude_longitude")]
- internal static extern ErrorCode SetLatitudeLongitude(CoordinatesHandle /* maps_coordinates_h */ coordinates, double latitude, double longitude);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_create")]
- internal static extern ErrorCode ListCreate(out IntPtr /* maps_coordinates_list_h */ coordinatesList);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_destroy")]
- internal static extern ErrorCode ListDestroy(IntPtr /* maps_coordinates_list_h */ coordinatesList);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_append")]
- internal static extern ErrorCode ListAppend(CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, IntPtr /* maps_coordinates_h */ coordinates);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_remove")]
- internal static extern ErrorCode ListRemove(CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, CoordinatesHandle /* maps_coordinates_h */ coordinates);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_get_length")]
- internal static extern ErrorCode ListGetLength(CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, out int length);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_foreach")]
- internal static extern ErrorCode ListForeach(CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, CoordinatesCallback callback, IntPtr /* void */ userData);
- }
-
- internal class CoordinatesHandle : SafeMapsHandle
- {
- public CoordinatesHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Coordinates.Destroy; }
- }
-
- internal class CoordinatesListHandle : SafeMapsHandle
- {
- public CoordinatesListHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Coordinates.ListDestroy; }
+ 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);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.CoordinatesList.cs b/Tizen.Maps/Interop/Interop.CoordinatesList.cs
new file mode 100755
index 0000000..4a1700a
--- /dev/null
+++ b/Tizen.Maps/Interop/Interop.CoordinatesList.cs
@@ -0,0 +1,72 @@
+/*
+ * 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 coordinate 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");
+ }
+ }
+}
diff --git a/Tizen.Maps/Interop/Interop.ErrorCode.cs b/Tizen.Maps/Interop/Interop.ErrorCode.cs
index 1b90512..ac9c3ed 100755
--- a/Tizen.Maps/Interop/Interop.ErrorCode.cs
+++ b/Tizen.Maps/Interop/Interop.ErrorCode.cs
@@ -34,6 +34,7 @@ internal static partial class Interop
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
}
@@ -61,7 +62,7 @@ internal static class ErrorCodeExtensions
{
if (err.IsFailed())
{
- Log.Debug(LogTag, string.Format("{0}, err: {1}", msg, err.ToString()), file, func, line);
+ Log.Debug(LogTag, $"{msg}, err: {err.ToString()}", file, func, line);
return false;
}
return true;
@@ -75,7 +76,7 @@ internal static class ErrorCodeExtensions
{
if (err.IsFailed())
{
- Log.Error(LogTag, string.Format("{0}, err: {1}", msg, err.ToString()), file, func, line);
+ Log.Error(LogTag, $"{msg}, err: {err.ToString()}", file, func, line);
throw err.GetException(msg);
}
return true;
@@ -83,7 +84,7 @@ internal static class ErrorCodeExtensions
internal static Exception GetException(this Interop.ErrorCode err, string message)
{
- string errMessage = string.Format("{0}, err: {1}", message, err.ToString());
+ string errMessage = $"{message}, err: {err.ToString()}";
switch (err)
{
//case ErrorCode.None:
diff --git a/Tizen.Maps/Interop/Interop.Place.Attribute.cs b/Tizen.Maps/Interop/Interop.Place.Attribute.cs
index a301626..f7e7c78 100755
--- a/Tizen.Maps/Interop/Interop.Place.Attribute.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Attribute.cs
@@ -19,26 +19,37 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceAttribute
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_clone")]
- internal static extern ErrorCode Clone(PlaceAttributeHandle /* maps_place_attribute_h */ origin, out IntPtr /* maps_place_attribute_h */ cloned);
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_id")]
- internal static extern ErrorCode GetId(PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string id);
+ internal string Label
+ {
+ get { return NativeGet(this.GetLabel); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_label")]
- internal static extern ErrorCode GetLabel(PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string label);
+ internal string Text
+ {
+ get { return NativeGet(this.GetText); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_text")]
- internal static extern ErrorCode GetText(PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string text);
- }
-
- internal class PlaceAttributeHandle : SafeMapsHandle
- {
- public PlaceAttributeHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceAttribute.Destroy; }
+ public PlaceAttributeHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Category.cs b/Tizen.Maps/Interop/Interop.Place.Category.cs
index a8b547c..7265409 100755
--- a/Tizen.Maps/Interop/Interop.Place.Category.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Category.cs
@@ -19,38 +19,62 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceCategory
+ [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_clone")]
- internal static extern ErrorCode Clone(PlaceCategoryHandle /* maps_place_category_h */ origin, out IntPtr /* maps_place_category_h */ cloned);
-
[DllImport(Libraries.MapService, EntryPoint = "maps_place_category_destroy")]
internal static extern ErrorCode Destroy(IntPtr /* maps_place_category_h */ category);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_id")]
- internal static extern ErrorCode GetId(PlaceCategoryHandle /* maps_place_category_h */ category, out string id);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_name")]
- internal static extern ErrorCode GetName(PlaceCategoryHandle /* maps_place_category_h */ category, out string name);
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ set { NativeSet(this.SetId, value); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_url")]
- internal static extern ErrorCode GetUrl(PlaceCategoryHandle /* maps_place_category_h */ category, out string url);
+ internal string Name
+ {
+ get { return NativeGet(this.GetName); }
+ set { NativeSet(this.SetName, value); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_id")]
- internal static extern ErrorCode SetId(PlaceCategoryHandle /* maps_place_category_h */ category, string id);
+ internal string Url
+ {
+ get { return NativeGet(this.GetUrl); }
+ set { NativeSet(this.SetUrl, value); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_name")]
- internal static extern ErrorCode SetName(PlaceCategoryHandle /* maps_place_category_h */ category, string name);
+ public PlaceCategoryHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_url")]
- internal static extern ErrorCode SetUrl(PlaceCategoryHandle /* maps_place_category_h */ category, string url);
- }
+ internal PlaceCategoryHandle() : this(IntPtr.Zero, true)
+ {
+ Create(out handle).ThrowIfFailed("Failed to create native handle");
+ }
- internal class PlaceCategoryHandle : SafeMapsHandle
- {
- public PlaceCategoryHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceCategory.Destroy; }
+ internal static PlaceCategoryHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceCategoryHandle(nativeHandle, true);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Contact.cs b/Tizen.Maps/Interop/Interop.Place.Contact.cs
index 3d4b430..bd6b61f 100755
--- a/Tizen.Maps/Interop/Interop.Place.Contact.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Contact.cs
@@ -19,26 +19,37 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceContact
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_clone")]
- internal static extern ErrorCode Clone(PlaceContactHandle /* maps_place_contact_h */ origin, out IntPtr /* maps_place_contact_h */ cloned);
+ internal string Label
+ {
+ get { return NativeGet(this.GetLabel); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_label")]
- internal static extern ErrorCode GetLabel(PlaceContactHandle /* maps_place_contact_h */ contact, out string label);
+ internal string Type
+ {
+ get { return NativeGet(this.GetType); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_type")]
- internal static extern ErrorCode GetType(PlaceContactHandle /* maps_place_contact_h */ contact, out string type);
+ internal string Value
+ {
+ get { return NativeGet(this.GetValue); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_value")]
- internal static extern ErrorCode GetValue(PlaceContactHandle /* maps_place_contact_h */ contact, out string value);
- }
-
- internal class PlaceContactHandle : SafeMapsHandle
- {
- public PlaceContactHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceContact.Destroy; }
+ public PlaceContactHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Editorial.cs b/Tizen.Maps/Interop/Interop.Place.Editorial.cs
index 9b974b2..6af3dba 100755
--- a/Tizen.Maps/Interop/Interop.Place.Editorial.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Editorial.cs
@@ -19,26 +19,37 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceEditorial
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_clone")]
- internal static extern ErrorCode Clone(PlaceEditorialHandle /* maps_place_editorial_h */ origin, out IntPtr /* maps_place_editorial_h */ cloned);
+ internal string Description
+ {
+ get { return NativeGet(this.GetDescription); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_description")]
- internal static extern ErrorCode GetDescription(PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out string description);
+ internal string Language
+ {
+ get { return NativeGet(this.GetLanguage); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_language")]
- internal static extern ErrorCode GetLanguage(PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out string language);
+ internal PlaceMediaHandle Media
+ {
+ get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_media")]
- internal static extern ErrorCode GetMedia(PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out IntPtr /* maps_place_media_h */ media);
- }
-
- internal class PlaceEditorialHandle : SafeMapsHandle
- {
- public PlaceEditorialHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceEditorial.Destroy; }
+ public PlaceEditorialHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Filter.cs b/Tizen.Maps/Interop/Interop.Place.Filter.cs
index 4ca7185..20dc6a9 100755
--- a/Tizen.Maps/Interop/Interop.Place.Filter.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Filter.cs
@@ -19,56 +19,93 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceFilter
- {
- [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_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_create")]
- internal static extern ErrorCode Create(out IntPtr /* maps_place_filter_h */ filter);
+ [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_destroy")]
- internal static extern ErrorCode Destroy(IntPtr /* maps_place_filter_h */ filter);
+ [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_clone")]
- internal static extern ErrorCode Clone(PlaceFilterHandle /* maps_place_filter_h */ origin, out IntPtr /* maps_place_filter_h */ cloned);
+ [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")]
- internal static extern ErrorCode Get(PlaceFilterHandle /* maps_place_filter_h */ filter, string key, out string value);
+ [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_get_keyword")]
- internal static extern ErrorCode GetKeyword(PlaceFilterHandle /* maps_place_filter_h */ filter, out string keyword);
+ [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_place_name")]
- internal static extern ErrorCode GetPlaceName(PlaceFilterHandle /* maps_place_filter_h */ filter, out 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_get_category")]
- internal static extern ErrorCode GetCategory(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_foreach_property")]
- internal static extern ErrorCode ForeachProperty(PlaceFilterHandle /* maps_place_filter_h */ filter, PlaceFilterPropertiesCallback callback, IntPtr /* void */ userData);
+ [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_get_place_address")]
- internal static extern ErrorCode GetPlaceAddress(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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set")]
- internal static extern ErrorCode Set(PlaceFilterHandle /* maps_place_filter_h */ filter, string key, string value);
+ 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_set_keyword")]
- internal static extern ErrorCode SetKeyword(PlaceFilterHandle /* maps_place_filter_h */ filter, string keyword);
+ [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_set_place_name")]
- internal static extern ErrorCode SetPlaceName(PlaceFilterHandle /* maps_place_filter_h */ filter, string placeName);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_category")]
- internal static extern ErrorCode SetCategory(PlaceFilterHandle /* maps_place_filter_h */ filter, PlaceCategoryHandle /* maps_place_category_h */ category);
+ [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_set_place_address")]
- internal static extern ErrorCode SetPlaceAddress(PlaceFilterHandle /* maps_place_filter_h */ filter, string placeAddress);
- }
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_filter_h */ filter);
- internal class PlaceFilterHandle : SafeMapsHandle
- {
- public PlaceFilterHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceFilter.Destroy; }
+ 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");
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Image.cs b/Tizen.Maps/Interop/Interop.Place.Image.cs
index 7ad7b64..ff96f6b 100755
--- a/Tizen.Maps/Interop/Interop.Place.Image.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Image.cs
@@ -19,35 +19,61 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceImage
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_clone")]
- internal static extern ErrorCode Clone(PlaceImageHandle /* maps_place_image_h */ origin, out IntPtr /* maps_place_image_h */ cloned);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_id")]
- internal static extern ErrorCode GetId(PlaceImageHandle /* maps_place_image_h */ image, out string id);
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_url")]
- internal static extern ErrorCode GetUrl(PlaceImageHandle /* maps_place_image_h */ image, out string url);
+ internal string Url
+ {
+ get { return NativeGet(this.GetUrl); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_width")]
- internal static extern ErrorCode GetWidth(PlaceImageHandle /* maps_place_image_h */ image, out int width);
+ internal int Width
+ {
+ get { return NativeGet<int>(this.GetWidth); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_height")]
- internal static extern ErrorCode GetHeight(PlaceImageHandle /* maps_place_image_h */ image, out int height);
+ internal int Height
+ {
+ get { return NativeGet<int>(this.GetHeight); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_user_link")]
- internal static extern ErrorCode GetUserLink(PlaceImageHandle /* maps_place_image_h */ image, out IntPtr /* maps_place_link_object_h */ user);
+ internal PlaceLinkObjectHandle User
+ {
+ get { return NativeGet(this.GetUserLink, PlaceLinkObjectHandle.Create); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_media")]
- internal static extern ErrorCode GetMedia(PlaceImageHandle /* maps_place_image_h */ image, out IntPtr /* maps_place_media_h */ media);
- }
+ internal PlaceMediaHandle Media
+ {
+ get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); }
+ }
- internal class PlaceImageHandle : SafeMapsHandle
- {
- public PlaceImageHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceImage.Destroy; }
+ public PlaceImageHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Link.Object.cs b/Tizen.Maps/Interop/Interop.Place.Link.Object.cs
index 9bcff08..ac170b1 100755
--- a/Tizen.Maps/Interop/Interop.Place.Link.Object.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Link.Object.cs
@@ -19,29 +19,50 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceLinkObject
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_clone")]
- internal static extern ErrorCode Clone(PlaceLinkObjectHandle /* maps_place_link_object_h */ origin, out IntPtr /* maps_place_link_object_h */ cloned);
+ internal string Id
+ {
+ get { return NativeGet(this.GetId); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_id")]
- internal static extern ErrorCode GetId(PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string id);
+ internal string Name
+ {
+ get { return NativeGet(this.GetName); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_name")]
- internal static extern ErrorCode GetName(PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string name);
+ internal string Link
+ {
+ get { return NativeGet(this.GetLink); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_string")]
- internal static extern ErrorCode GetString(PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string linkString);
+ internal string Type
+ {
+ get { return NativeGet(this.GetType); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_type")]
- internal static extern ErrorCode GetType(PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string type);
- }
+ public PlaceLinkObjectHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
- internal class PlaceLinkObjectHandle : SafeMapsHandle
- {
- public PlaceLinkObjectHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceLinkObject.Destroy; }
+ internal static PlaceLinkObjectHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceLinkObjectHandle(nativeHandle, true);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Media.cs b/Tizen.Maps/Interop/Interop.Place.Media.cs
index 133d4a0..14145b8 100755
--- a/Tizen.Maps/Interop/Interop.Place.Media.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Media.cs
@@ -19,26 +19,42 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceMedia
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_clone")]
- internal static extern ErrorCode Clone(PlaceMediaHandle /* maps_place_media_h */ origin, out IntPtr /* maps_place_media_h */ cloned);
+ internal string Attribution
+ {
+ get { return NativeGet(this.GetAttribution); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_attribution")]
- internal static extern ErrorCode GetAttribution(PlaceMediaHandle /* maps_place_media_h */ media, out string attribution);
+ internal PlaceLinkObjectHandle Supplier
+ {
+ get { return NativeGet(this.GetSupplier, PlaceLinkObjectHandle.Create); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_supplier")]
- internal static extern ErrorCode GetSupplier(PlaceMediaHandle /* maps_place_media_h */ media, out IntPtr /* maps_place_link_object_h */ supplier);
+ internal PlaceLinkObjectHandle Via
+ {
+ get { return NativeGet(this.GetVia, PlaceLinkObjectHandle.Create); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_via")]
- internal static extern ErrorCode GetVia(PlaceMediaHandle /* maps_place_media_h */ media, out IntPtr /* maps_place_link_object_h */ via);
- }
+ public PlaceMediaHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
- internal class PlaceMediaHandle : SafeMapsHandle
- {
- public PlaceMediaHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceMedia.Destroy; }
+ internal static PlaceMediaHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceMediaHandle(nativeHandle, true);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Rating.cs b/Tizen.Maps/Interop/Interop.Place.Rating.cs
index fe3965a..acefe9e 100755
--- a/Tizen.Maps/Interop/Interop.Place.Rating.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Rating.cs
@@ -19,23 +19,35 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceRating
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_clone")]
- internal static extern ErrorCode Clone(PlaceRatingHandle /* maps_place_rating_h */ origin, out IntPtr /* maps_place_rating_h */ cloned);
+ internal int Count
+ {
+ get { return NativeGet<int>(this.GetCount); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_get_count")]
- internal static extern ErrorCode GetCount(PlaceRatingHandle /* maps_place_rating_h */ rating, out int count);
+ internal double Average
+ {
+ get { return NativeGet<double>(this.GetAverage); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_get_average")]
- internal static extern ErrorCode GetAverage(PlaceRatingHandle /* maps_place_rating_h */ rating, out double average);
- }
- internal class PlaceRatingHandle : SafeMapsHandle
- {
- public PlaceRatingHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceRating.Destroy; }
+ public PlaceRatingHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
+
+ internal static PlaceRatingHandle Create(IntPtr nativeHandle)
+ {
+ return new PlaceRatingHandle(nativeHandle, true);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.Review.cs b/Tizen.Maps/Interop/Interop.Place.Review.cs
index c3f7fb8..7cb1111 100755
--- a/Tizen.Maps/Interop/Interop.Place.Review.cs
+++ b/Tizen.Maps/Interop/Interop.Place.Review.cs
@@ -19,38 +19,66 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class PlaceReview
- {
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_destroy")]
- internal static extern ErrorCode Destroy(IntPtr /* maps_place_review_h */ review);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_clone")]
- internal static extern ErrorCode Clone(PlaceReviewHandle /* maps_place_review_h */ origin, out IntPtr /* maps_place_review_h */ cloned);
+ [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_date")]
- internal static extern ErrorCode GetDate(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_title")]
- internal static extern ErrorCode GetTitle(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_rating")]
- internal static extern ErrorCode GetRating(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_description")]
- internal static extern ErrorCode GetDescription(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_language")]
- internal static extern ErrorCode GetLanguage(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_media")]
- internal static extern ErrorCode GetMedia(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(PlaceReviewHandle /* maps_place_review_h */ review, out IntPtr /* maps_place_link_object_h */ user);
- }
+ [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
{
- public PlaceReviewHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = PlaceReview.Destroy; }
+ [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)
+ {
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Place.cs b/Tizen.Maps/Interop/Interop.Place.cs
index a03cca9..9d8a898 100755
--- a/Tizen.Maps/Interop/Interop.Place.cs
+++ b/Tizen.Maps/Interop/Interop.Place.cs
@@ -19,7 +19,34 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class Place
+ [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);
@@ -42,77 +69,171 @@ internal static partial class Interop
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool ReviewsCallback(int index, int total, IntPtr /* maps_place_review_h */ review, IntPtr /* void */ userData);
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool PlaceCallback(int index, IntPtr /* maps_place_h */ place, 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(PlaceHandle /* maps_place_h */ origin, out IntPtr /* maps_place_h */ cloned);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_id")]
- internal static extern ErrorCode GetId(PlaceHandle /* maps_place_h */ place, out string id);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_name")]
- internal static extern ErrorCode GetName(PlaceHandle /* maps_place_h */ place, out string name);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_uri")]
- internal static extern ErrorCode GetUri(PlaceHandle /* maps_place_h */ place, out string uri);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_location")]
- internal static extern ErrorCode GetLocation(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_coordinates_h */ location);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_distance")]
- internal static extern ErrorCode GetDistance(PlaceHandle /* maps_place_h */ place, out int distance);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_address")]
- internal static extern ErrorCode GetAddress(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_address_h */ address);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_rating")]
- internal static extern ErrorCode GetRating(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_rating_h */ rating);
-
[DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_property")]
- internal static extern ErrorCode ForeachProperty(PlaceHandle /* maps_place_h */ place, PropertiesCallback callback, IntPtr /* void */ userData);
+ 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(PlaceHandle /* maps_place_h */ place, CategoriesCallback callback, IntPtr /* void */ userData);
+ 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(PlaceHandle /* maps_place_h */ place, AttributesCallback callback, IntPtr /* void */ userData);
+ 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(PlaceHandle /* maps_place_h */ place, ContactsCallback callback, IntPtr /* void */ userData);
+ 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(PlaceHandle /* maps_place_h */ place, EditorialsCallback callback, IntPtr /* void */ userData);
+ 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(PlaceHandle /* maps_place_h */ place, ImagesCallback callback, IntPtr /* void */ userData);
+ 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(PlaceHandle /* maps_place_h */ place, ReviewsCallback callback, IntPtr /* void */ userData);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_supplier_link")]
- internal static extern ErrorCode GetSupplierLink(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(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_link_object_h */ related);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_foreach")]
- internal static extern ErrorCode ListForeach(PlaceListHandle /* maps_place_list_h */ placeList, PlaceCallback callback, IntPtr /* void */ userData);
+ internal static extern ErrorCode ForeachReview(IntPtr /* maps_place_h */ place, ReviewsCallback callback, IntPtr /* void */ userData);
- [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_destroy")]
- internal static extern ErrorCode ListDestroy(IntPtr /* maps_place_list_h */ placeList);
- }
-
- internal class PlaceHandle : SafeMapsHandle
- {
- public PlaceHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Place.Destroy; }
- }
+ [DllImport(Libraries.MapService, EntryPoint = "maps_place_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_place_h */ place);
- internal class PlaceListHandle : SafeMapsHandle
- {
- public PlaceListHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Place.ListDestroy; }
+ [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");
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.PlaceList.cs b/Tizen.Maps/Interop/Interop.PlaceList.cs
new file mode 100755
index 0000000..8edf5b8
--- /dev/null
+++ b/Tizen.Maps/Interop/Interop.PlaceList.cs
@@ -0,0 +1,46 @@
+/*
+ * 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");
+ }
+ }
+}
diff --git a/Tizen.Maps/Interop/Interop.Preference.cs b/Tizen.Maps/Interop/Interop.Preference.cs
index edae298..f309cad 100755
--- a/Tizen.Maps/Interop/Interop.Preference.cs
+++ b/Tizen.Maps/Interop/Interop.Preference.cs
@@ -70,86 +70,158 @@ internal static partial class Interop
Stairs, // MAPS_ROUTE_FEATURE_STAIRS
}
- internal static partial class Preference
- {
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool PreferencePropertiesCallback(int index, int total, string key, string value, IntPtr /* void */ userData);
+ [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_create")]
- internal static extern ErrorCode Create(out IntPtr /* maps_preference_h */ preference);
+ [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_destroy")]
- internal static extern ErrorCode Destroy(IntPtr /* maps_preference_h */ preference);
+ [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_clone")]
- internal static extern ErrorCode Clone(PreferenceHandle /* maps_preference_h */ origin, out IntPtr /* maps_preference_h */ cloned);
+ [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_distance_unit")]
- internal static extern ErrorCode GetDistanceUnit(PreferenceHandle /* maps_preference_h */ preference, out DistanceUnit? /* maps_distance_unit_e */ unit);
+ [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_get_language")]
- internal static extern ErrorCode GetLanguage(PreferenceHandle /* maps_preference_h */ preference, out string language);
+ [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_max_results")]
- internal static extern ErrorCode GetMaxResults(PreferenceHandle /* maps_preference_h */ preference, out 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_get_country_code")]
- internal static extern ErrorCode GetCountryCode(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(PreferenceHandle /* maps_preference_h */ preference, out RouteOptimization? /* maps_route_optimization_e */ optimization);
+ [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_get_route_transport_mode")]
- internal static extern ErrorCode GetRouteTransportMode(PreferenceHandle /* maps_preference_h */ preference, out RouteTransportMode? /* maps_route_transport_mode_e */ transportMode);
+ [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_feature_weight")]
- internal static extern ErrorCode GetRouteFeatureWeight(PreferenceHandle /* maps_preference_h */ preference, out RouteFeatureWeight? /* maps_route_feature_weight_e */ featureWeight);
+ [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_get_route_feature")]
- internal static extern ErrorCode GetRouteFeature(PreferenceHandle /* maps_preference_h */ preference, out RouteRequestFeature? /* maps_route_feature_e */ feature);
+ [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_alternatives_enabled")]
- internal static extern ErrorCode GetRouteAlternativesEnabled(PreferenceHandle /* maps_preference_h */ preference, out bool? enable);
+ [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_get")]
- internal static extern ErrorCode Get(PreferenceHandle /* maps_preference_h */ preference, string key, out string value);
+ [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_foreach_property")]
- internal static extern ErrorCode ForeachProperty(PreferenceHandle /* maps_preference_h */ preference, PreferencePropertiesCallback callback, IntPtr /* void */ userData);
+ [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_distance_unit")]
- internal static extern ErrorCode SetDistanceUnit(PreferenceHandle /* maps_preference_h */ preference, DistanceUnit /* maps_distance_unit_e */ unit);
+ [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_set_language")]
- internal static extern ErrorCode SetLanguage(PreferenceHandle /* maps_preference_h */ preference, string language);
+ [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_max_results")]
- internal static extern ErrorCode SetMaxResults(PreferenceHandle /* maps_preference_h */ preference, int maxResults);
+ [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_set_country_code")]
- internal static extern ErrorCode SetCountryCode(PreferenceHandle /* maps_preference_h */ preference, string countryCode);
+ [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_route_optimization")]
- internal static extern ErrorCode SetRouteOptimization(PreferenceHandle /* maps_preference_h */ preference, RouteOptimization /* maps_route_optimization_e */ optimization);
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_property")]
+ internal static extern ErrorCode SetProperty(this PreferenceHandle /* maps_preference_h */ preference, string key, string value);
- [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_transport_mode")]
- internal static extern ErrorCode SetRouteTransportMode(PreferenceHandle /* maps_preference_h */ preference, RouteTransportMode /* maps_route_transport_mode_e */ transportMode);
+ 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_set_route_feature_weight")]
- internal static extern ErrorCode SetRouteFeatureWeight(PreferenceHandle /* maps_preference_h */ preference, RouteFeatureWeight /* maps_route_feature_weight_e */ featureWeight);
+ [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_set_route_feature")]
- internal static extern ErrorCode SetRouteFeature(PreferenceHandle /* maps_preference_h */ preference, RouteRequestFeature /* maps_route_feature_e */ feature);
- [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_alternatives_enabled")]
- internal static extern ErrorCode SetRouteAlternativesEnabled(PreferenceHandle /* maps_preference_h */ preference, bool enable);
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_create")]
+ internal static extern ErrorCode Create(out IntPtr /* maps_preference_h */ preference);
- [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_property")]
- internal static extern ErrorCode SetProperty(PreferenceHandle /* maps_preference_h */ preference, string key, string value);
- }
+ [DllImport(Libraries.MapService, EntryPoint = "maps_preference_destroy")]
+ internal static extern ErrorCode Destroy(IntPtr /* maps_preference_h */ preference);
- internal class PreferenceHandle : SafeMapsHandle
- {
- public PreferenceHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Preference.Destroy; }
+ 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);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Route.Maneuver.cs b/Tizen.Maps/Interop/Interop.Route.Maneuver.cs
index 5458b8c..a2c6216 100755
--- a/Tizen.Maps/Interop/Interop.Route.Maneuver.cs
+++ b/Tizen.Maps/Interop/Interop.Route.Maneuver.cs
@@ -51,41 +51,87 @@ internal static partial class Interop
StraightFork, // MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK
}
- internal static partial class RouteManeuver
+ [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(RouteManeuverHandle /* maps_route_maneuver_h */ origin, out IntPtr /* maps_route_maneuver_h */ cloned);
+ internal static extern ErrorCode Clone(IntPtr /* maps_route_maneuver_h */ origin, out IntPtr /* maps_route_maneuver_h */ cloned);
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_direction_id")]
- internal static extern ErrorCode GetDirectionId(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out RouteDirection /* maps_route_direction_e */ directionId);
+ internal string RoadName
+ {
+ get { return NativeGet(this.GetRoadName); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_turn_type")]
- internal static extern ErrorCode GetTurnType(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out RouteTurnType /* maps_route_turn_type_e */ turnType);
+ internal string Instruction
+ {
+ get { return NativeGet(this.GetInstructionText); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_position")]
- internal static extern ErrorCode GetPosition(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out IntPtr /* maps_coordinates_h */ position);
+ internal string Locale
+ {
+ get { return NativeGet(this.GetLocale); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_road_name")]
- internal static extern ErrorCode GetRoadName(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string roadName);
+ internal int TimeToNextInstruction
+ {
+ get { return NativeGet<int>(this.GetTimeToNextInstruction); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_instruction_text")]
- internal static extern ErrorCode GetInstructionText(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string instructionText);
+ internal double DistanceToNextInstruction
+ {
+ get { return NativeGet<double>(this.GetDistanceToNextInstruction); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_locale")]
- internal static extern ErrorCode GetLocale(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string locale);
+ internal RouteDirection Direction
+ {
+ get { return NativeGet<RouteDirection>(this.GetDirectionId); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_time_to_next_instruction")]
- internal static extern ErrorCode GetTimeToNextInstruction(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out int timeToNextInstruction);
+ internal RouteTurnType TurnType
+ {
+ get { return NativeGet<RouteTurnType>(this.GetTurnType); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_distance_to_next_instruction")]
- internal static extern ErrorCode GetDistanceToNextInstruction(RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out double distanceToNextInstruction);
- }
+ internal CoordinatesHandle Coordinates
+ {
+ get { return NativeGet(this.GetPosition, CoordinatesHandle.Create); }
+ }
- internal class RouteManeuverHandle : SafeMapsHandle
- {
- public RouteManeuverHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = RouteManeuver.Destroy; }
+ 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);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Route.Segment.cs b/Tizen.Maps/Interop/Interop.Route.Segment.cs
index c8c9811..7aa6493 100755
--- a/Tizen.Maps/Interop/Interop.Route.Segment.cs
+++ b/Tizen.Maps/Interop/Interop.Route.Segment.cs
@@ -19,44 +19,106 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class RouteSegment
+ [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 SegmentPathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
+ internal delegate bool PathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool SegmentManeuverCallback(int index, int total, IntPtr /* maps_route_maneuver_h */ maneuver, IntPtr /* void */ userData);
+ 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(RouteSegmentHandle /* maps_route_segment_h */ origin, out IntPtr /* maps_route_segment_h */ cloned);
+ internal static extern ErrorCode Clone(IntPtr /* maps_route_segment_h */ origin, out IntPtr /* maps_route_segment_h */ cloned);
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_origin")]
- internal static extern ErrorCode GetOrigin(RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_coordinates_h */ origin);
+ internal double Distance
+ {
+ get { return NativeGet<double>(this.GetDistance); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_destination")]
- internal static extern ErrorCode GetDestination(RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_coordinates_h */ destination);
+ internal long Duration
+ {
+ get { return NativeGet<long>(this.GetDuration); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_bounding_box")]
- internal static extern ErrorCode GetBoundingBox(RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_area_h */ boundingBox);
+ internal CoordinatesHandle Origin
+ {
+ get { return NativeGet(this.GetOrigin, CoordinatesHandle.Create); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_distance")]
- internal static extern ErrorCode GetDistance(RouteSegmentHandle /* maps_route_segment_h */ segment, out double distance);
+ internal CoordinatesHandle Destination
+ {
+ get { return NativeGet(this.GetDestination, CoordinatesHandle.Create); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_duration")]
- internal static extern ErrorCode GetDuration(RouteSegmentHandle /* maps_route_segment_h */ segment, out long duration);
+ internal AreaHandle BoundingBox
+ {
+ get { return NativeGet(this.GetBoundingBox, AreaHandle.Create); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_foreach_path")]
- internal static extern ErrorCode ForeachPath(RouteSegmentHandle /* maps_route_segment_h */ segment, SegmentPathCallback callback, IntPtr /* void */ userData);
+ public RouteSegmentHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_foreach_maneuver")]
- internal static extern ErrorCode ForeachManeuver(RouteSegmentHandle /* maps_route_segment_h */ segment, SegmentManeuverCallback callback, IntPtr /* void */ userData);
- }
+ internal static RouteSegmentHandle CloneFrom(IntPtr nativeHandle)
+ {
+ IntPtr handle;
+ Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
+ return new RouteSegmentHandle(handle, true);
+ }
- internal class RouteSegmentHandle : SafeMapsHandle
- {
- public RouteSegmentHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = RouteSegment.Destroy; }
+ 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");
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.Route.cs b/Tizen.Maps/Interop/Interop.Route.cs
index 23e0241..52eac7d 100755
--- a/Tizen.Maps/Interop/Interop.Route.cs
+++ b/Tizen.Maps/Interop/Interop.Route.cs
@@ -19,59 +19,136 @@ using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal static partial class Route
- {
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool RoutePropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool RoutePathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool RouteSegmentCallback(int index, int total, IntPtr /* maps_route_segment_h */ segment, IntPtr /* void */ userData);
+ [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_destroy")]
- internal static extern ErrorCode Destroy(IntPtr /* maps_route_h */ route);
+ [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_clone")]
- internal static extern ErrorCode Clone(RouteHandle /* maps_route_h */ origin, out IntPtr /* maps_route_h */ cloned);
+ [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_route_id")]
- internal static extern ErrorCode GetRouteId(RouteHandle /* maps_route_h */ route, out string routeId);
+ [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_origin")]
- internal static extern ErrorCode GetOrigin(RouteHandle /* maps_route_h */ route, out IntPtr /* maps_coordinates_h */ origin);
+ [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_destination")]
- internal static extern ErrorCode GetDestination(RouteHandle /* maps_route_h */ route, out IntPtr /* maps_coordinates_h */ destination);
+ [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_bounding_box")]
- internal static extern ErrorCode GetBoundingBox(RouteHandle /* maps_route_h */ route, out IntPtr /* maps_area_h */ boundingBox);
+ [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_transport_mode")]
- internal static extern ErrorCode GetTransportMode(RouteHandle /* maps_route_h */ route, out RouteTransportMode /* maps_route_transport_mode_e */ transportMode);
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_total_distance")]
- internal static extern ErrorCode GetTotalDistance(RouteHandle /* maps_route_h */ route, out double totalDistance);
+ internal class RouteHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData);
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_total_duration")]
- internal static extern ErrorCode GetTotalDuration(RouteHandle /* maps_route_h */ route, out long totalDuration);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool PathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData);
- [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_distance_unit")]
- internal static extern ErrorCode GetDistanceUnit(RouteHandle /* maps_route_h */ route, out DistanceUnit /* maps_distance_unit_e */ distanceUnit);
+ [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(RouteHandle /* maps_route_h */ route, RoutePropertiesCallback callback, IntPtr /* void */ userData);
+ 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(RouteHandle /* maps_route_h */ route, RoutePathCallback callback, IntPtr /* void */ userData);
+ 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(RouteHandle /* maps_route_h */ route, RouteSegmentCallback callback, IntPtr /* void */ userData);
- }
+ internal static extern ErrorCode ForeachSegment(IntPtr /* maps_route_h */ route, SegmentCallback callback, IntPtr /* void */ userData);
- internal class RouteHandle : SafeMapsHandle
- {
- public RouteHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Route.Destroy; }
+ [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");
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs b/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs
index 32ce999..43ae47c 100755
--- a/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs
+++ b/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs
@@ -15,33 +15,77 @@
*/
using System;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
internal static partial class Interop
{
- internal class SafeMapsHandle : SafeHandle
+ 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 string NativeGet(GetterMethod<string> getter, [CallerMemberName] string propertyName = "")
{
- public delegate ErrorCode HandleDestroy(IntPtr handle);
+ string value;
+ var err = getter(out value);
+ if (err.IsSuccess())
+ {
+ return value;
+ }
+
+ err.WarnIfFailed($"Native getter for {propertyName} failed");
+ return string.Empty;
+ }
- private bool _hasOwnership = true;
- protected HandleDestroy Destroy = null;
+ internal static void NativeSet<T>(SetterMethod<T> setter, T value, [CallerMemberName] string propertyName = "")
+ {
+ setter(value).WarnIfFailed($"Native setter for {propertyName} failed");
+ }
- internal SafeMapsHandle(IntPtr handle, bool ownsHandle = true) : base(handle, true)
+ 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 = ownsHandle;
+ HasOwnership = needToRelease;
+ DestroyHandle = destroy;
}
+
+ internal bool HasOwnership { get; set; }
+
public override bool IsInvalid { get { return handle == IntPtr.Zero; } }
- public bool IsValid { get { return IsInvalid == false; } }
- public void ReleaseOwnership() { _hasOwnership = false; }
protected override bool ReleaseHandle()
{
- if (_hasOwnership)
+ if (HasOwnership)
{
- var err = Destroy?.Invoke(handle);
- err?.WarnIfFailed(string.Format("Failed to delete native {0} handle", GetType()));
+ var err = DestroyHandle(handle);
+ err.WarnIfFailed($"Failed to delete native {GetType()} handle");
}
+
SetHandle(IntPtr.Zero);
return true;
}
diff --git a/Tizen.Maps/Interop/Interop.Service.cs b/Tizen.Maps/Interop/Interop.Service.cs
index 067f441..b8337c3 100755
--- a/Tizen.Maps/Interop/Interop.Service.cs
+++ b/Tizen.Maps/Interop/Interop.Service.cs
@@ -34,8 +34,7 @@ internal static partial class Interop
MultiReverseGeocode, // MAPS_SERVICE_MULTI_REVERSE_GEOCODE
SearchPlaceList, // MAPS_SERVICE_SEARCH_PLACE_LIST
SearchGetPlaceDetails, // MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS
-
- View = 0x100, // MAPS_SERVICE_VIEW
+ View, // MAPS_SERVICE_VIEW
ViewSnapshot, // MAPS_SERVICE_VIEW_SNAPSHOT
}
@@ -54,114 +53,143 @@ internal static partial class Interop
RoutePath, // MAPS_ROUTE_PATH
RouteSegmentsPath, // MAPS_ROUTE_SEGMENTS_PATH
RouteSegmentsManeuvers, // MAPS_ROUTE_SEGMENTS_MANEUVERS
-
- ViewTraffic = 0x100, // MAPS_VIEW_TRAFFIC
+ ViewTraffic, // MAPS_VIEW_TRAFFIC
ViewPublicTransit, // MAPS_VIEW_PUBLIC_TRANSIT
ViewBuilding, // MAPS_VIEW_BUILDING
ViewScalebar, // MAPS_VIEW_SCALEBAR
}
- internal static partial class Service
- {
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate bool ProviderInfoCallback(string mapsProvider, IntPtr /* void */ userData);
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void RequestUserConsentCallback(bool consented, string provider, IntPtr /* void */ userData);
+ [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 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 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 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 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 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 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 bool SearchRouteCallback(ErrorCode /* maps_error_e */ error, int requestId, int index, int total, IntPtr /* maps_route_h */ route, 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_cancel_request")]
+ internal static extern ErrorCode CancelRequest(this ServiceHandle /* maps_service_h */ maps, int requestId);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_request_user_consent")]
- internal static extern ErrorCode RequestUserConsent(string provider, RequestUserConsentCallback callback, IntPtr /* void */ userData);
+ [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_create")]
- internal static extern ErrorCode Create(string provider, out IntPtr /* maps_service_h */ maps);
+ [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_destroy")]
- internal static extern ErrorCode Destroy(IntPtr /* maps_service_h */ maps);
+ [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_set_provider_key")]
- internal static extern ErrorCode SetProviderKey(ServiceHandle /* maps_service_h */ maps, string providerKey);
+ [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_get_provider_key")]
- internal static extern ErrorCode GetProviderKey(ServiceHandle /* maps_service_h */ maps, out string providerKey);
+ [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_set_preference")]
- internal static extern ErrorCode SetPreference(ServiceHandle /* maps_service_h */ maps, PreferenceHandle /* maps_preference_h */ preference);
+ [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_get_preference")]
- internal static extern ErrorCode GetPreference(ServiceHandle /* maps_service_h */ maps, out IntPtr /* maps_preference_h */ preference);
+ [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_provider_is_service_supported")]
- internal static extern ErrorCode ProviderIsServiceSupported(ServiceHandle /* maps_service_h */ maps, ServiceType /* maps_service_e */ service, out bool supported);
+ [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_provider_is_data_supported")]
- internal static extern ErrorCode ProviderIsDataSupported(ServiceHandle /* maps_service_h */ maps, ServiceData /* maps_service_data_e */ data, out bool supported);
+ [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_cancel_request")]
- internal static extern ErrorCode CancelRequest(ServiceHandle /* maps_service_h */ maps, 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_geocode")]
- internal static extern ErrorCode Geocode(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_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_geocode_inside_area")]
- internal static extern ErrorCode GeocodeInsideArea(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_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_geocode_by_structured_address")]
- internal static extern ErrorCode GeocodeByStructuredAddress(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(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_set_provider_key")]
+ internal static extern ErrorCode SetProviderKey(this ServiceHandle /* maps_service_h */ maps, string providerKey);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_multi_reverse_geocode")]
- internal static extern ErrorCode MultiReverseGeocode(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_get_provider_key")]
+ internal static extern ErrorCode GetProviderKey(this ServiceHandle /* maps_service_h */ maps, out string providerKey);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place")]
- internal static extern ErrorCode SearchPlace(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_set_preference")]
+ internal static extern ErrorCode SetPreference(this ServiceHandle /* maps_service_h */ maps, PreferenceHandle /* maps_preference_h */ preference);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place_by_area")]
- internal static extern ErrorCode SearchPlaceByArea(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_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_search_place_by_address")]
- internal static extern ErrorCode SearchPlaceByAddress(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_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_search_place_list")]
- internal static extern ErrorCode SearchPlaceList(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_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_get_place_details")]
- internal static extern ErrorCode GetPlaceDetails(ServiceHandle /* maps_service_h */ maps, string uri, GetPlaceDetailsCallback callback, IntPtr /* void */ userData, out int requestId);
+ internal class ServiceHandle : SafeMapsHandle
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void RequestUserConsentCallback(bool consented, string provider, IntPtr /* void */ userData);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route")]
- internal static extern ErrorCode SearchRoute(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);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool ProviderInfoCallback(string mapsProvider, IntPtr /* void */ userData);
- [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route_waypoints")]
- internal static extern ErrorCode SearchRouteWaypoints(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_request_user_consent")]
+ internal static extern ErrorCode RequestUserConsent(string provider, RequestUserConsentCallback callback, IntPtr /* void */ userData);
- internal class ServiceHandle : SafeMapsHandle
- {
- public ServiceHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Service.Destroy; }
+ [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")]
+ 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 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");
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.View.Event.Data.cs b/Tizen.Maps/Interop/Interop.View.Event.Data.cs
index 2480582..003052c 100755
--- a/Tizen.Maps/Interop/Interop.View.Event.Data.cs
+++ b/Tizen.Maps/Interop/Interop.View.Event.Data.cs
@@ -16,6 +16,7 @@
using System;
using System.Runtime.InteropServices;
+using ElmSharp;
internal static partial class Interop
{
@@ -52,43 +53,127 @@ internal static partial class Interop
internal static partial class ViewEventData
{
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_destroy")]
- internal static extern ErrorCode Destroy(IntPtr /* maps_view_event_data_h */ viewEvent);
-
[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_type")]
- internal static extern ErrorCode GetType(IntPtr /* 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(IntPtr /* 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(IntPtr /* maps_view_event_data_h */ viewEvent, out ViewAction /* maps_view_action_e */ actionType);
-
[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_position")]
- internal static extern ErrorCode GetPosition(IntPtr /* maps_view_event_data_h */ viewEvent, out int x, out int y);
+ [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_coordinates")]
- internal static extern ErrorCode GetCoordinates(IntPtr /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_coordinates_h */ coordinates);
+ [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_fingers")]
- internal static extern ErrorCode GetFingers(IntPtr /* maps_view_event_data_h */ viewEvent, out int fingers);
+ [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_zoom_factor")]
- internal static extern ErrorCode GetZoomFactor(IntPtr /* maps_view_event_data_h */ viewEvent, out double zoomFactor);
+ [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_rotation_angle")]
- internal static extern ErrorCode GetRotationAngle(IntPtr /* maps_view_event_data_h */ viewEvent, out double rotationAngle);
+ [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(IntPtr /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_view_object_h */ viewEventDataObject);
+ [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); }
+ }
+
+ // 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)
+ {
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.View.Marker.cs b/Tizen.Maps/Interop/Interop.View.Marker.cs
new file mode 100755
index 0000000..f92ef87
--- /dev/null
+++ b/Tizen.Maps/Interop/Interop.View.Marker.cs
@@ -0,0 +1,102 @@
+/*
+ * 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;
+ }
+ }
+}
diff --git a/Tizen.Maps/Interop/Interop.View.Object.cs b/Tizen.Maps/Interop/Interop.View.Object.cs
index 79fc394..ed10c0a 100755
--- a/Tizen.Maps/Interop/Interop.View.Object.cs
+++ b/Tizen.Maps/Interop/Interop.View.Object.cs
@@ -16,6 +16,7 @@
using System;
using System.Runtime.InteropServices;
+using ElmSharp;
internal static partial class Interop
{
@@ -40,116 +41,33 @@ internal static partial class Interop
Box, // MAPS_VIEW_OVERLAY_BOX
}
- internal static partial class ViewObject
- {
- [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_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);
-
- [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_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_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);
+ [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_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);
+ [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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_type")]
- internal static extern ErrorCode GetType(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(ViewObjectHandle /* maps_view_object_h */ viewObject, bool visible);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_visible")]
- internal static extern ErrorCode GetVisible(ViewObjectHandle /* maps_view_object_h */ viewObject, out bool visible);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_polyline")]
- internal static extern ErrorCode PolylineSetPolyline(ViewObjectHandle /* maps_view_object_h */ polyline, CoordinatesListHandle /* maps_coordinates_list_h */ points);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_foreach_point")]
- internal static extern ErrorCode PolylineForeachPoint(ViewObjectHandle /* maps_view_object_h */ polyline, CoordinatesCallback callback, IntPtr /* void */ userData);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_color")]
- internal static extern ErrorCode PolylineSetColor(ViewObjectHandle /* 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 PolylineGetColor(ViewObjectHandle /* 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 PolylineSetWidth(ViewObjectHandle /* maps_view_object_h */ polyline, int width);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_get_width")]
- internal static extern ErrorCode PolylineGetWidth(ViewObjectHandle /* maps_view_object_h */ polyline, out int width);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_set_polygon")]
- internal static extern ErrorCode PolygonSetPolygon(ViewObjectHandle /* maps_view_object_h */ polygon, CoordinatesListHandle /* maps_coordinates_list_h */ points);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_foreach_point")]
- internal static extern ErrorCode PolygonForeachPoint(ViewObjectHandle /* maps_view_object_h */ polygon, CoordinatesCallback callback, IntPtr /* void */ userData);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_set_fill_color")]
- internal static extern ErrorCode PolygonSetFillColor(ViewObjectHandle /* maps_view_object_h */ polygon, byte r, byte g, byte b, byte a);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_get_fill_color")]
- internal static extern ErrorCode PolygonGetFillColor(ViewObjectHandle /* maps_view_object_h */ polygon, out byte r, out byte g, out byte b, out byte a);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_coordinates")]
- internal static extern ErrorCode MarkerSetCoordinates(ViewObjectHandle /* maps_view_object_h */ marker, CoordinatesHandle /* maps_coordinates_h */ coordinates);
+ internal bool IsVisible
+ {
+ get { return NativeGet<bool>(this.GetVisible); }
+ set { NativeSet(this.SetVisible, value); }
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_resize")]
- internal static extern ErrorCode MarkerResize(ViewObjectHandle /* maps_view_object_h */ marker, int width, int height);
+ public ViewObjectHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
+ {
+ }
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_image_file")]
- internal static extern ErrorCode MarkerSetImageFile(ViewObjectHandle /* maps_view_object_h */ marker, string filePath);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_image_file")]
- internal static extern ErrorCode MarkerGetImageFile(ViewObjectHandle /* maps_view_object_h */ marker, out string filePath);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_coordinates")]
- internal static extern ErrorCode MarkerGetCoordinates(ViewObjectHandle /* maps_view_object_h */ marker, out IntPtr /* maps_coordinates_h */ coordinates);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_size")]
- internal static extern ErrorCode MarkerGetSize(ViewObjectHandle /* maps_view_object_h */ marker, out int width, out int height);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_type")]
- internal static extern ErrorCode MarkerGetType(ViewObjectHandle /* maps_view_object_h */ marker, out ViewMarkerType /* maps_view_marker_type_e */ type);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_z_order")]
- internal static extern ErrorCode MarkerSetZOrder(ViewObjectHandle /* maps_view_object_h */ marker, int zOrder);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_z_order")]
- internal static extern ErrorCode MarkerGetZOrder(ViewObjectHandle /* maps_view_object_h */ marker, out int zOrder);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_object")]
- internal static extern ErrorCode OverlayGetObject(ViewObjectHandle /* maps_view_object_h */ overlay, out IntPtr viewObject);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_coordinates")]
- internal static extern ErrorCode OverlaySetCoordinates(ViewObjectHandle /* maps_view_object_h */ overlay, CoordinatesHandle /* maps_coordinates_h */ coordinates);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_coordinates")]
- internal static extern ErrorCode OverlayGetCoordinates(ViewObjectHandle /* 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 OverlaySetMinZoomLevel(ViewObjectHandle /* maps_view_object_h */ overlay, int zoom);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_min_zoom_level")]
- internal static extern ErrorCode OverlayGetMinZoomLevel(ViewObjectHandle /* maps_view_object_h */ overlay, out int zoom);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_max_zoom_level")]
- internal static extern ErrorCode OverlaySetMaxZoomLevel(ViewObjectHandle /* maps_view_object_h */ overlay, int zoom);
-
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_max_zoom_level")]
- internal static extern ErrorCode OverlayGetMaxZoomLevel(ViewObjectHandle /* maps_view_object_h */ overlay, out int zoom);
- }
-
- internal class ViewObjectHandle : SafeMapsHandle
- {
- public ViewObjectHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = ViewObject.Destroy; }
+ internal static ViewObjectHandle Create(IntPtr nativeHandle)
+ {
+ return new ViewObjectHandle(nativeHandle, true);
+ }
}
}
diff --git a/Tizen.Maps/Interop/Interop.View.Overlay.cs b/Tizen.Maps/Interop/Interop.View.Overlay.cs
new file mode 100755
index 0000000..27ed8b7
--- /dev/null
+++ b/Tizen.Maps/Interop/Interop.View.Overlay.cs
@@ -0,0 +1,72 @@
+/*
+ * 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;
+ }
+ }
+}
diff --git a/Tizen.Maps/Interop/Interop.View.Polygon.cs b/Tizen.Maps/Interop/Interop.View.Polygon.cs
new file mode 100755
index 0000000..5699b0e
--- /dev/null
+++ b/Tizen.Maps/Interop/Interop.View.Polygon.cs
@@ -0,0 +1,79 @@
+/*
+ * 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");
+ }
+ }
+}
diff --git a/Tizen.Maps/Interop/Interop.View.Polyline.cs b/Tizen.Maps/Interop/Interop.View.Polyline.cs
new file mode 100755
index 0000000..0ceae65
--- /dev/null
+++ b/Tizen.Maps/Interop/Interop.View.Polyline.cs
@@ -0,0 +1,91 @@
+/*
+ * 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");
+ }
+ }
+}
diff --git a/Tizen.Maps/Interop/Interop.View.cs b/Tizen.Maps/Interop/Interop.View.cs
index 9e23a38..4990529 100755
--- a/Tizen.Maps/Interop/Interop.View.cs
+++ b/Tizen.Maps/Interop/Interop.View.cs
@@ -16,6 +16,7 @@
using System;
using System.Runtime.InteropServices;
+using ElmSharp;
internal static partial class Interop
{
@@ -27,140 +28,231 @@ internal static partial class Interop
Hybrid, // MAPS_VIEW_TYPE_HYBRID
}
- internal static partial class View
- {
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void ViewOnEventCallback(ViewEventType /* maps_view_event_type_e */ type, IntPtr /* maps_view_event_data_h */ eventData, IntPtr /* void */ userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ViewOnEventCallback(ViewEventType /* maps_view_event_type_e */ type, IntPtr /* maps_view_event_data_h */ eventData, IntPtr /* void */ userData);
- [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_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_get_zoom_level")]
+ internal static extern ErrorCode GetZoomLevel(this ViewHandle /* maps_view_h */ view, out int level);
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_destroy")]
- internal static extern ErrorCode Destroy(IntPtr /* maps_view_h */ view);
+ [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_set_center")]
- internal static extern ErrorCode SetCenter(ViewHandle /* maps_view_h */ view, CoordinatesHandle /* maps_coordinates_h */ coordinates);
+ [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_get_center")]
- internal static extern ErrorCode GetCenter(ViewHandle /* maps_view_h */ view, out IntPtr /* maps_coordinates_h */ coordinates);
+ [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_set_zoom_level")]
- internal static extern ErrorCode SetZoomLevel(ViewHandle /* maps_view_h */ view, int level);
+ [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_get_zoom_level")]
- internal static extern ErrorCode GetZoomLevel(ViewHandle /* maps_view_h */ view, out int level);
+ [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_set_min_zoom_level")]
- internal static extern ErrorCode SetMinZoomLevel(ViewHandle /* maps_view_h */ view, int level);
+ [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_get_min_zoom_level")]
- internal static extern ErrorCode GetMinZoomLevel(ViewHandle /* maps_view_h */ view, out int minZoomLevel);
+ [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_set_max_zoom_level")]
- internal static extern ErrorCode SetMaxZoomLevel(ViewHandle /* maps_view_h */ view, int level);
+ [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_get_max_zoom_level")]
- internal static extern ErrorCode GetMaxZoomLevel(ViewHandle /* maps_view_h */ view, out int maxZoomLevel);
+ [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_orientation")]
- internal static extern ErrorCode SetOrientation(ViewHandle /* maps_view_h */ view, double angle);
+ [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_orientation")]
- internal static extern ErrorCode GetOrientation(ViewHandle /* maps_view_h */ view, out double rotationAngle);
+ [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_screen_to_geolocation")]
- internal static extern ErrorCode ScreenToGeolocation(ViewHandle /* maps_view_h */ view, int x, int y, out IntPtr /* maps_coordinates_h */ coordinates);
+ [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_geolocation_to_screen")]
- internal static extern ErrorCode GeolocationToScreen(ViewHandle /* maps_view_h */ view, CoordinatesHandle /* maps_coordinates_h */ coordinates, out int x, out int y);
+ [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_set_type")]
- internal static extern ErrorCode SetType(ViewHandle /* maps_view_h */ view, ViewType /* maps_view_type_e */ type);
+ [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_get_type")]
- internal static extern ErrorCode GetType(ViewHandle /* maps_view_h */ view, out ViewType /* maps_view_type_e */ type);
+ [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_set_buildings_enabled")]
- internal static extern ErrorCode SetBuildingsEnabled(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_get_buildings_enabled")]
- internal static extern ErrorCode GetBuildingsEnabled(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_set_traffic_enabled")]
- internal static extern ErrorCode SetTrafficEnabled(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_get_traffic_enabled")]
- internal static extern ErrorCode GetTrafficEnabled(ViewHandle /* maps_view_h */ view, out bool enable);
+ [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_set_public_transit_enabled")]
- internal static extern ErrorCode SetPublicTransitEnabled(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_get_public_transit_enabled")]
- internal static extern ErrorCode GetPublicTransitEnabled(ViewHandle /* maps_view_h */ view, out bool enable);
+ [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_set_language")]
- internal static extern ErrorCode SetLanguage(ViewHandle /* maps_view_h */ view, string language);
+ [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_get_language")]
- internal static extern ErrorCode GetLanguage(ViewHandle /* maps_view_h */ view, out string language);
+ [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_set_scalebar_enabled")]
- internal static extern ErrorCode SetScalebarEnabled(ViewHandle /* maps_view_h */ view, bool enable);
+ [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_scalebar_enabled")]
- internal static extern ErrorCode GetScalebarEnabled(ViewHandle /* maps_view_h */ view, out bool enabled);
+ [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_get_viewport")]
- internal static extern ErrorCode GetViewport(ViewHandle /* maps_view_h */ view, out IntPtr viewport);
+ [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_set_screen_location")]
- internal static extern ErrorCode SetScreenLocation(ViewHandle /* maps_view_h */ view, int x, int y, int width, int height);
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_screen_location")]
- internal static extern ErrorCode GetScreenLocation(ViewHandle /* maps_view_h */ view, out int x, out int y, out int width, out int height);
+ [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_move")]
- internal static extern ErrorCode Move(ViewHandle /* maps_view_h */ view, int x, int y);
+ [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_resize")]
- internal static extern ErrorCode Resize(ViewHandle /* maps_view_h */ view, int width, int height);
+ [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_set_visibility")]
- internal static extern ErrorCode SetVisibility(ViewHandle /* maps_view_h */ view, bool visible);
+ [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_get_visibility")]
- internal static extern ErrorCode GetVisibility(ViewHandle /* maps_view_h */ view, out bool visible);
+ [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_set_event_cb")]
- internal static extern ErrorCode SetEventCb(ViewHandle /* maps_view_h */ view, ViewEventType /* maps_view_event_type_e */ type, ViewOnEventCallback callback, IntPtr /* void */ userData);
+ [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_unset_event_cb")]
- internal static extern ErrorCode UnsetEventCb(ViewHandle /* maps_view_h */ view, ViewEventType /* maps_view_event_type_e */ type);
+ [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_set_gesture_enabled")]
- internal static extern ErrorCode SetGestureEnabled(ViewHandle /* maps_view_h */ view, ViewGesture /* maps_view_gesture_e */ gesture, bool enabled);
+ [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_get_gesture_enabled")]
- internal static extern ErrorCode GetGestureEnabled(ViewHandle /* maps_view_h */ view, ViewGesture /* maps_view_gesture_e */ gesture, out bool enabled);
+ [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_add_object")]
- internal static extern ErrorCode AddObject(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_object")]
- internal static extern ErrorCode RemoveObject(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);
- [DllImport(Libraries.MapService, EntryPoint = "maps_view_remove_all_objects")]
- internal static extern ErrorCode RemoveAllObjects(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);
- }
- internal class ViewHandle : SafeMapsHandle
- {
- public ViewHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = View.Destroy; }
+ [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 geo-coordinates");
+ return CoordinatesHandle.Create(coordinates);
+ }
+
+ internal Point GeolocationToScreen(CoordinatesHandle coordinates)
+ {
+ int x, y;
+ this.GeolocationToScreen(coordinates, out x, out y).WarnIfFailed("Failed to convert geo-coordinate to screen position");
+ return new Point() { X = x, Y = y };
+ }
}
}
diff --git a/Tizen.Maps/Tizen.Maps.Net45.csproj b/Tizen.Maps/Tizen.Maps.Net45.csproj
index dbddb36..65f0996 100755
--- a/Tizen.Maps/Tizen.Maps.Net45.csproj
+++ b/Tizen.Maps/Tizen.Maps.Net45.csproj
@@ -47,14 +47,23 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Interop\Interop.AddressList.cs" />
+ <Compile Include="Interop\Interop.CoordinatesList.cs" />
+ <Compile Include="Interop\Interop.PlaceList.cs" />
<Compile Include="Interop\Interop.SafeMapsHandle.cs" />
+ <Compile Include="Interop\Interop.View.Marker.cs" />
+ <Compile Include="Interop\Interop.View.Overlay.cs" />
+ <Compile Include="Interop\Interop.View.Polygon.cs" />
+ <Compile Include="Interop\Interop.View.Polyline.cs" />
+ <Compile Include="Tizen.Maps\IGeocodePreference.cs" />
+ <Compile Include="Tizen.Maps\IPlaceSearchPreference.cs" />
+ <Compile Include="Tizen.Maps\IRouteSearchPreference.cs" />
<Compile Include="Tizen.Maps\MapView.cs" />
<Compile Include="Tizen.Maps\GestureType.cs" />
<Compile Include="Tizen.Maps\Overlay.cs" />
<Compile Include="Tizen.Maps\Polygon.cs" />
<Compile Include="Tizen.Maps\Polyline.cs" />
<Compile Include="Tizen.Maps\MapGestureEventArgs.cs" />
- <Compile Include="Tizen.Maps\MapObjectEventArgs.cs" />
<Compile Include="Tizen.Maps\MapObject.cs" />
<Compile Include="Tizen.Maps\MapTypes.cs" />
<Compile Include="Tizen.Maps\Marker.cs" />
@@ -91,7 +100,6 @@
<Compile Include="Tizen.Maps\GeocoordinatesList.cs" />
<Compile Include="Tizen.Maps\Direction.cs" />
<Compile Include="Tizen.Maps\DistanceUnit.cs" />
- <Compile Include="Tizen.Maps\GeocodePreference.cs" />
<Compile Include="Tizen.Maps\GeocodeRequest.cs" />
<Compile Include="Tizen.Maps\MapService.cs" />
<Compile Include="Tizen.Maps\MapServiceRequest.cs" />
@@ -107,7 +115,6 @@
<Compile Include="Tizen.Maps\PlaceList.cs" />
<Compile Include="Tizen.Maps\PlaceMedia.cs" />
<Compile Include="Tizen.Maps\PlaceRating.cs" />
- <Compile Include="Tizen.Maps\PlaceSearchPreference.cs" />
<Compile Include="Tizen.Maps\PlaceSearchRequest.cs" />
<Compile Include="Tizen.Maps\PlaceReview.cs" />
<Compile Include="Tizen.Maps\ReverseGeocodeRequest.cs" />
@@ -116,9 +123,9 @@
<Compile Include="Tizen.Maps\RouteFeatureWeight.cs" />
<Compile Include="Tizen.Maps\RouteManeuver.cs" />
<Compile Include="Tizen.Maps\RouteOptimization.cs" />
- <Compile Include="Tizen.Maps\RouteSearchPreference.cs" />
<Compile Include="Tizen.Maps\RouteSearchRequest.cs" />
<Compile Include="Tizen.Maps\RouteSegment.cs" />
+ <Compile Include="Tizen.Maps\SearchPreference.cs" />
<Compile Include="Tizen.Maps\ServiceRequestType.cs" />
<Compile Include="Tizen.Maps\ServiceData.cs" />
<Compile Include="Tizen.Maps\SnapshotType.cs" />
diff --git a/Tizen.Maps/Tizen.Maps.csproj b/Tizen.Maps/Tizen.Maps.csproj
index b5fd579..309b02f 100755
--- a/Tizen.Maps/Tizen.Maps.csproj
+++ b/Tizen.Maps/Tizen.Maps.csproj
@@ -52,14 +52,23 @@
<None Include="Tizen.Maps.snk" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Interop\Interop.AddressList.cs" />
+ <Compile Include="Interop\Interop.CoordinatesList.cs" />
+ <Compile Include="Interop\Interop.PlaceList.cs" />
<Compile Include="Interop\Interop.SafeMapsHandle.cs" />
+ <Compile Include="Interop\Interop.View.Marker.cs" />
+ <Compile Include="Interop\Interop.View.Overlay.cs" />
+ <Compile Include="Interop\Interop.View.Polygon.cs" />
+ <Compile Include="Interop\Interop.View.Polyline.cs" />
+ <Compile Include="Tizen.Maps\IGeocodePreference.cs" />
+ <Compile Include="Tizen.Maps\IPlaceSearchPreference.cs" />
+ <Compile Include="Tizen.Maps\IRouteSearchPreference.cs" />
<Compile Include="Tizen.Maps\MapView.cs" />
<Compile Include="Tizen.Maps\GestureType.cs" />
<Compile Include="Tizen.Maps\Overlay.cs" />
<Compile Include="Tizen.Maps\Polygon.cs" />
<Compile Include="Tizen.Maps\Polyline.cs" />
<Compile Include="Tizen.Maps\MapGestureEventArgs.cs" />
- <Compile Include="Tizen.Maps\MapObjectEventArgs.cs" />
<Compile Include="Tizen.Maps\MapObject.cs" />
<Compile Include="Tizen.Maps\MapTypes.cs" />
<Compile Include="Tizen.Maps\Marker.cs" />
@@ -96,7 +105,6 @@
<Compile Include="Tizen.Maps\GeocoordinatesList.cs" />
<Compile Include="Tizen.Maps\Direction.cs" />
<Compile Include="Tizen.Maps\DistanceUnit.cs" />
- <Compile Include="Tizen.Maps\GeocodePreference.cs" />
<Compile Include="Tizen.Maps\GeocodeRequest.cs" />
<Compile Include="Tizen.Maps\MapService.cs" />
<Compile Include="Tizen.Maps\MapServiceRequest.cs" />
@@ -112,7 +120,6 @@
<Compile Include="Tizen.Maps\PlaceList.cs" />
<Compile Include="Tizen.Maps\PlaceMedia.cs" />
<Compile Include="Tizen.Maps\PlaceRating.cs" />
- <Compile Include="Tizen.Maps\PlaceSearchPreference.cs" />
<Compile Include="Tizen.Maps\PlaceSearchRequest.cs" />
<Compile Include="Tizen.Maps\PlaceReview.cs" />
<Compile Include="Tizen.Maps\ReverseGeocodeRequest.cs" />
@@ -121,9 +128,9 @@
<Compile Include="Tizen.Maps\RouteFeatureWeight.cs" />
<Compile Include="Tizen.Maps\RouteManeuver.cs" />
<Compile Include="Tizen.Maps\RouteOptimization.cs" />
- <Compile Include="Tizen.Maps\RouteSearchPreference.cs" />
<Compile Include="Tizen.Maps\RouteSearchRequest.cs" />
<Compile Include="Tizen.Maps\RouteSegment.cs" />
+ <Compile Include="Tizen.Maps\SearchPreference.cs" />
<Compile Include="Tizen.Maps\ServiceRequestType.cs" />
<Compile Include="Tizen.Maps\ServiceData.cs" />
<Compile Include="Tizen.Maps\SnapshotType.cs" />
diff --git a/Tizen.Maps/Tizen.Maps.nuspec b/Tizen.Maps/Tizen.Maps.nuspec
index 246fb7f..bd9303a 100644
--- a/Tizen.Maps/Tizen.Maps.nuspec
+++ b/Tizen.Maps/Tizen.Maps.nuspec
@@ -6,7 +6,7 @@
<authors>Tizen Developers</authors>
<description>Map Services API for Tizen.Net</description>
<dependencies>
- <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen" version="1.0.2" />
</dependencies>
</metadata>
<files>
diff --git a/Tizen.Maps/Tizen.Maps/Area.cs b/Tizen.Maps/Tizen.Maps/Area.cs
index 318fa98..20a3981 100755
--- a/Tizen.Maps/Tizen.Maps/Area.cs
+++ b/Tizen.Maps/Tizen.Maps/Area.cs
@@ -21,7 +21,7 @@ namespace Tizen.Maps
/// <summary>
/// Class representing geographical area
/// </summary>
- public class Area
+ public class Area : IDisposable
{
internal Interop.AreaHandle handle;
@@ -40,11 +40,7 @@ namespace Tizen.Maps
err.ThrowIfFailed("Need valid coordinates, given null");
}
- IntPtr nativeHandle;
- err = Interop.Area.CreateRectangle(topLeft.handle, bottomRight.handle, out nativeHandle);
- err.ThrowIfFailed("Failed to create native rectangular area handle");
-
- handle = new Interop.AreaHandle(nativeHandle);
+ handle = new Interop.AreaHandle(topLeft.handle, bottomRight.handle);
}
/// <summary>
@@ -62,16 +58,30 @@ namespace Tizen.Maps
err.ThrowIfFailed("Need valid center coordinates, given null");
}
- IntPtr nativeHandle;
- err = Interop.Area.CreateCircle(center.handle, radius, out nativeHandle);
- err.ThrowIfFailed("Failed to create native circular area handle");
+ handle = new Interop.AreaHandle(center.handle, radius);
+ }
+
+ internal Area(Interop.AreaHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
- handle = new Interop.AreaHandle(nativeHandle);
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
}
- internal Area(IntPtr nativeHandle)
+ public void Dispose()
{
- handle = new Interop.AreaHandle(nativeHandle);
+ Dispose(true);
}
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/GeocodePreference.cs b/Tizen.Maps/Tizen.Maps/GeocodePreference.cs
deleted file mode 100755
index da7786d..0000000
--- a/Tizen.Maps/Tizen.Maps/GeocodePreference.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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>
- /// Preferences for Geocode service requests
- /// </summary>
- public class GeocodePreference
- {
- internal Interop.PreferenceHandle handle;
-
- private string _language = string.Empty;
-
- /// <summary>
- /// Constructor for search preference
- /// </summary>
- public GeocodePreference()
- {
- IntPtr nativeHandle;
- var err = Interop.Preference.Create(out nativeHandle);
- if(err.ThrowIfFailed("Failed to create native preference handle"))
- {
- handle = new Interop.PreferenceHandle(nativeHandle);
- }
- }
-
- /// <summary>
- /// Preferred language
- /// </summary>
- /// <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 e.g. "ko-KR"
- /// </remarks>
- public string Language
- {
- get
- {
- if (string.IsNullOrEmpty(_language))
- {
- string language;
- var err = Interop.Preference.GetLanguage(handle, out language);
- if (err.WarnIfFailed("Failed to get language for this preference"))
- {
- _language = language;
- }
- }
- return _language;
- }
- set
- {
- var err = Interop.Preference.SetLanguage(handle, value == null ? "" : value);
- if (err.WarnIfFailed("Failed to set language for this preference"))
- {
- _language = value;
- }
- }
- }
-
- /// <summary>
- /// Maximum result count for a service request
- /// </summary>
- /// <remarks>Setting negative value will not have any effect on MaxResults value</remarks>
- public int MaxResults
- {
- get
- {
- int _maxResults = 0;
- var err = Interop.Preference.GetMaxResults(handle, out _maxResults);
- err.WarnIfFailed("Failed to get max result count for this preference");
- return _maxResults;
- }
- set
- {
- var err = Interop.Preference.SetMaxResults(handle, value);
- err.WarnIfFailed("Failed to set max result count for this preference");
- }
- }
- }
-}
diff --git a/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs b/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs
index 37c9eef..f67e9be 100755
--- a/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs
+++ b/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs
@@ -24,17 +24,16 @@ namespace Tizen.Maps
/// </summary>
public class GeocodeRequest : MapServiceRequest<Geocoordinates>
{
- private Interop.Service.GeocodeCallback _responseCallback;
+ private Interop.GeocodeCallback _geocodeCallback;
private List<Geocoordinates> _coordinateList = new List<Geocoordinates>();
- private GeocodePreference _preferences = new GeocodePreference();
internal GeocodeRequest(MapService service, string address) : this(service, ServiceRequestType.Geocode)
{
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get co-ordinates for given address {0}", address);
- errorCode = Interop.Service.Geocode(_service, address, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ errMessage = $"Failed to get co-ordinates 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));
@@ -48,8 +47,8 @@ namespace Tizen.Maps
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get co-ordinates for given address {0}", address);
- errorCode = Interop.Service.GeocodeInsideArea(_service, address, boundry.handle, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ errMessage = $"Failed to get co-ordinates 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));
@@ -63,8 +62,8 @@ namespace Tizen.Maps
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get co-ordinates for given address {0}", address);
- errorCode = Interop.Service.GeocodeByStructuredAddress(_service, address.handle, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ errMessage = $"Failed to get co-ordinates 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));
@@ -75,12 +74,14 @@ namespace Tizen.Maps
private GeocodeRequest(MapService service, ServiceRequestType type) : base(service, type)
{
- _preferences = service.GeocodePreferences;
- _responseCallback = (result, id, index, total, coordinatesHandle, userData) =>
+ // 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)
{
@@ -90,7 +91,8 @@ namespace Tizen.Maps
}
else
{
- _requestTask?.TrySetException(errorCode.GetException(errMessage));
+ // If search is failed, the value of total is 0 and coordinates is NULL
+ _requestTask?.TrySetException(result.GetException(errMessage));
return false;
}
};
diff --git a/Tizen.Maps/Tizen.Maps/Geocoordinates.cs b/Tizen.Maps/Tizen.Maps/Geocoordinates.cs
index 7beb857..340e91d 100755
--- a/Tizen.Maps/Tizen.Maps/Geocoordinates.cs
+++ b/Tizen.Maps/Tizen.Maps/Geocoordinates.cs
@@ -21,7 +21,7 @@ namespace Tizen.Maps
/// <summary>
/// Class representing geographical co-ordinates
/// </summary>
- public class Geocoordinates
+ public class Geocoordinates : IDisposable
{
internal Interop.CoordinatesHandle handle;
@@ -34,42 +34,57 @@ namespace Tizen.Maps
/// <exception cref="System.InvalidOperationException">Throws if native operation failed to allocate memory</exception>
public Geocoordinates(double latitude, double longitude)
{
- IntPtr nativeHandle;
- var err = Interop.Coordinates.Create(latitude, longitude, out nativeHandle);
- if (err.ThrowIfFailed("Failed to create native coordinate handle"))
- {
- handle = new Interop.CoordinatesHandle(nativeHandle);
- Latitude = latitude;
- Longitude = longitude;
- }
+ handle = new Interop.CoordinatesHandle(latitude, longitude);
}
- internal Geocoordinates(IntPtr nativeHandle)
+ internal Geocoordinates(Interop.CoordinatesHandle nativeHandle)
{
- double latitude;
- double longitude;
- handle = new Interop.CoordinatesHandle(nativeHandle);
- var err = Interop.Coordinates.GetLatitudeLongitude(handle, out latitude, out longitude);
- if (err.ThrowIfFailed("Failed to get coordinate value using native handle"))
- {
- Latitude = latitude;
- Longitude = longitude;
- }
+ handle = nativeHandle;
}
/// <summary>
/// Latitude for this coordinate
/// </summary>
- public double Latitude { get; }
+ public double Latitude
+ {
+ get
+ {
+ return handle.Latitude;
+ }
+ }
/// <summary>
/// Longitude for this coordinate
/// </summary>
- public double Longitude { get; }
+ public double Longitude
+ {
+ get
+ {
+ return handle.Longitude;
+ }
+ }
public override string ToString()
{
- return string.Format("Geocoordinates(Lat: {0}, Lon: {1})", Latitude, Longitude);
+ return $"[{Latitude}, {Longitude}]";
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
}
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs b/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs
index 9757f67..96bc778 100755
--- a/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs
+++ b/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs
@@ -22,29 +22,16 @@ namespace Tizen.Maps
/// <summary>
/// List of <see cref="Geocoordinates"/> objects to be used in <see cref="MapService"/> APIs
/// </summary>
- internal class GeocoordinatesList
+ internal class GeocoordinatesList : IDisposable
{
internal Interop.CoordinatesListHandle handle;
- internal GeocoordinatesList(IEnumerable<Geocoordinates> coordinateList, bool ownsHandle)
+ internal GeocoordinatesList(IEnumerable<Geocoordinates> coordinateList, bool ownerShip = false)
{
- IntPtr nativeHandle;
- var err = Interop.Coordinates.ListCreate(out nativeHandle);
- err.ThrowIfFailed("Failed to create native handle for coordinate list");
-
- handle = new Interop.CoordinatesListHandle(nativeHandle, ownsHandle);
+ handle = new Interop.CoordinatesListHandle(ownerShip);
foreach (var coordinates in coordinateList)
{
- IntPtr clonedNativeHandle;
- err = Interop.Coordinates.Clone(coordinates.handle, out clonedNativeHandle);
- err.WarnIfFailed("Failed to clone native handle for coordinates");
-
- Interop.CoordinatesHandle clonedHandle = new Interop.CoordinatesHandle(clonedNativeHandle);
- err = Interop.Coordinates.ListAppend(handle, clonedHandle);
- if (err.WarnIfFailed("Failed to add coordinate to the list"))
- {
- clonedHandle.ReleaseOwnership();
- }
+ handle.Add(coordinates.handle);
}
}
@@ -56,22 +43,27 @@ namespace Tizen.Maps
get
{
List<Geocoordinates> list = new List<Geocoordinates>();
- Interop.Coordinates.CoordinatesCallback callback = (index, handle, userData) =>
- {
- IntPtr clonedNativeHandle;
- var result = Interop.Coordinates.Clone(handle, out clonedNativeHandle);
- if (result.WarnIfFailed("Failed to add coordinate to the list"))
- {
- Interop.CoordinatesHandle clonedHandle = new Interop.CoordinatesHandle(clonedNativeHandle);
- list.Add(new Geocoordinates(clonedHandle));
- }
- return true;
- };
-
- var err = Interop.Coordinates.ListForeach(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get coordinates list from native handle");
+ 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;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs b/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs
new file mode 100755
index 0000000..c3410a5
--- /dev/null
+++ b/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs
@@ -0,0 +1,39 @@
+/*
+ * 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>
+ public interface IGeocodePreference
+ {
+ /// <summary>
+ /// Preferred language
+ /// </summary>
+ /// <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 e.g. "ko-KR"
+ /// </remarks>
+ string Language { get; set; }
+
+ /// <summary>
+ /// Maximum result count for a service request
+ /// </summary>
+ /// <remarks>Setting negative value will not have any effect on MaxResults value</remarks>
+ int MaxResults { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Tizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs b/Tizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs
new file mode 100755
index 0000000..771377f
--- /dev/null
+++ b/Tizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs
@@ -0,0 +1,55 @@
+/*
+ * 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>
+ public interface IPlaceSearchPreference
+ {
+ /// <summary>
+ /// Distance unit
+ /// </summary>
+ DistanceUnit Unit { get; set; }
+
+ /// <summary>
+ /// Preferred language
+ /// </summary>
+ /// <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 e.g. "ko-KR"
+ /// </remarks>
+ string Language { get; set; }
+
+ /// <summary>
+ /// Maximum result count for a service request
+ /// </summary>
+ int MaxResults { get; set; }
+
+ /// <summary>
+ /// Preferred country
+ /// </summary>
+ string CountryCode { get; set; }
+
+ /// <summary>
+ /// Search properties as key value pair
+ /// </summary>
+ IReadOnlyDictionary<string, string> Properties { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Tizen.Maps/Tizen.Maps/IRouteSearchPreference.cs b/Tizen.Maps/Tizen.Maps/IRouteSearchPreference.cs
new file mode 100755
index 0000000..0beaf09
--- /dev/null
+++ b/Tizen.Maps/Tizen.Maps/IRouteSearchPreference.cs
@@ -0,0 +1,55 @@
+/*
+ * 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>
+ public interface IRouteSearchPreference
+ {
+ /// <summary>
+ /// Distance unit
+ /// </summary>
+ DistanceUnit Unit { get; set; }
+
+ /// <summary>
+ /// Selected route optimization
+ /// </summary>
+ RouteOptimization Optimization { get; set; }
+
+ /// <summary>
+ /// Route transport mode
+ /// </summary>
+ TransportMode Mode { get; set; }
+
+ /// <summary>
+ /// Route feature weight
+ /// </summary>
+ RouteFeatureWeight RouteFeatureWeight { get; set; }
+
+ /// <summary>
+ /// Route feature
+ /// </summary>
+ RouteFeature RouteFeature { get; set; }
+
+ /// <summary>
+ /// Indicate if search for alternative routes is enabled.
+ /// </summary>
+ bool SearchAlternativeRoutes { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs b/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs
index 4b31650..f3804a8 100755
--- a/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs
+++ b/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs
@@ -24,35 +24,17 @@ namespace Tizen.Maps
/// </summary>
public class MapGestureEventArgs : EventArgs
{
- internal static MapGestureEventArgs Create(IntPtr nativeHandle)
+ internal MapGestureEventArgs(IntPtr nativeHandle)
{
- Interop.ViewGesture type;
- Point screenCoordinate = new Point();
- int touchCount;
- double zoomFactor;
- double rotationAngle;
- Geocoordinates coordinates;
-
- Interop.ViewEventData.GetGestureType(nativeHandle, out type);
- Interop.ViewEventData.GetPosition(nativeHandle, out screenCoordinate.X, out screenCoordinate.Y);
- Interop.ViewEventData.GetFingers(nativeHandle, out touchCount);
- Interop.ViewEventData.GetZoomFactor(nativeHandle, out zoomFactor);
- Interop.ViewEventData.GetRotationAngle(nativeHandle, out rotationAngle);
-
- IntPtr coordinate;
- Interop.ViewEventData.GetCoordinates(nativeHandle, out coordinate);
- coordinates = new Geocoordinates(coordinate);
- return new MapGestureEventArgs((GestureType)type, screenCoordinate, coordinates, touchCount, zoomFactor, rotationAngle);
- }
-
- internal MapGestureEventArgs(GestureType type, Point screenCoordinate, Geocoordinates geocoordinates, int touchCount, double zoomFactor, double rotationAngle)
- {
- GestureType = type;
- Position = screenCoordinate;
- Geocoordinates = geocoordinates;
- TouchCount = touchCount;
- ZoomFactor = zoomFactor;
- RotationAngle = rotationAngle;
+ 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>
diff --git a/Tizen.Maps/Tizen.Maps/MapObject.cs b/Tizen.Maps/Tizen.Maps/MapObject.cs
index 4206e5d..53aed4e 100755
--- a/Tizen.Maps/Tizen.Maps/MapObject.cs
+++ b/Tizen.Maps/Tizen.Maps/MapObject.cs
@@ -14,67 +14,20 @@
* limitations under the License.
*/
-using System;
-using System.Collections.Generic;
namespace Tizen.Maps
{
/// <summary>
/// Map object
/// </summary>
- public class MapObject
+ public abstract class MapObject
{
- internal Interop.ViewObjectHandle handle;
- private static Dictionary<IntPtr, MapObject> s_HandleToItemTable = new Dictionary<IntPtr, MapObject>();
-
- internal MapObject(Interop.ViewObjectHandle nativeHandle)
- {
- handle = nativeHandle;
- }
-
-
- /// <summary>
- /// Clicked event
- /// </summary>
- public event EventHandler Clicked;
-
/// <summary>
/// Map Object's visibility
/// </summary>
- public bool IsVisible
- {
- get
- {
- bool value;
- Interop.ViewObject.GetVisible(handle, out value);
- return value;
- }
- set
- {
- Interop.ViewObject.SetVisible(handle, value);
- }
- }
-
- internal void AddToMapObjectTable()
- {
- s_HandleToItemTable[handle] = this;
- }
-
- internal void RemoveFromMapObjectTable()
- {
- s_HandleToItemTable.Remove(handle);
- }
-
- internal static MapObject GetItemByHandle(IntPtr handle)
- {
- MapObject value;
- s_HandleToItemTable.TryGetValue(handle, out value);
- return value;
- }
-
- internal void HandleClickedEvent()
- {
- Clicked?.Invoke(this, EventArgs.Empty);
- }
+ public abstract bool IsVisible { get; set; }
+ internal abstract void HandleClickedEvent();
+ internal abstract void InvalidateMapObject();
+ internal abstract Interop.ViewObjectHandle GetHandle();
}
}
diff --git a/Tizen.Maps/Tizen.Maps/MapObjectEventArgs.cs b/Tizen.Maps/Tizen.Maps/MapObjectEventArgs.cs
deleted file mode 100755
index e0af184..0000000
--- a/Tizen.Maps/Tizen.Maps/MapObjectEventArgs.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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
-{
- internal class MapObjectEventArgs : EventArgs
- {
- internal static MapObjectEventArgs Create(IntPtr nativeHandle)
- {
- Interop.ViewGesture type;
- Point screenCoordinate = new Point();
- int touchCount;
- MapObject mapObject;
-
- Interop.ViewEventData.GetGestureType(nativeHandle, out type);
- Interop.ViewEventData.GetPosition(nativeHandle, out screenCoordinate.X, out screenCoordinate.Y);
- Interop.ViewEventData.GetFingers(nativeHandle, out touchCount);
-
- IntPtr nativeObjectHandle;
- Interop.ViewEventData.GetObject(nativeHandle, out nativeObjectHandle);
- mapObject = MapObject.GetItemByHandle(nativeObjectHandle);
- return new MapObjectEventArgs((GestureType)type, screenCoordinate, touchCount, mapObject);
- }
-
- internal MapObjectEventArgs(GestureType type, Point position, int touchCount, MapObject mapObject)
- {
- GestureType = type;
- Position = position;
- TouchCount = touchCount;
- ViewObject = mapObject;
- }
-
- /// <summary>
- /// Type of gesture event
- /// </summary>
- public GestureType GestureType { get; }
-
- /// <summary>
- /// Screen coordinates for the event
- /// </summary>
- public Point Position { get; }
-
- /// <summary>
- /// Number of fingers detected in the event
- /// </summary>
- public int TouchCount { get; }
-
- /// <summary>
- /// Map Object on which event has occurred
- /// </summary>
- public MapObject ViewObject { get; }
- }
-}
diff --git a/Tizen.Maps/Tizen.Maps/MapService.cs b/Tizen.Maps/Tizen.Maps/MapService.cs
index 28bb23b..5eca44d 100755
--- a/Tizen.Maps/Tizen.Maps/MapService.cs
+++ b/Tizen.Maps/Tizen.Maps/MapService.cs
@@ -27,14 +27,12 @@ namespace Tizen.Maps
{
internal Interop.ServiceHandle handle;
- internal PlaceFilter _filter = new PlaceFilter();
- internal GeocodePreference _geocodePreference = new GeocodePreference();
- internal PlaceSearchPreference _placePreference = new PlaceSearchPreference();
- internal RouteSearchPreference _routePreference = new RouteSearchPreference();
+ private PlaceFilter _filter;
+ private SearchPreference _searchPreference;
private static List<string> s_providers;
private string _serviceProvider;
- private string _serviceProviderKey;
+
/// <summary>
/// Creates a new Maps Service object for given service provider
@@ -45,14 +43,11 @@ namespace Tizen.Maps
/// <exception cref="System.UnauthorizedAccessException">Throws if user does not have privilege to access this API</exception>
public MapService(string serviceProvider, string serviceProviderKey)
{
- IntPtr nativeHandle;
- var err = Interop.Service.Create(serviceProvider, out nativeHandle);
- if (err.ThrowIfFailed("Failed to create native service handle"))
- {
- handle = new Interop.ServiceHandle(nativeHandle);
- _serviceProvider = serviceProvider;
- ProviderKey = serviceProviderKey;
- }
+ _serviceProvider = serviceProvider;
+ handle = new Interop.ServiceHandle(serviceProvider);
+ ProviderKey = serviceProviderKey;
+ PlaceSearchFilter = new PlaceFilter();
+ Preferences = new SearchPreference();
}
/// <summary>
@@ -65,14 +60,7 @@ namespace Tizen.Maps
if (s_providers != null) return s_providers;
s_providers = new List<string>();
- Interop.Service.ProviderInfoCallback callback = (mapsProvider, userData) =>
- {
- s_providers.Add(mapsProvider);
- return true;
- };
- var err = Interop.Service.ForeachProvider(callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get map service providers list");
-
+ Interop.ServiceHandle.ForeachProvider(provider => s_providers.Add(provider));
return s_providers;
}
}
@@ -90,15 +78,11 @@ namespace Tizen.Maps
{
get
{
- return _serviceProviderKey;
+ return handle.ProviderKey;
}
set
{
- var err = Interop.Service.SetProviderKey(handle, value);
- if (err.WarnIfFailed("Failed to set service provider key"))
- {
- _serviceProviderKey = value;
- }
+ handle.ProviderKey = value;
}
}
@@ -113,52 +97,66 @@ namespace Tizen.Maps
}
set
{
- _filter = value;
+ if (value != null)
+ {
+ _filter = value;
+ }
}
}
/// <summary>
/// Search preferences used for Geocode/ ReverseGeocode request
/// </summary>
- public GeocodePreference GeocodePreferences
+ public IGeocodePreference GeocodePreferences
{
get
{
- return _geocodePreference;
- }
- set
- {
- _geocodePreference = value;
+ return Preferences as IGeocodePreference;
}
}
/// <summary>
/// Search preferences used for <see cref="Place"/> search request
/// </summary>
- public PlaceSearchPreference PlaceSearchPreferences
+ public IPlaceSearchPreference PlaceSearchPreferences
{
get
{
- return _placePreference;
+ return Preferences as IPlaceSearchPreference;
}
- set
+ }
+
+ /// <summary>
+ /// Search preferences used for <see cref="Route"/> search request
+ /// </summary>
+ public IRouteSearchPreference RouteSearchPreferences
+ {
+ get
{
- _placePreference = value;
+ return Preferences as IRouteSearchPreference;
}
}
/// <summary>
- /// Search preferences used for <see cref="Route"/> search request
+ /// Search preferences
/// </summary>
- public RouteSearchPreference RouteSearchPreferences
+ public SearchPreference Preferences
{
get
{
- return _routePreference;
+ if (_searchPreference == null)
+ {
+ _searchPreference = new SearchPreference(handle.Preferences);
+ }
+ return _searchPreference;
}
set
{
- _routePreference = value;
+ if (value != null)
+ {
+ handle.Preferences = value.handle;
+ _searchPreference = value;
+ }
}
}
@@ -169,12 +167,12 @@ namespace Tizen.Maps
public static async Task<bool> RequestUserConsent(string provider)
{
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
- Interop.Service.RequestUserConsentCallback cb = (consented, serviceProvider, userData) =>
+ Interop.ServiceHandle.RequestUserConsentCallback cb = (consented, serviceProvider, userData) =>
{
tcs.TrySetResult(consented);
};
- var err = Interop.Service.RequestUserConsent(provider, cb, IntPtr.Zero);
+ var err = Interop.ServiceHandle.RequestUserConsent(provider, cb, IntPtr.Zero);
if (err.IsFailed())
{
tcs.TrySetException(err.GetException("Failed to get user consent"));
@@ -190,9 +188,9 @@ namespace Tizen.Maps
public bool IsSupported(ServiceRequestType type)
{
bool result;
- var err = Interop.Service.ProviderIsServiceSupported(handle, (Interop.ServiceType)type, out result);
- err.ThrowIfFailed(string.Format("Failed to get if {0} is supported", type));
- return 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>
@@ -203,9 +201,9 @@ namespace Tizen.Maps
public bool IsSupported(ServiceData data)
{
bool result;
- var err = Interop.Service.ProviderIsDataSupported(handle, (Interop.ServiceData)data, out result);
- err.ThrowIfFailed(string.Format("Failed to get if {0} data is supported", data));
- return 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>
@@ -274,12 +272,12 @@ namespace Tizen.Maps
/// <summary>
/// Creates place search request for specified search radius around a given coordinates position
/// </summary>
- /// <param name="position">Interested position</param>
+ /// <param name="coordinates">Interested position</param>
/// <param name="distance">Search radius</param>
/// <returns>Returns PlaceSearchRequest object created with location coordinates and search radius</returns>
- public PlaceSearchRequest CreatePlaceSearchRequest(Geocoordinates position, int distance)
+ public PlaceSearchRequest CreatePlaceSearchRequest(Geocoordinates coordinates, int distance)
{
- return new PlaceSearchRequest(this, position, distance);
+ return new PlaceSearchRequest(this, coordinates, distance);
}
/// <summary>
@@ -304,20 +302,18 @@ namespace Tizen.Maps
}
#region IDisposable Support
- private bool disposedValue = false;
+ private bool _disposedValue = false;
protected virtual void Dispose(bool disposing)
{
- if (!disposedValue)
+ if (!_disposedValue)
{
if (disposing)
{
- //_filter.Dispose();
- //_geocodePreference.Dispose();
- //_placePreference.Dispose();
- //_routePreference.Dispose();
+ _filter.Dispose();
+ _searchPreference.Dispose();
}
handle.Dispose();
- disposedValue = true;
+ _disposedValue = true;
}
}
diff --git a/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs b/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs
index 1863a18..7550b95 100755
--- a/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs
+++ b/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs
@@ -24,7 +24,7 @@ namespace Tizen.Maps
/// Base class for map service request
/// </summary>
/// <typeparam name="T"></typeparam>
- public abstract class MapServiceRequest<T>
+ public abstract class MapServiceRequest<T> : IDisposable
{
protected TaskCompletionSource<IEnumerable<T>> _requestTask;
protected string errMessage;
@@ -33,7 +33,8 @@ namespace Tizen.Maps
internal Action startExecutionAction;
internal Interop.ErrorCode errorCode;
- internal Interop.ServiceHandle _service;
+
+ internal MapService _service;
/// <summary>
/// Creates map service request
@@ -42,7 +43,7 @@ namespace Tizen.Maps
/// <param name="type">Request type</param>
internal MapServiceRequest(MapService service, ServiceRequestType type)
{
- _service = service.handle;
+ _service = service;
_type = type;
}
@@ -74,12 +75,34 @@ namespace Tizen.Maps
_requestTask?.SetCanceled();
if (_requestID != null)
{
- var err = Interop.Service.CancelRequest(_service, (int)_requestID);
- err.ThrowIfFailed(string.Format("Unable to cancel service request, Type: {0}, ID: {1}", _type, _requestID));
+ 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;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/MapView.cs b/Tizen.Maps/Tizen.Maps/MapView.cs
index ec572af..4f80bdb 100755
--- a/Tizen.Maps/Tizen.Maps/MapView.cs
+++ b/Tizen.Maps/Tizen.Maps/MapView.cs
@@ -25,16 +25,16 @@ namespace Tizen.Maps
/// <summary>
/// Map View
/// </summary>
- public class MapView : Layout
+ public class MapView : Layout, IDisposable
{
internal Interop.ViewHandle handle;
- private Interop.ServiceHandle _service;
+ private MapService _service;
- private HashSet<MapObject> _children = new HashSet<MapObject>();
+ private Dictionary<IntPtr, MapObject> _handleToObjectTable = new Dictionary<IntPtr, MapObject>();
- private Interop.View.ViewOnEventCallback _gestureEventCallback;
- private Interop.View.ViewOnEventCallback _objectEventCallback;
- private Interop.View.ViewOnEventCallback _viewReadyEventCallback;
+ private Interop.ViewOnEventCallback _gestureEventCallback;
+ private Interop.ViewOnEventCallback _objectEventCallback;
+ private Interop.ViewOnEventCallback _viewReadyEventCallback;
private event EventHandler<MapGestureEventArgs> _scrolledEventHandler;
private event EventHandler<MapGestureEventArgs> _zoomedEventHandler;
@@ -52,17 +52,11 @@ namespace Tizen.Maps
/// <param name="service">Map service</param>
public MapView(EvasObject parent, MapService service) : base(parent)
{
- IntPtr nativeHandle;
- var err = Interop.View.Create(service.handle, this, out nativeHandle);
- err.ThrowIfFailed("Failed to create native map view handle");
-
- handle = new Interop.ViewHandle(nativeHandle);
- _service = service.handle;
-
- Console.WriteLine($"MapView Created: ServiceHandle: {(IntPtr)_service}, ViewHandle: {(IntPtr)handle}");
+ handle = new Interop.ViewHandle(service.handle, this);
+ _service = service;
// We need to keep Gesture Tap event enabled for object event to work
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Tap, true);
+ handle.SetGestureEnabled(Interop.ViewGesture.Tap, true);
SetObjectEventCallback();
}
@@ -74,7 +68,7 @@ namespace Tizen.Maps
add
{
SetGestureEventCallback();
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Scroll, true);
+ handle.SetGestureEnabled(Interop.ViewGesture.Scroll, true);
_scrolledEventHandler += value;
}
remove
@@ -82,7 +76,7 @@ namespace Tizen.Maps
_scrolledEventHandler -= value;
if (_scrolledEventHandler == null)
{
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Scroll, false);
+ handle.SetGestureEnabled(Interop.ViewGesture.Scroll, false);
UnsetGestureEventCallback();
}
}
@@ -96,7 +90,7 @@ namespace Tizen.Maps
add
{
SetGestureEventCallback();
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Zoom, true);
+ handle.SetGestureEnabled(Interop.ViewGesture.Zoom, true);
_zoomedEventHandler += value;
}
remove
@@ -104,7 +98,7 @@ namespace Tizen.Maps
_zoomedEventHandler -= value;
if (_zoomedEventHandler == null)
{
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Zoom, false);
+ handle.SetGestureEnabled(Interop.ViewGesture.Zoom, false);
UnsetGestureEventCallback();
}
}
@@ -118,7 +112,7 @@ namespace Tizen.Maps
add
{
SetGestureEventCallback();
- //Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Tap, true);
+ //handle.SetGestureEnabled(Interop.ViewGesture.Tap, true);
_tappedEventHandler += value;
}
remove
@@ -126,7 +120,7 @@ namespace Tizen.Maps
_tappedEventHandler -= value;
if (_tappedEventHandler == null)
{
- //Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Tap, false);
+ //handle.SetGestureEnabled(Interop.ViewGesture.Tap, false);
UnsetGestureEventCallback();
}
}
@@ -140,7 +134,7 @@ namespace Tizen.Maps
add
{
SetGestureEventCallback();
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.DoubleTap, true);
+ handle.SetGestureEnabled(Interop.ViewGesture.DoubleTap, true);
_doubleTappedEventHandler += value;
}
remove
@@ -148,7 +142,7 @@ namespace Tizen.Maps
_doubleTappedEventHandler -= value;
if (_doubleTappedEventHandler == null)
{
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.DoubleTap, false);
+ handle.SetGestureEnabled(Interop.ViewGesture.DoubleTap, false);
UnsetGestureEventCallback();
}
}
@@ -162,7 +156,7 @@ namespace Tizen.Maps
add
{
SetGestureEventCallback();
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.TwoFingerTap, true);
+ handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerTap, true);
_twoFingerTappedEventHandler += value;
}
remove
@@ -170,7 +164,7 @@ namespace Tizen.Maps
_twoFingerTappedEventHandler -= value;
if (_twoFingerTappedEventHandler == null)
{
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.TwoFingerTap, false);
+ handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerTap, false);
UnsetGestureEventCallback();
}
}
@@ -184,7 +178,7 @@ namespace Tizen.Maps
add
{
SetGestureEventCallback();
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Rotate, true);
+ handle.SetGestureEnabled(Interop.ViewGesture.Rotate, true);
_rotatedEventHandler += value;
}
remove
@@ -192,7 +186,7 @@ namespace Tizen.Maps
_rotatedEventHandler -= value;
if (_rotatedEventHandler == null)
{
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.Rotate, false);
+ handle.SetGestureEnabled(Interop.ViewGesture.Rotate, false);
UnsetGestureEventCallback();
}
}
@@ -206,7 +200,7 @@ namespace Tizen.Maps
add
{
SetGestureEventCallback();
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.LongPress, true);
+ handle.SetGestureEnabled(Interop.ViewGesture.LongPress, true);
_longPressedEventHandler += value;
}
remove
@@ -214,7 +208,7 @@ namespace Tizen.Maps
_longPressedEventHandler -= value;
if (_longPressedEventHandler == null)
{
- Interop.View.SetGestureEnabled(handle, Interop.ViewGesture.LongPress, false);
+ handle.SetGestureEnabled(Interop.ViewGesture.LongPress, false);
UnsetGestureEventCallback();
}
}
@@ -233,7 +227,7 @@ namespace Tizen.Maps
remove
{
_viewReadyEventHandler -= value;
- UnsetViewReadyEventCallback();
+ UnsetGestureEventCallback();
}
}
@@ -244,13 +238,11 @@ namespace Tizen.Maps
{
get
{
- int value;
- Interop.View.GetZoomLevel(handle, out value);
- return value;
+ return handle.ZoomLevel;
}
set
{
- Interop.View.SetZoomLevel(handle, value);
+ handle.ZoomLevel = value;
}
}
@@ -261,13 +253,11 @@ namespace Tizen.Maps
{
get
{
- int value;
- Interop.View.GetMinZoomLevel(handle, out value);
- return value;
+ return handle.MinimumZoomLevel;
}
set
{
- Interop.View.SetMinZoomLevel(handle, value);
+ handle.MinimumZoomLevel = value;
}
}
@@ -278,13 +268,11 @@ namespace Tizen.Maps
{
get
{
- int value;
- Interop.View.GetMaxZoomLevel(handle, out value);
- return value;
+ return handle.MaximumZoomLevel;
}
set
{
- Interop.View.SetMaxZoomLevel(handle, value);
+ handle.MaximumZoomLevel = value;
}
}
@@ -295,13 +283,11 @@ namespace Tizen.Maps
{
get
{
- double value;
- Interop.View.GetOrientation(handle, out value);
- return value;
+ return handle.Orientation;
}
set
{
- Interop.View.SetOrientation(handle, value);
+ handle.Orientation = value;
}
}
@@ -312,13 +298,11 @@ namespace Tizen.Maps
{
get
{
- Interop.ViewType value;
- Interop.View.GetType(handle, out value);
- return (MapTypes)value;
+ return (MapTypes)handle.MapType;
}
set
{
- Interop.View.SetType(handle, (Interop.ViewType)value);
+ handle.MapType = (Interop.ViewType)value;
}
}
@@ -329,13 +313,11 @@ namespace Tizen.Maps
{
get
{
- bool value;
- Interop.View.GetBuildingsEnabled(handle, out value);
- return value;
+ return handle.BuildingsEnabled;
}
set
{
- Interop.View.SetBuildingsEnabled(handle, value);
+ handle.BuildingsEnabled = value;
}
}
@@ -346,13 +328,11 @@ namespace Tizen.Maps
{
get
{
- bool value;
- Interop.View.GetTrafficEnabled(handle, out value);
- return value;
+ return handle.TrafficEnabled;
}
set
{
- Interop.View.SetTrafficEnabled(handle, value);
+ handle.TrafficEnabled = value;
}
}
@@ -363,13 +343,11 @@ namespace Tizen.Maps
{
get
{
- bool value;
- Interop.View.GetPublicTransitEnabled(handle, out value);
- return value;
+ return handle.PublicTransitEnabled;
}
set
{
- Interop.View.SetPublicTransitEnabled(handle, value);
+ handle.PublicTransitEnabled = value;
}
}
@@ -380,13 +358,11 @@ namespace Tizen.Maps
{
get
{
- bool value;
- Interop.View.GetScalebarEnabled(handle, out value);
- return value;
+ return handle.ScalebarEnabled;
}
set
{
- Interop.View.SetScalebarEnabled(handle, value);
+ handle.ScalebarEnabled = value;
}
}
@@ -397,13 +373,11 @@ namespace Tizen.Maps
{
get
{
- string value;
- Interop.View.GetLanguage(handle, out value);
- return value;
+ return handle.Language;
}
set
{
- Interop.View.SetLanguage(handle, value);
+ handle.Language = value;
}
}
@@ -414,14 +388,11 @@ namespace Tizen.Maps
{
get
{
- IntPtr coordinateHandle;
- Interop.View.GetCenter(handle, out coordinateHandle);
- return new Geocoordinates(coordinateHandle);
+ return new Geocoordinates(handle.Center);
}
set
{
- Geocoordinates geocoordinate = value;
- Interop.View.SetCenter(handle, geocoordinate.handle);
+ handle.Center = value.handle;
}
}
@@ -432,7 +403,7 @@ namespace Tizen.Maps
{
get
{
- return _children;
+ return _handleToObjectTable.Values;
}
}
@@ -443,10 +414,7 @@ namespace Tizen.Maps
/// <returns></returns>
public Point GeolocationToScreen(Geocoordinates coordinates)
{
- Point screenCoordinates = new Point();
- Geocoordinates geocoordinate = coordinates;
- Interop.View.GeolocationToScreen(handle, geocoordinate.handle, out screenCoordinates.X, out screenCoordinates.Y);
- return screenCoordinates;
+ return handle.GeolocationToScreen(coordinates.handle);
}
/// <summary>
@@ -456,9 +424,7 @@ namespace Tizen.Maps
/// <returns></returns>
public Geocoordinates ScreenToGeolocation(Point screenCoordinates)
{
- IntPtr coordinateHandle;
- Interop.View.ScreenToGeolocation(handle, screenCoordinates.X, screenCoordinates.Y, out coordinateHandle);
- return new Geocoordinates(coordinateHandle);
+ return new Geocoordinates(handle.ScreenToGeolocation(screenCoordinates));
}
/// <summary>
@@ -467,21 +433,32 @@ namespace Tizen.Maps
/// <param name="child">map object to add</param>
public void Add(MapObject child)
{
- child.handle.ReleaseOwnership();
- _children.Add(child);
- child.AddToMapObjectTable();
- Interop.View.AddObject(handle, child.handle);
+ 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 map object from map view
/// </summary>
/// <param name="child">map object to remove</param>
+ /// <remarks>Once removed, child object will be become invalid</remarks>
public void Remove(MapObject child)
{
- _children.Remove(child);
- child.RemoveFromMapObjectTable();
- Interop.View.RemoveObject(handle, child.handle);
+ 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>
@@ -489,12 +466,12 @@ namespace Tizen.Maps
/// </summary>
public void RemoveAll()
{
- foreach (var child in _children)
+ foreach (var child in _handleToObjectTable.Values)
{
- child.RemoveFromMapObjectTable();
+ child.InvalidateMapObject();
}
- _children.Clear();
- Interop.View.RemoveAllObjects(handle);
+ _handleToObjectTable.Clear();
+ handle.RemoveAllObjects();
}
/// <summary>
@@ -516,7 +493,7 @@ namespace Tizen.Maps
_gestureEventCallback = (type, eventData, userData) =>
{
if (type != Interop.ViewEventType.Gesture) return;
- var eventArg = MapGestureEventArgs.Create(eventData);
+ var eventArg = new MapGestureEventArgs(eventData);
switch (eventArg.GestureType)
{
case GestureType.Scroll: _scrolledEventHandler?.Invoke(this, eventArg); break;
@@ -528,7 +505,7 @@ namespace Tizen.Maps
case GestureType.LongPress: _longPressedEventHandler?.Invoke(this, eventArg); break;
}
};
- Interop.View.SetEventCb(handle, Interop.ViewEventType.Gesture, _gestureEventCallback, IntPtr.Zero);
+ handle.SetEventCb(Interop.ViewEventType.Gesture, _gestureEventCallback, IntPtr.Zero);
}
}
@@ -542,7 +519,7 @@ namespace Tizen.Maps
return;
}
- Interop.View.UnsetEventCb(handle, Interop.ViewEventType.Gesture);
+ handle.UnsetEventCb(Interop.ViewEventType.Gesture);
_gestureEventCallback = null;
}
@@ -553,13 +530,18 @@ namespace Tizen.Maps
_objectEventCallback = (type, eventData, userData) =>
{
if (type != Interop.ViewEventType.Object) return;
- var eventArg = MapObjectEventArgs.Create(eventData);
+ var eventArg = new Interop.ObjectEventDataHandle(eventData);
switch (eventArg.GestureType)
{
- case GestureType.Tap: eventArg.ViewObject.HandleClickedEvent(); break;
+ case Interop.ViewGesture.Tap:
+ {
+ var mapObject = _handleToObjectTable[eventArg.ViewObject];
+ mapObject?.HandleClickedEvent();
+ break;
+ }
}
};
- Interop.View.SetEventCb(handle, Interop.ViewEventType.Object, _objectEventCallback, IntPtr.Zero);
+ handle.SetEventCb(Interop.ViewEventType.Object, _objectEventCallback, IntPtr.Zero);
}
}
@@ -571,7 +553,7 @@ namespace Tizen.Maps
{
_viewReadyEventHandler?.Invoke(this, EventArgs.Empty);
};
- Interop.View.SetEventCb(handle, Interop.ViewEventType.Ready, _viewReadyEventCallback, IntPtr.Zero);
+ handle.SetEventCb(Interop.ViewEventType.Ready, _viewReadyEventCallback, IntPtr.Zero);
}
}
@@ -579,9 +561,31 @@ namespace Tizen.Maps
{
if (_viewReadyEventHandler == null)
{
- Interop.View.UnsetEventCb(handle, Interop.ViewEventType.Ready);
+ handle.UnsetEventCb(Interop.ViewEventType.Ready);
_viewReadyEventCallback = null;
}
}
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ _service.Dispose();
+ }
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
-} \ No newline at end of file
+}
diff --git a/Tizen.Maps/Tizen.Maps/Marker.cs b/Tizen.Maps/Tizen.Maps/Marker.cs
index e07a743..25801f1 100755
--- a/Tizen.Maps/Tizen.Maps/Marker.cs
+++ b/Tizen.Maps/Tizen.Maps/Marker.cs
@@ -22,45 +22,55 @@ namespace Tizen.Maps
/// <summary>
/// Marker map object
/// </summary>
- public class Marker : MapObject
+ public class Marker : MapObject, IDisposable
{
- internal Marker(Interop.ViewObjectHandle nativeHandle) : base(nativeHandle)
- {
- }
+ internal Interop.MarkerHandle handle;
- internal Marker(Geocoordinates coordinates, string imagePath, Interop.ViewMarkerType type) : this(CreateNativeHandle(coordinates, imagePath, type))
+ 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>
+ /// Clicked event
+ /// </summary>
+ public event EventHandler Clicked;
+
+ /// <summary>
+ /// Marker's visibility
+ /// </summary>
+ public override bool IsVisible
+ {
+ get
+ {
+ return handle.IsVisible;
+ }
+ set
+ {
+ handle.IsVisible = value;
+ }
}
/// <summary>
/// Geographical coordinates for marker
/// </summary>
- public Geocoordinates Position
+ public Geocoordinates Coordinates
{
get
{
- IntPtr nativeHandle;
- Interop.ViewObject.MarkerGetCoordinates(handle, out nativeHandle);
- return new Geocoordinates(nativeHandle);
+ return new Geocoordinates(handle.Coordinates);
}
set
{
+ handle.Coordinates = value.handle;
+
// Marker takes ownership of the native handle.
- IntPtr nativeHandle;
- var err = Interop.Coordinates.Clone(value.handle, out nativeHandle);
- err.WarnIfFailed("Failed to clone native handle for coordinates");
-
- Interop.CoordinatesHandle clonedHandle = new Interop.CoordinatesHandle(nativeHandle);
- err = Interop.ViewObject.MarkerSetCoordinates(handle, clonedHandle);
- if (err.WarnIfFailed("Failed to set coordinates to marker"))
- {
- clonedHandle.ReleaseOwnership();
- }
+ value.handle.HasOwnership = false;
}
}
@@ -71,13 +81,11 @@ namespace Tizen.Maps
{
get
{
- string value;
- Interop.ViewObject.MarkerGetImageFile(handle, out value);
- return value;
+ return handle.ImageFile;
}
set
{
- Interop.ViewObject.MarkerSetImageFile(handle, value);
+ handle.ImageFile = value;
}
}
@@ -88,13 +96,11 @@ namespace Tizen.Maps
{
get
{
- int w, h;
- Interop.ViewObject.MarkerGetSize(handle, out w, out h);
- return new Size(w, h);
+ return handle.MarkerSize;
}
set
{
- Interop.ViewObject.MarkerResize(handle, value.Width, value.Height);
+ handle.MarkerSize = value;
}
}
@@ -105,13 +111,11 @@ namespace Tizen.Maps
{
get
{
- int value;
- Interop.ViewObject.MarkerGetZOrder(handle, out value);
- return value;
+ return handle.ZOrder;
}
set
{
- Interop.ViewObject.MarkerSetZOrder(handle, value);
+ handle.ZOrder = value;
}
}
@@ -130,24 +134,43 @@ namespace Tizen.Maps
/// <param name="newPosition">New position for marker</param>
public void Move(Geocoordinates newPosition)
{
- Position = newPosition;
+ Coordinates = newPosition;
+ }
+
+ internal override void HandleClickedEvent()
+ {
+ Clicked?.Invoke(this, EventArgs.Empty);
}
- private static Interop.ViewObjectHandle CreateNativeHandle(Geocoordinates coordinates, string imagePath, Interop.ViewMarkerType type)
+ internal override void InvalidateMapObject()
{
- if (coordinates == null || imagePath == null) return new Interop.ViewObjectHandle(IntPtr.Zero);
+ handle = null;
+ }
- IntPtr nativeHandle;
- var err = Interop.Coordinates.Clone(coordinates.handle, out nativeHandle);
- err.WarnIfFailed("Failed to clone native handle for coordinates");
+ internal override Interop.ViewObjectHandle GetHandle()
+ {
+ return handle;
+ }
- Interop.CoordinatesHandle clonedHandle = new Interop.CoordinatesHandle(nativeHandle);
- err = Interop.ViewObject.CreateMarker(clonedHandle, imagePath, type, out nativeHandle);
- err.ThrowIfFailed("Failed to create native handle for marker");
+ #region IDisposable Support
+ private bool _disposedValue = false;
- clonedHandle.ReleaseOwnership();
- return new Interop.ViewObjectHandle(nativeHandle);
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
}
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+
+ #endregion
}
/// <summary>
diff --git a/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs b/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs
index c6b9f5e..92920ba 100755
--- a/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs
+++ b/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs
@@ -24,21 +24,20 @@ namespace Tizen.Maps
/// </summary>
public class MultiReverseGeocodeRequest : MapServiceRequest<PlaceAddress>
{
- private Interop.Service.MultiReverseGeocodeCallback _responseCallback;
+ private Interop.MultiReverseGeocodeCallback _geocodeCallback;
private List<PlaceAddress> _addressesList = new List<PlaceAddress>();
- private GeocodePreference _preferences;
internal MultiReverseGeocodeRequest(MapService service, IEnumerable<Geocoordinates> coordinates) : base(service, ServiceRequestType.ReverseGeocode)
{
- var coordinateList = new GeocoordinatesList(coordinates, true);
- _preferences = service.GeocodePreferences;
- _responseCallback = (result, id, total, addressListHandle, userData) =>
+ // 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);
- addressList.handle.ReleaseOwnership();
_addressesList = addressList.Addresses as List<PlaceAddress>;
_requestTask?.TrySetResult(_addressesList);
return true;
@@ -50,11 +49,12 @@ namespace Tizen.Maps
}
};
+ var coordinateList = new GeocoordinatesList(coordinates);
startExecutionAction = new Action(() =>
{
int requestID;
errMessage = "Failed to get address list for given co-ordinate list";
- errorCode = Interop.Service.MultiReverseGeocode(_service, coordinateList.handle, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ 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));
diff --git a/Tizen.Maps/Tizen.Maps/Overlay.cs b/Tizen.Maps/Tizen.Maps/Overlay.cs
index fd4314f..613721f 100755
--- a/Tizen.Maps/Tizen.Maps/Overlay.cs
+++ b/Tizen.Maps/Tizen.Maps/Overlay.cs
@@ -22,8 +22,9 @@ namespace Tizen.Maps
/// <summary>
/// Overlay map object
/// </summary>
- public class Overlay : MapObject
+ public class Overlay : MapObject, IDisposable
{
+ internal Interop.OverlayHandle handle;
private EvasObject _containedObject;
/// <summary>
@@ -35,18 +36,22 @@ namespace Tizen.Maps
{
}
- internal Overlay(Interop.ViewObjectHandle nativeHandle) : base(nativeHandle)
- {
- }
-
- internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type) : base(CreateNativeHandle(coordinates, objectToContain, type))
+ 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");
}
+
_containedObject = objectToContain;
+ handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, Interop.ViewOverlayType.Normal);
+ }
+
+ public override bool IsVisible
+ {
+ get { return handle.IsVisible; }
+ set { handle.IsVisible = value; }
}
/// <summary>
@@ -56,23 +61,13 @@ namespace Tizen.Maps
{
get
{
- IntPtr nativeHandle;
- Interop.ViewObject.OverlayGetCoordinates(handle, out nativeHandle);
- return new Geocoordinates(nativeHandle);
+ return new Geocoordinates(handle.Coordinates);
}
set
{
// Overlay takes ownership of the native handle.
- IntPtr nativeHandle;
- var err = Interop.Coordinates.Clone(value.handle, out nativeHandle);
- err.WarnIfFailed("Failed to clone native handle for coordinates");
-
- Interop.CoordinatesHandle clonedHandle = new Interop.CoordinatesHandle(nativeHandle);
- err = Interop.ViewObject.OverlaySetCoordinates(handle, clonedHandle);
- if (err.WarnIfFailed("Failed to set coordinates to overlay"))
- {
- clonedHandle.ReleaseOwnership();
- }
+ handle.Coordinates = value.handle;
+ value.handle.HasOwnership = false;
}
}
@@ -83,13 +78,11 @@ namespace Tizen.Maps
{
get
{
- int value;
- Interop.ViewObject.OverlayGetMinZoomLevel(handle, out value);
- return value;
+ return handle.MinZoomLevel;
}
set
{
- Interop.ViewObject.OverlaySetMinZoomLevel(handle, value);
+ handle.MinZoomLevel = value;
}
}
@@ -100,31 +93,47 @@ namespace Tizen.Maps
{
get
{
- int value;
- Interop.ViewObject.OverlayGetMaxZoomLevel(handle, out value);
- return value;
+ return handle.MaxZoomLevel;
}
set
{
- Interop.ViewObject.OverlaySetMaxZoomLevel(handle, value);
+ handle.MaxZoomLevel = value;
}
}
- private static Interop.ViewObjectHandle CreateNativeHandle(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
+ // Overlay object does not support click events
+ internal override void HandleClickedEvent()
{
- if (coordinates == null || objectToContain == null) return new Interop.ViewObjectHandle(IntPtr.Zero);
+ throw new NotSupportedException("Overlay object does not support click events");
+ }
- IntPtr nativeHandle;
- var err = Interop.Coordinates.Clone(coordinates.handle, out nativeHandle);
- err.ThrowIfFailed("Failed to clone native handle for coordinates");
+ internal override void InvalidateMapObject()
+ {
+ handle = null;
+ }
- Interop.CoordinatesHandle clonedHandle = new Interop.CoordinatesHandle(nativeHandle);
- err = Interop.ViewObject.CreateOverlay(clonedHandle, objectToContain, type, out nativeHandle);
- err.ThrowIfFailed("Failed to create native handle for Overlay");
+ internal override Interop.ViewObjectHandle GetHandle()
+ {
+ return handle;
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
- clonedHandle.ReleaseOwnership();
- return new Interop.ViewObjectHandle(nativeHandle);
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
}
+ #endregion
}
/// <summary>
diff --git a/Tizen.Maps/Tizen.Maps/Place.cs b/Tizen.Maps/Tizen.Maps/Place.cs
index 8d8116c..eef5bb5 100755
--- a/Tizen.Maps/Tizen.Maps/Place.cs
+++ b/Tizen.Maps/Tizen.Maps/Place.cs
@@ -22,44 +22,13 @@ namespace Tizen.Maps
/// <summary>
/// Place information, used in Place Discovery and Search
/// </summary>
- public class Place
+ public class Place : IDisposable
{
internal Interop.PlaceHandle handle;
- private string _id;
- private string _name;
- private string _uri;
- private Geocoordinates _location;
- private int _distance;
- private PlaceAddress _address;
- private PlaceRating _rating;
-
- private Dictionary<string, string> _properties;
- private List<PlaceCategory> _categories = new List<PlaceCategory>();
- private List<PlaceAttribute> _attributes = new List<PlaceAttribute>();
- private List<PlaceContact> _contacts = new List<PlaceContact>();
- private List<PlaceEditorial> _editorials = new List<PlaceEditorial>();
- private List<PlaceImage> _images = new List<PlaceImage>();
- private List<PlaceReview> _reviews = new List<PlaceReview>();
-
- private PlaceLink _supplier;
- private PlaceLink _related;
-
- internal Place(IntPtr nativeHandle)
+ internal Place(Interop.PlaceHandle nativeHandle)
{
- handle = new Interop.PlaceHandle(nativeHandle);
-
- Interop.Place.GetDistance(handle, out _distance);
-
- IntPtr supplierHandle;
- var err = Interop.Place.GetSupplierLink(handle, out supplierHandle);
- if (err.IsSuccess())
- _supplier = new PlaceLink(supplierHandle);
-
- IntPtr relatedHandle;
- err = Interop.Place.GetRelatedLink(handle, out relatedHandle);
- if (err.IsSuccess())
- _related = new PlaceLink(relatedHandle);
+ handle = nativeHandle;
}
/// <summary>
@@ -69,12 +38,7 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_id))
- {
- var err = Interop.Place.GetId(handle, out _id);
- err.WarnIfFailed("Failed to get id for this place");
- }
- return _id;
+ return handle.Id;
}
}
@@ -85,12 +49,7 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_name))
- {
- var err = Interop.Place.GetName(handle, out _name);
- err.WarnIfFailed("Failed to get name for this place");
- }
- return _name;
+ return handle.Name;
}
}
@@ -101,36 +60,31 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_uri))
- {
- var err = Interop.Place.GetUri(handle, out _uri);
- err.WarnIfFailed("Failed to get URI for this place");
- }
- return _uri;
+ return handle.Uri;
}
}
/// <summary>
- /// Place location
+ /// Distance from the center of the search area
/// </summary>
- public Geocoordinates Location
+ public int Distance
{
get
{
- if (_location == null)
- {
- IntPtr locationHandle;
- var err = Interop.Place.GetLocation(handle, out locationHandle);
- if (err.WarnIfFailed("Failed to get coordinates for this place"))
- {
- _location = new Geocoordinates(locationHandle);
- }
- }
- return _location;
+ return handle.Distance;
}
}
- public int Distance { get { return _distance; } }
+ /// <summary>
+ /// Place location
+ /// </summary>
+ public Geocoordinates Coordinates
+ {
+ get
+ {
+ return new Geocoordinates(handle.Coordinates);
+ }
+ }
/// <summary>
/// Place address
@@ -139,16 +93,7 @@ namespace Tizen.Maps
{
get
{
- if (_address == null)
- {
- IntPtr addressHandle;
- var err = Interop.Place.GetAddress(handle, out addressHandle);
- if (err.WarnIfFailed("Failed to get address for this place"))
- {
- _address = new PlaceAddress(addressHandle);
- }
- }
- return _address;
+ return new PlaceAddress(handle.Address);
}
}
@@ -159,38 +104,42 @@ namespace Tizen.Maps
{
get
{
- if (_rating == null)
- {
- IntPtr ratingHandle;
- var err = Interop.Place.GetRating(handle, out ratingHandle);
- if (err.WarnIfFailed("Failed to get rating for this place"))
- {
- _rating = new PlaceRating(ratingHandle);
- }
- }
- return _rating;
+ return new PlaceRating(handle.Rating);
}
}
/// <summary>
- /// All properties attached with this place
+ /// Place image supplier link
/// </summary>
- public IDictionary<string, string> Properties
+ public PlaceLink Supplier
{
get
{
- if (_properties != null) return _properties;
- _properties = new Dictionary<string, string>();
- Interop.Place.PropertiesCallback callback = (index, total, key, value, userData) =>
- {
- _properties[key] = value;
- return true;
- };
+ return new PlaceLink(handle.Supplier);
+ }
+ }
- var err = Interop.Place.ForeachProperty(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all properties for this place");
+ /// <summary>
+ /// Place image related link
+ /// </summary>
+ public PlaceLink Related
+ {
+ get
+ {
+ return new PlaceLink(handle.Related);
+ }
+ }
- return _properties;
+ /// <summary>
+ /// All properties attached with this place
+ /// </summary>
+ public IDictionary<string, string> Properties
+ {
+ get
+ {
+ var properties = new Dictionary<string, string>();
+ handle.ForeachProperty((key, value) => properties[key] = value);
+ return properties;
}
}
@@ -201,18 +150,9 @@ namespace Tizen.Maps
{
get
{
- if (_categories != null) return _categories;
- _categories = new List<PlaceCategory>();
- Interop.Place.CategoriesCallback callback = (index, total, categoryHandle, userData) =>
- {
- _categories.Add(new PlaceCategory(categoryHandle));
- return true;
- };
-
- var err = Interop.Place.ForeachCategory(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all categories for this place");
-
- return _categories;
+ var categories = new List<PlaceCategory>();
+ handle.ForeachCategory((categoryHandle) => categories.Add(new PlaceCategory(categoryHandle)));
+ return categories;
}
}
@@ -223,18 +163,9 @@ namespace Tizen.Maps
{
get
{
- if (_attributes != null) return _attributes;
- _attributes = new List<PlaceAttribute>();
- Interop.Place.AttributesCallback callback = (index, total, attributeHandle, userData) =>
- {
- _attributes.Add(new PlaceAttribute(attributeHandle));
- return true;
- };
-
- var err = Interop.Place.ForeachAttribute(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all attributes for this place");
-
- return _attributes;
+ var attributes = new List<PlaceAttribute>();
+ handle.ForeachAttribute((attributeHandle) => attributes.Add(new PlaceAttribute(attributeHandle)));
+ return attributes;
}
}
@@ -245,18 +176,9 @@ namespace Tizen.Maps
{
get
{
- if (_contacts != null) return _contacts;
- _contacts = new List<PlaceContact>();
- Interop.Place.ContactsCallback callback = (index, total, contactHandle, userData) =>
- {
- _contacts.Add(new PlaceContact(contactHandle));
- return true;
- };
-
- var err = Interop.Place.ForeachContact(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all contacts for this place");
-
- return _contacts;
+ var contacts = new List<PlaceContact>();
+ handle.ForeachContact((contactHandle) => contacts.Add(new PlaceContact(contactHandle)));
+ return contacts;
}
}
@@ -267,18 +189,9 @@ namespace Tizen.Maps
{
get
{
- if (_editorials != null) return _editorials;
- _editorials = new List<PlaceEditorial>();
- Interop.Place.EditorialsCallback callback = (index, total, editorialHandle, userData) =>
- {
- _editorials.Add(new PlaceEditorial(editorialHandle));
- return true;
- };
-
- var err = Interop.Place.ForeachEditorial(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all editorials for this place");
-
- return _editorials;
+ var editorials = new List<PlaceEditorial>();
+ handle.ForeachEditorial((editorialHandle) => editorials.Add(new PlaceEditorial(editorialHandle)));
+ return editorials;
}
}
@@ -289,18 +202,9 @@ namespace Tizen.Maps
{
get
{
- if (_images != null) return _images;
- _images = new List<PlaceImage>();
- Interop.Place.ImagesCallback callback = (index, total, imageHandle, userData) =>
- {
- _images.Add(new PlaceImage(imageHandle));
- return true;
- };
-
- var err = Interop.Place.ForeachImage(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all images for this place");
-
- return _images;
+ var images = new List<PlaceImage>();
+ handle.ForeachImage((imageHandle) => images.Add(new PlaceImage(imageHandle)));
+ return images;
}
}
@@ -311,29 +215,28 @@ namespace Tizen.Maps
{
get
{
- if (_reviews != null) return _reviews;
- _reviews = new List<PlaceReview>();
- Interop.Place.ReviewsCallback callback = (index, total, reviewHandle, userData) =>
- {
- _reviews.Add(new PlaceReview(reviewHandle));
- return true;
- };
+ var reviews = new List<PlaceReview>();
+ handle.ForeachReview((reviewHandle) => reviews.Add(new PlaceReview(reviewHandle)));
+ return reviews;
+ }
+ }
- var err = Interop.Place.ForeachReview(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all reviews for this place");
+ #region IDisposable Support
+ private bool _disposedValue = false;
- return _reviews;
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
}
}
- /// <summary>
- /// Place image supplier link
- /// </summary>
- public PlaceLink Supplier { get { return _supplier; } }
-
- /// <summary>
- /// Place image related link
- /// </summary>
- public PlaceLink Related { get { return _related; } }
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceAddress.cs b/Tizen.Maps/Tizen.Maps/PlaceAddress.cs
index 0422785..f98e37b 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceAddress.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceAddress.cs
@@ -21,19 +21,9 @@ namespace Tizen.Maps
/// <summary>
/// Address information for the map point used in Geocode and Reverse Geocode requests.
/// </summary>
- public class PlaceAddress
+ public class PlaceAddress : IDisposable
{
internal Interop.AddressHandle handle;
- private string _building;
- private string _city;
- private string _country;
- private string _countryCode;
- private string _county;
- private string _district;
- private string _freetext;
- private string _postalCode;
- private string _state;
- private string _street;
/// <summary>
/// Construct map address object
@@ -41,16 +31,12 @@ namespace Tizen.Maps
/// <exception cref="System.InvalidOperationException">Throws if native operation failed to allocate memory</exception>
public PlaceAddress()
{
- IntPtr nativeHandle;
- var err = Interop.Address.Create(out nativeHandle);
- err.ThrowIfFailed("Failed to create native address handle");
-
- handle = new Interop.AddressHandle(nativeHandle);
+ handle = new Interop.AddressHandle();
}
- internal PlaceAddress(IntPtr nativeHandle)
+ internal PlaceAddress(Interop.AddressHandle nativeHandle)
{
- handle = new Interop.AddressHandle(nativeHandle);
+ handle = nativeHandle;
}
/// <summary>
@@ -60,20 +46,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_building))
- {
- var err = Interop.Address.GetBuildingNumber(handle, out _building);
- err.WarnIfFailed("Failed to get building number");
- }
- return _building == null ? string.Empty : _building;
+ return handle.Building;
}
set
{
- var err = Interop.Address.SetBuildingNumber(handle, value);
- if (err.WarnIfFailed("Failed to set building number"))
- {
- _building = value;
- }
+ handle.Building = value;
}
}
@@ -84,20 +61,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_city))
- {
- var err = Interop.Address.GetCity(handle, out _city);
- err.WarnIfFailed("Failed to get city");
- }
- return _city == null ? string.Empty : _city;
+ return handle.City;
}
set
{
- var err = Interop.Address.SetCity(handle, value);
- if (err.WarnIfFailed("Failed to set city"))
- {
- _city = value;
- }
+ handle.City = value;
}
}
@@ -108,20 +76,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_country))
- {
- var err = Interop.Address.GetCountry(handle, out _country);
- err.WarnIfFailed("Failed to get country");
- }
- return _country == null ? string.Empty : _country;
+ return handle.Country;
}
set
{
- var err = Interop.Address.SetCountry(handle, value);
- if (err.WarnIfFailed("Failed to set country"))
- {
- _country = value;
- }
+ handle.Country = value;
}
}
@@ -132,20 +91,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_countryCode))
- {
- var err = Interop.Address.GetCountryCode(handle, out _countryCode);
- err.WarnIfFailed("Failed to get country code");
- }
- return _countryCode == null ? string.Empty : _countryCode;
+ return handle.CountryCode;
}
set
{
- var err = Interop.Address.SetCountryCode(handle, value);
- if (err.WarnIfFailed("Failed to set country code"))
- {
- _countryCode = value;
- }
+ handle.CountryCode = value;
}
}
@@ -156,20 +106,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_county))
- {
- var err = Interop.Address.GetCounty(handle, out _county);
- err.WarnIfFailed("Failed to get county");
- }
- return _county == null ? string.Empty : _county;
+ return handle.County;
}
set
{
- var err = Interop.Address.SetCounty(handle, value);
- if (err.WarnIfFailed("Failed to set county"))
- {
- _county = value;
- }
+ handle.County = value;
}
}
@@ -180,20 +121,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_district))
- {
- var err = Interop.Address.GetDistrict(handle, out _district);
- err.WarnIfFailed("Failed to get district");
- }
- return _district == null ? string.Empty : _district;
+ return handle.District;
}
set
{
- var err = Interop.Address.SetDistrict(handle, value);
- if (err.WarnIfFailed("Failed to set district"))
- {
- _district = value;
- }
+ handle.District = value;
}
}
@@ -204,20 +136,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_freetext))
- {
- var err = Interop.Address.GetFreetext(handle, out _freetext);
- err.WarnIfFailed("Failed to get free-text");
- }
- return _freetext == null ? string.Empty : _freetext;
+ return handle.Freetext;
}
set
{
- var err = Interop.Address.SetFreetext(handle, value);
- if (err.WarnIfFailed("Failed to set free-text"))
- {
- _freetext = value;
- }
+ handle.Freetext = value;
}
}
@@ -228,20 +151,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_postalCode))
- {
- var err = Interop.Address.GetPostalCode(handle, out _postalCode);
- err.WarnIfFailed("Failed to get postal code");
- }
- return _postalCode == null ? string.Empty : _postalCode;
+ return handle.PostalCode;
}
set
{
- var err = Interop.Address.SetPostalCode(handle, value);
- if (err.WarnIfFailed("Failed to set postal code"))
- {
- _postalCode = value;
- }
+ handle.PostalCode = value;
}
}
@@ -252,20 +166,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_state))
- {
- var err = Interop.Address.GetState(handle, out _state);
- err.WarnIfFailed("Failed to get state");
- }
- return _state == null ? string.Empty : _state;
+ return handle.State;
}
set
{
- var err = Interop.Address.SetState(handle, value);
- if (err.WarnIfFailed("Failed to set state"))
- {
- _state = value;
- }
+ handle.State = value;
}
}
@@ -276,21 +181,35 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_street))
- {
- var err = Interop.Address.GetStreet(handle, out _street);
- err.WarnIfFailed("Failed to get street");
- }
- return _street == null ? string.Empty : _street;
+ return handle.Street;
}
set
{
- var err = Interop.Address.SetStreet(handle, value);
- if (err.WarnIfFailed("Failed to set street"))
- {
- _street = value;
- }
+ handle.Street = value;
}
}
+
+ 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;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs b/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs
index 7b757cd..c860f87 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs
@@ -22,7 +22,7 @@ namespace Tizen.Maps
/// <summary>
/// List of <see cref="PlaceAddress"/> objects to be used in <see cref="ServiceData.MapService"/> APIs
/// </summary>
- internal class PlaceAddressList
+ internal class PlaceAddressList : IDisposable
{
internal Interop.AddressListHandle handle;
private List<PlaceAddress> _list;
@@ -33,16 +33,12 @@ namespace Tizen.Maps
/// <exception cref="System.InvalidOperationException">Throws if native operation failed to allocate memory</exception>
public PlaceAddressList()
{
- IntPtr nativeHandle;
- var err = Interop.Address.ListCreate(out nativeHandle);
- err.ThrowIfFailed("Failed to create native handle for address list");
-
- handle = new Interop.AddressListHandle(nativeHandle);
+ handle = new Interop.AddressListHandle();
}
- internal PlaceAddressList(IntPtr nativeHandle)
+ internal PlaceAddressList(Interop.AddressListHandle nativeHandle)
{
- handle = new Interop.AddressListHandle(nativeHandle);
+ handle = nativeHandle;
}
/// <summary>
@@ -55,22 +51,28 @@ namespace Tizen.Maps
if (_list == null)
{
_list = new List<PlaceAddress>();
- Interop.Address.AddressCallback callback = (index, handle, userData) =>
- {
- IntPtr cloned;
- // we need to clone handle as it will not be there once this callback returns
- if (Interop.Address.Clone(handle, out cloned).IsSuccess())
- {
- _list.Add(new PlaceAddress(cloned));
- }
- return true;
- };
-
- var err = Interop.Address.ListForeach(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get address list from native handle");
+ 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;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs b/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs
index 2a59920..db6fda9 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs
@@ -27,13 +27,15 @@ namespace Tizen.Maps
private string _label;
private string _text;
- internal PlaceAttribute(IntPtr nativeHandle)
+ internal PlaceAttribute(Interop.PlaceAttributeHandle nativeHandle)
{
- var handle = new Interop.PlaceAttributeHandle(nativeHandle);
+ _id = nativeHandle.Id;
+ _label = nativeHandle.Label;
+ _text = nativeHandle.Text;
+ }
- Interop.PlaceAttribute.GetId(handle, out _id);
- Interop.PlaceAttribute.GetLabel(handle, out _label);
- Interop.PlaceAttribute.GetText(handle, out _text);
+ internal PlaceAttribute(IntPtr nativeHandle, bool needToRelease) : this(new Interop.PlaceAttributeHandle(nativeHandle, needToRelease))
+ {
}
/// <summary>
@@ -50,5 +52,10 @@ namespace Tizen.Maps
/// Place attribute text
/// </summary>
public string Text { get { return _text; } }
+
+ public override string ToString()
+ {
+ return $"{Label}: {Text}";
+ }
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceCategory.cs b/Tizen.Maps/Tizen.Maps/PlaceCategory.cs
index a9a252a..c55c3f8 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceCategory.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceCategory.cs
@@ -21,12 +21,9 @@ namespace Tizen.Maps
/// <summary>
/// Place Category information, used in Place Discovery and Search requests
/// </summary>
- public class PlaceCategory
+ public class PlaceCategory : IDisposable
{
internal Interop.PlaceCategoryHandle handle;
- protected string _id;
- protected string _name;
- protected string _url;
/// <summary>
/// Constructs search category object
@@ -34,36 +31,22 @@ namespace Tizen.Maps
/// <exception cref="System.InvalidOperationException">Throws if native operation failed to allocate memory</exception>
public PlaceCategory()
{
- IntPtr nativeHandle;
- var err = Interop.PlaceCategory.Create(out nativeHandle);
- err.ThrowIfFailed("Failed to create native handle for Place Category");
-
- handle = new Interop.PlaceCategoryHandle(nativeHandle);
+ handle = new Interop.PlaceCategoryHandle();
}
- internal PlaceCategory(IntPtr nativeHandle)
+ internal PlaceCategory(Interop.PlaceCategoryHandle nativeHandle)
{
- handle = new Interop.PlaceCategoryHandle(nativeHandle);
- Initialize();
+ handle = nativeHandle;
}
+
/// <summary>
/// ID for this category
/// </summary>
public string Id
{
- get
- {
- return _id;
- }
- set
- {
- var err = Interop.PlaceCategory.SetId(handle, value);
- if (err.WarnIfFailed("Failed to set id for place category"))
- {
- _id = value;
- }
- }
+ get { return handle.Id; }
+ set { handle.Id = value; }
}
/// <summary>
@@ -71,18 +54,8 @@ namespace Tizen.Maps
/// </summary>
public string Name
{
- get
- {
- return _name;
- }
- set
- {
- var err = Interop.PlaceCategory.SetName(handle, value);
- if (err.WarnIfFailed("Failed to set name for place category"))
- {
- _name = value;
- }
- }
+ get { return handle.Name; }
+ set { handle.Name = value; }
}
/// <summary>
@@ -90,25 +63,31 @@ namespace Tizen.Maps
/// </summary>
public string Url
{
- get
- {
- return _url;
- }
- set
+ get { return handle.Url; }
+ set { handle.Url = value; }
+ }
+
+ public override string ToString()
+ {
+ return $"{Name}";
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
{
- var err = Interop.PlaceCategory.SetUrl(handle, value);
- if (err.WarnIfFailed("Failed to set URL for place category"))
- {
- _url = value;
- }
+ handle.Dispose();
+ _disposedValue = true;
}
}
- internal void Initialize()
+ public void Dispose()
{
- Interop.PlaceCategory.GetId(handle, out _id);
- Interop.PlaceCategory.GetName(handle, out _name);
- Interop.PlaceCategory.GetUrl(handle, out _url);
+ Dispose(true);
}
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceContact.cs b/Tizen.Maps/Tizen.Maps/PlaceContact.cs
index 6ff8f8a..561fdf2 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceContact.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceContact.cs
@@ -28,28 +28,35 @@ namespace Tizen.Maps
private string _type;
private string _value;
- internal PlaceContact(IntPtr nativeHandle)
+ internal PlaceContact(Interop.PlaceContactHandle handle)
{
- var handle = new Interop.PlaceContactHandle(nativeHandle);
+ _label = handle.Label;
+ _type = handle.Type;
+ _value = handle.Value;
+ }
- Interop.PlaceContact.GetLabel(handle, out _label);
- Interop.PlaceContact.GetType(handle, out _type);
- Interop.PlaceContact.GetValue(handle, out _value);
+ internal PlaceContact(IntPtr nativeHandle, bool needToRelease) : this(new Interop.PlaceContactHandle(nativeHandle, needToRelease))
+ {
}
/// <summary>
- /// Place contact label
+ /// Place contact type
/// </summary>
- public string Id { get { return _label; } }
+ public string Id { get { return _type; } }
/// <summary>
- /// Place contact type
+ /// Place contact label
/// </summary>
- public string Label { get { return _type; } }
+ public string Label { get { return _label; } }
/// <summary>
/// Place contact value
/// </summary>
public string Value { get { return _value; } }
+
+ public override string ToString()
+ {
+ return $"{Label}: {Value}";
+ }
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs b/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs
index f2bce58..0a62f7a 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs
@@ -27,17 +27,15 @@ namespace Tizen.Maps
private string _language;
private PlaceMedia _media;
- internal PlaceEditorial(IntPtr nativeHandle)
+ internal PlaceEditorial(Interop.PlaceEditorialHandle handle)
{
- var handle = new Interop.PlaceEditorialHandle(nativeHandle);
-
- Interop.PlaceEditorial.GetDescription(handle, out _description);
- Interop.PlaceEditorial.GetLanguage(handle, out _language);
+ _description = handle.Description;
+ _language = handle.Language;
+ _media = new PlaceMedia(handle.Media);
+ }
- IntPtr mediaHandle;
- var err = Interop.PlaceEditorial.GetMedia(handle, out mediaHandle);
- if (err.IsSuccess())
- _media = new PlaceMedia(mediaHandle);
+ internal PlaceEditorial(IntPtr nativeHandle, bool needToRelease) : this(new Interop.PlaceEditorialHandle(nativeHandle, needToRelease))
+ {
}
/// <summary>
@@ -54,5 +52,10 @@ namespace Tizen.Maps
/// Place editorial value
/// </summary>
public PlaceMedia Media { get { return _media; } }
+
+ public override string ToString()
+ {
+ return $"{Description}";
+ }
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceFilter.cs b/Tizen.Maps/Tizen.Maps/PlaceFilter.cs
index b649d66..b575424 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceFilter.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceFilter.cs
@@ -21,13 +21,9 @@ namespace Tizen.Maps
/// <summary>
/// Place Filter information, used in Place Discovery and Search requests
/// </summary>
- public class PlaceFilter
+ public class PlaceFilter : IDisposable
{
internal Interop.PlaceFilterHandle handle;
- private string _address;
- private PlaceCategory _category;
- private string _keyword;
- private string _name;
/// <summary>
/// Constructs new place filter
@@ -35,11 +31,7 @@ namespace Tizen.Maps
/// <exception cref="System.InvalidOperationException">Throws if native operation failed to allocate memory</exception>
public PlaceFilter()
{
- IntPtr nativeHandle;
- var err = Interop.PlaceFilter.Create(out nativeHandle);
- err.ThrowIfFailed("Failed to create native place filter handle");
-
- handle = new Interop.PlaceFilterHandle(nativeHandle);
+ handle = new Interop.PlaceFilterHandle();
}
/// <summary>
@@ -49,20 +41,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_address))
- {
- var err = Interop.PlaceFilter.GetPlaceAddress(handle, out _address);
- err.WarnIfFailed("Failed to get filter string for place addresses");
- }
- return _address;
+ return handle.PlaceAddress;
}
set
{
- var err = Interop.PlaceFilter.SetPlaceAddress(handle, value);
- if (err.WarnIfFailed("Failed to set filter string for place addresses"))
- {
- _address = value;
- }
+ handle.PlaceAddress = value;
}
}
@@ -73,24 +56,11 @@ namespace Tizen.Maps
{
get
{
- if (_category == null)
- {
- IntPtr nativeHandle;
- var err = Interop.PlaceFilter.GetCategory(handle, out nativeHandle);
- if (err.WarnIfFailed("Failed to get category filter for places"))
- {
- _category = new PlaceCategory(nativeHandle);
- }
- }
- return _category;
+ return new PlaceCategory(handle.Category);
}
set
{
- var err = Interop.PlaceFilter.SetCategory(handle, value.handle);
- if (err.WarnIfFailed("Failed to set category filter for places"))
- {
- _category = value;
- }
+ handle.Category = value.handle;
}
}
@@ -101,20 +71,11 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_keyword))
- {
- var err = Interop.PlaceFilter.GetKeyword(handle, out _keyword);
- err.WarnIfFailed("Failed to get filter keywords for places");
- }
- return _keyword;
+ return handle.Keyword;
}
set
{
- var err = Interop.PlaceFilter.SetKeyword(handle, value);
- if (err.WarnIfFailed("Failed to set filter keywords for places"))
- {
- _keyword = value;
- }
+ handle.Keyword = value;
}
}
@@ -125,21 +86,30 @@ namespace Tizen.Maps
{
get
{
- if (string.IsNullOrEmpty(_name))
- {
- var err = Interop.PlaceFilter.GetPlaceName(handle, out _name);
- err.WarnIfFailed("Failed to get filter string for place names");
- }
- return _name;
+ return handle.PlaceName;
}
set
{
- var err = Interop.PlaceFilter.SetPlaceName(handle, value);
- if (err.WarnIfFailed("Failed to set filter string for place names"))
- {
- _name = value;
- }
+ handle.PlaceName = value;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
}
}
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceImage.cs b/Tizen.Maps/Tizen.Maps/PlaceImage.cs
index 38fcb68..0f269e3 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceImage.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceImage.cs
@@ -30,24 +30,14 @@ namespace Tizen.Maps
private PlaceLink _userLink;
private PlaceMedia _media;
- internal PlaceImage(IntPtr nativeHandle)
+ internal PlaceImage(Interop.PlaceImageHandle handle)
{
- var handle = new Interop.PlaceImageHandle(nativeHandle);
-
- Interop.PlaceImage.GetId(handle, out _id);
- Interop.PlaceImage.GetUrl(handle, out _url);
- Interop.PlaceImage.GetWidth(handle, out _width);
- Interop.PlaceImage.GetHeight(handle, out _height);
-
- IntPtr userHandle;
- var err = Interop.PlaceImage.GetUserLink(handle, out userHandle);
- if (err.IsSuccess())
- _userLink = new PlaceLink(userHandle);
-
- IntPtr mediaHandle;
- err = Interop.PlaceImage.GetMedia(handle, out mediaHandle);
- if (err.IsSuccess())
- _media = new PlaceMedia(mediaHandle);
+ _id = handle.Id;
+ _url = handle.Url;
+ _width = handle.Width;
+ _height = handle.Height;
+ _userLink = new PlaceLink(handle.User);
+ _media = new PlaceMedia(handle.Media);
}
/// <summary>
diff --git a/Tizen.Maps/Tizen.Maps/PlaceLink.cs b/Tizen.Maps/Tizen.Maps/PlaceLink.cs
index b2d262e..4ad28f8 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceLink.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceLink.cs
@@ -26,17 +26,15 @@ namespace Tizen.Maps
{
private string _id;
private string _name;
- private string _string;
+ private string _link;
private string _type;
- internal PlaceLink(IntPtr nativeHandle)
+ internal PlaceLink(Interop.PlaceLinkObjectHandle handle)
{
- var handle = new Interop.PlaceLinkObjectHandle(nativeHandle);
-
- Interop.PlaceLinkObject.GetId(handle, out _id);
- Interop.PlaceLinkObject.GetName(handle, out _name);
- Interop.PlaceLinkObject.GetString(handle, out _string);
- Interop.PlaceLinkObject.GetType(handle, out _type);
+ _id = handle.Id;
+ _name = handle.Name;
+ _link = handle.Link;
+ _type = handle.Type;
}
/// <summary>
@@ -52,7 +50,7 @@ namespace Tizen.Maps
/// <summary>
/// Place link string
/// </summary>
- public string LinkString { get { return _string; } }
+ public string Link { get { return _link; } }
/// <summary>
/// Place link type
diff --git a/Tizen.Maps/Tizen.Maps/PlaceList.cs b/Tizen.Maps/Tizen.Maps/PlaceList.cs
index 68afb7b..6843a99 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceList.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceList.cs
@@ -22,21 +22,14 @@ namespace Tizen.Maps
/// <summary>
/// List of <see cref="Place"/> objects to be used in <see cref="ServiceData.MapService"/> APIs
/// </summary>
- internal class PlaceList
+ internal class PlaceList : IDisposable
{
internal Interop.PlaceListHandle handle;
private List<Place> _list;
- internal PlaceList(IntPtr nativeHandle)
+ internal PlaceList(Interop.PlaceListHandle nativeHandle)
{
- handle = new Interop.PlaceListHandle(nativeHandle);
- Interop.Place.PlaceCallback callback = (index, placeHandle, userData) =>
- {
- _list.Add(new Place(placeHandle));
- return true;
- };
-
- Interop.Place.ListForeach(handle, callback, IntPtr.Zero);
+ handle = nativeHandle;
}
/// <summary>
@@ -49,17 +42,28 @@ namespace Tizen.Maps
if (_list == null)
{
_list = new List<Place>();
- Interop.Place.PlaceCallback callback = (index, handle, userData) =>
- {
- _list.Add(new Place(handle));
- return true;
- };
-
- var err = Interop.Place.ListForeach(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get place list from native handle");
+ 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;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceMedia.cs b/Tizen.Maps/Tizen.Maps/PlaceMedia.cs
index 182ef6d..0df0a3b 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceMedia.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceMedia.cs
@@ -27,21 +27,11 @@ namespace Tizen.Maps
private PlaceLink _supplier;
private PlaceLink _via;
- internal PlaceMedia(IntPtr nativeHandle)
+ internal PlaceMedia(Interop.PlaceMediaHandle handle)
{
- var handle = new Interop.PlaceMediaHandle(nativeHandle);
-
- Interop.PlaceMedia.GetAttribution(handle, out _attribution);
-
- IntPtr supplierHandle;
- var err = Interop.PlaceMedia.GetSupplier(handle, out supplierHandle);
- if (err.IsSuccess())
- _supplier = new PlaceLink(supplierHandle);
-
- IntPtr viaHandle;
- err = Interop.PlaceMedia.GetVia(handle, out viaHandle);
- if (err.IsSuccess())
- _via = new PlaceLink(viaHandle);
+ _attribution = handle.Attribution;
+ _supplier = new PlaceLink(handle.Supplier);
+ _via = new PlaceLink(handle.Via);
}
/// <summary>
diff --git a/Tizen.Maps/Tizen.Maps/PlaceRating.cs b/Tizen.Maps/Tizen.Maps/PlaceRating.cs
index 5ce78a2..4ade1f2 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceRating.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceRating.cs
@@ -26,12 +26,10 @@ namespace Tizen.Maps
private int _count;
private double _average;
- internal PlaceRating(IntPtr nativeHandle)
+ internal PlaceRating(Interop.PlaceRatingHandle handle)
{
- var handle = new Interop.PlaceRatingHandle(nativeHandle);
-
- Interop.PlaceRating.GetCount(handle, out _count);
- Interop.PlaceRating.GetAverage(handle, out _average);
+ _count = handle.Count;
+ _average = handle.Average;
}
/// <summary>
@@ -43,5 +41,10 @@ namespace Tizen.Maps
/// Average value of user rating
/// </summary>
public double Average { get { return _average; } }
+
+ public override string ToString()
+ {
+ return $"{Average}({UserCount} reviews)";
+ }
}
}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceReview.cs b/Tizen.Maps/Tizen.Maps/PlaceReview.cs
index 8a794a0..286b658 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceReview.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceReview.cs
@@ -31,34 +31,20 @@ namespace Tizen.Maps
private PlaceMedia _media;
private PlaceLink _userLink;
- internal PlaceReview(IntPtr nativeHandle)
+ internal PlaceReview(Interop.PlaceReviewHandle handle)
{
- var handle = new Interop.PlaceReviewHandle(nativeHandle);
-
- string date;
- var err = Interop.PlaceReview.GetDate(handle, out date);
- if (err.IsSuccess())
+ string date = handle.Date;
+ if (DateTime.TryParse(date, out _date) == false)
{
- if (DateTime.TryParse(date, out _date) == false)
- {
- Interop.ErrorCode.InvalidParameter.WarnIfFailed(string.Format("Wrong date format: {0}", date));
- }
+ Interop.ErrorCode.InvalidParameter.WarnIfFailed($"Wrong date format: {date}");
}
- Interop.PlaceReview.GetTitle(handle, out _title);
- Interop.PlaceReview.GetRating(handle, out _rating);
- Interop.PlaceReview.GetDescription(handle, out _description);
- Interop.PlaceReview.GetLanguage(handle, out _language);
-
- IntPtr mediaHandle;
- err = Interop.PlaceReview.GetMedia(handle, out mediaHandle);
- if (err.IsSuccess())
- _media = new PlaceMedia(mediaHandle);
-
- IntPtr userHandle;
- err = Interop.PlaceReview.GetUserLink(handle, out userHandle);
- if (err.IsSuccess())
- _userLink = new PlaceLink(userHandle);
+ _title = handle.Title;
+ _rating = handle.Rating;
+ _description = handle.Description;
+ _language = handle.Language;
+ _media = new PlaceMedia(handle.Media);
+ _userLink = new PlaceLink(handle.User);
}
/// <summary>
diff --git a/Tizen.Maps/Tizen.Maps/PlaceSearchPreference.cs b/Tizen.Maps/Tizen.Maps/PlaceSearchPreference.cs
deleted file mode 100755
index 90558f9..0000000
--- a/Tizen.Maps/Tizen.Maps/PlaceSearchPreference.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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 place search requests
- /// </summary>
- public class PlaceSearchPreference
- {
- internal Interop.PreferenceHandle handle;
-
- private string _language = string.Empty;
- private string _countryCode = string.Empty;
- private Interop.DistanceUnit? _distanceUnit;
-
- private IDictionary<string, string> _properties = new Dictionary<string, string>();
-
- /// <summary>
- /// Constructor for search preference
- /// </summary>
- public PlaceSearchPreference()
- {
- IntPtr nativeHandle;
- var err = Interop.Preference.Create(out nativeHandle);
- err.ThrowIfFailed("Failed to create native preference handle");
-
- handle = new Interop.PreferenceHandle(nativeHandle);
- }
-
- /// <summary>
- /// Constructor for search preference
- /// </summary>
- public PlaceSearchPreference(IDictionary<string, string> properties) : this()
- {
- _properties = properties;
- foreach (var item in properties)
- {
- var err = Interop.Preference.SetProperty(handle, item.Key, item.Value);
- err.WarnIfFailed(string.Format("Failed to set property: {0} = {1}", item.Key, item.Value));
- }
- }
-
- /// <summary>
- /// Distance unit
- /// </summary>
- public DistanceUnit Unit
- {
- get
- {
- if (_distanceUnit == null)
- {
- var err = Interop.Preference.GetDistanceUnit(handle, out _distanceUnit);
- err.WarnIfFailed("Failed to get distance unit for this preference");
- }
- return (DistanceUnit)_distanceUnit;
- }
- set
- {
- var err = Interop.Preference.SetDistanceUnit(handle, (Interop.DistanceUnit)value);
- if (err.WarnIfFailed("Failed to set distance unit for this preference"))
- {
- _distanceUnit = (Interop.DistanceUnit)value;
- }
- }
- }
-
- /// <summary>
- /// Preferred language
- /// </summary>
- /// <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 e.g. "ko-KR"
- /// </remarks>
- public string Language
- {
- get
- {
- if (string.IsNullOrEmpty(_language))
- {
- var err = Interop.Preference.GetLanguage(handle, out _language);
- err.WarnIfFailed("Failed to get language for this preference");
- }
- return _language;
- }
- set
- {
- var err = Interop.Preference.SetLanguage(handle, value);
- if (err.WarnIfFailed("Failed to set language for this preference"))
- {
- _language = value;
- }
- }
- }
-
- /// <summary>
- /// Maximum result count for a service request
- /// </summary>
- public int MaxResults
- {
- get
- {
- int _maxResults = 0;
- var err = Interop.Preference.GetMaxResults(handle, out _maxResults);
- err.WarnIfFailed("Failed to get max result count for this preference");
- return _maxResults;
- }
- set
- {
- var err = Interop.Preference.SetMaxResults(handle, value);
- err.WarnIfFailed("Failed to set max result count for this preference");
- }
- }
-
- /// <summary>
- /// Preferred country
- /// </summary>
- public string CountryCode
- {
- get
- {
- if (string.IsNullOrEmpty(_countryCode))
- {
- var err = Interop.Preference.GetCountryCode(handle, out _countryCode);
- err.WarnIfFailed("Failed to get country code for this preference");
- }
- return _countryCode;
- }
- set
- {
- var err = Interop.Preference.SetCountryCode(handle, value);
- if (err.WarnIfFailed("Failed to set country code for this preference"))
- {
- _countryCode = value;
- }
- }
- }
-
- /// <summary>
- /// Search properties as key value pair
- /// </summary>
- public IReadOnlyDictionary<string, string> Properties
- {
- get
- {
- return _properties as IReadOnlyDictionary<string, string>;
- }
- }
- }
-}
diff --git a/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs b/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs
index 8cd831e..baa5ecc 100755
--- a/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs
+++ b/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs
@@ -24,18 +24,16 @@ namespace Tizen.Maps
/// </summary>
public class PlaceSearchRequest : MapServiceRequest<Place>
{
- private Interop.Service.SearchPlaceCallback _responseCallback;
+ private Interop.SearchPlaceCallback _placeCallback;
private List<Place> _placeList = new List<Place>();
- private PlaceFilter _filter;
- private PlaceSearchPreference _preferences;
internal PlaceSearchRequest(MapService service, Geocoordinates position, int distance) : this(service, ServiceRequestType.SearchPlace)
{
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get place list for given co-ordinate {0} and distance {1}", position, distance);
- errorCode = Interop.Service.SearchPlace(_service, position.handle, distance, _filter.handle, _preferences.handle, _responseCallback, IntPtr.Zero, out 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));
@@ -49,8 +47,8 @@ namespace Tizen.Maps
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get place list for given boundary {0}", boundary);
- errorCode = Interop.Service.SearchPlaceByArea(_service, boundary.handle, _filter.handle, _preferences.handle, _responseCallback, IntPtr.Zero, out 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));
@@ -64,8 +62,8 @@ namespace Tizen.Maps
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get co-ordinates for given address {0} and boundary {1}", address, boundary);
- errorCode = Interop.Service.SearchPlaceByAddress(_service, address, boundary.handle, _filter.handle, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ errMessage = $"Failed to get co-ordinates 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));
@@ -76,13 +74,14 @@ namespace Tizen.Maps
private PlaceSearchRequest(MapService service, ServiceRequestType type) : base(service, type)
{
- _filter = service._filter;
- _preferences = service.PlaceSearchPreferences;
- _responseCallback = (result, id, index, total, placeHandle, userData) =>
+ // 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)
{
@@ -92,6 +91,7 @@ namespace Tizen.Maps
}
else
{
+ // If search is failed, the value of total is 0 and place is NULL
_requestTask?.TrySetException(errorCode.GetException(errMessage));
return false;
}
diff --git a/Tizen.Maps/Tizen.Maps/Polygon.cs b/Tizen.Maps/Tizen.Maps/Polygon.cs
index 2f78c2b..3e7f7ad 100755
--- a/Tizen.Maps/Tizen.Maps/Polygon.cs
+++ b/Tizen.Maps/Tizen.Maps/Polygon.cs
@@ -25,8 +25,9 @@ namespace Tizen.Maps
/// <summary>
/// Polygon map object
/// </summary>
- public class Polygon : MapObject
+ public class Polygon : MapObject, IDisposable
{
+ internal Interop.PolygonHandle handle;
private List<Geocoordinates> _coordinateList;
/// <summary>
@@ -34,7 +35,7 @@ namespace Tizen.Maps
/// </summary>
/// <param name="coordinates">list of geographical coordinates</param>
/// <param name="color">background color</param>
- public Polygon(IEnumerable<Geocoordinates> coordinates, Color color) : base(CreateNativeHandle(coordinates, color))
+ public Polygon(IEnumerable<Geocoordinates> coordinates, Color color) : base()
{
var err = Interop.ErrorCode.InvalidParameter;
if (coordinates == null || coordinates.Count() < 3)
@@ -42,10 +43,19 @@ namespace Tizen.Maps
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);
}
- internal Polygon(Interop.ViewObjectHandle nativeHandle) : base(nativeHandle)
+ /// <summary>
+ /// Clicked event
+ /// </summary>
+ public event EventHandler Clicked;
+
+ public override bool IsVisible
{
+ get { return handle.IsVisible; }
+ set { handle.IsVisible = value; }
}
/// <summary>
@@ -55,30 +65,19 @@ namespace Tizen.Maps
{
get
{
- if (_coordinateList == null)
- {
- _coordinateList = new List<Geocoordinates>();
- Interop.ViewObject.CoordinatesCallback callback = (index, nativeHandle, userData) =>
- {
- _coordinateList.Add(new Geocoordinates(nativeHandle));
- return true;
- };
- Interop.ViewObject.PolygonForeachPoint(handle, callback, IntPtr.Zero);
- }
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 coordinateList = new GeocoordinatesList(coordinates, false);
- if (Interop.ViewObject.PolygonSetPolygon(handle, coordinateList.handle).IsSuccess())
+ var geocoordinateList = new GeocoordinatesList(coordinates, false);
+ if (handle.SetPolygon(geocoordinateList.handle).IsSuccess())
{
_coordinateList = coordinates;
}
@@ -92,25 +91,49 @@ namespace Tizen.Maps
{
get
{
- byte r, g, b, a;
- Interop.ViewObject.PolygonGetFillColor(handle, out r, out g, out b, out a);
- return new Color(r, g, b, a);
+ return handle.FillColor;
}
set
{
- Interop.ViewObject.PolygonSetFillColor(handle, (byte)value.R, (byte)value.G, (byte)value.B, (byte)value.A);
+ handle.FillColor = value;
}
}
- private static Interop.ViewObjectHandle CreateNativeHandle(IEnumerable<Geocoordinates> coordinates, Color color)
+ internal override void HandleClickedEvent()
+ {
+ Clicked?.Invoke(this, EventArgs.Empty);
+ }
+
+ internal override void InvalidateMapObject()
+ {
+ handle = null;
+ }
+
+ internal override Interop.ViewObjectHandle GetHandle()
{
- if (coordinates == null || coordinates.Count() < 3) return new Interop.ViewObjectHandle(IntPtr.Zero);
+ return handle;
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
- IntPtr nativeHandle;
- var geocoordinateList = new GeocoordinatesList(coordinates.ToList(), false);
- var err = Interop.ViewObject.CreatePolygon(geocoordinateList.handle, (byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A, out nativeHandle);
- err.ThrowIfFailed("Failed to create native handle for polygon");
- return new Interop.ViewObjectHandle(nativeHandle);
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ if (disposing)
+ {
+ _coordinateList.Clear();
+ }
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
}
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/Polyline.cs b/Tizen.Maps/Tizen.Maps/Polyline.cs
index aaa8dac..d5e98ff 100755
--- a/Tizen.Maps/Tizen.Maps/Polyline.cs
+++ b/Tizen.Maps/Tizen.Maps/Polyline.cs
@@ -25,8 +25,9 @@ namespace Tizen.Maps
/// <summary>
/// Polyline map object
/// </summary>
- public class Polyline : MapObject
+ public class Polyline : MapObject, IDisposable
{
+ internal Interop.PolylineHandle handle;
private List<Geocoordinates> _coordinateList;
/// <summary>
@@ -35,7 +36,7 @@ namespace Tizen.Maps
/// <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>
- public Polyline(List<Geocoordinates> coordinates, Color color, int width) : base(CreateNativeHandle(coordinates, color, width))
+ public Polyline(List<Geocoordinates> coordinates, Color color, int width) : base()
{
var err = Interop.ErrorCode.InvalidParameter;
if (coordinates == null || coordinates.Count() < 2)
@@ -43,10 +44,19 @@ namespace Tizen.Maps
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);
}
- internal Polyline(Interop.ViewObjectHandle nativeHandle) : base(nativeHandle)
+ /// <summary>
+ /// Clicked event
+ /// </summary>
+ public event EventHandler Clicked;
+
+ public override bool IsVisible
{
+ get { return handle.IsVisible; }
+ set { handle.IsVisible = value; }
}
/// <summary>
@@ -56,16 +66,6 @@ namespace Tizen.Maps
{
get
{
- if (_coordinateList == null)
- {
- _coordinateList = new List<Geocoordinates>();
- Interop.ViewObject.CoordinatesCallback callback = (index, nativeHandle, userData) =>
- {
- _coordinateList.Add(new Geocoordinates(nativeHandle));
- return true;
- };
- Interop.ViewObject.PolylineForeachPoint(handle, callback, IntPtr.Zero);
- }
return _coordinateList;
}
set
@@ -77,8 +77,8 @@ namespace Tizen.Maps
err.ThrowIfFailed("given coordinates list should contain at least 2 coordinates");
}
- var coordinateList = new GeocoordinatesList(coordinates, false);
- if (Interop.ViewObject.PolylineSetPolyline(handle, coordinateList.handle).IsSuccess())
+ var geocoordinateList = new GeocoordinatesList(coordinates, false);
+ if (handle.SetPolyline(geocoordinateList.handle).IsSuccess())
{
_coordinateList = coordinates;
}
@@ -92,13 +92,11 @@ namespace Tizen.Maps
{
get
{
- byte r, g, b, a;
- Interop.ViewObject.PolylineGetColor(handle, out r, out g, out b, out a);
- return new Color(r, g, b, a);
+ return handle.LineColor;
}
set
{
- Interop.ViewObject.PolylineSetColor(handle, (byte)value.R, (byte)value.G, (byte)value.B, (byte)value.A);
+ handle.LineColor = value;
}
}
@@ -109,25 +107,49 @@ namespace Tizen.Maps
{
get
{
- int value;
- Interop.ViewObject.PolylineGetWidth(handle, out value);
- return value;
+ return handle.LineWidth;
}
set
{
- Interop.ViewObject.PolylineSetWidth(handle, value);
+ handle.LineWidth = value;
}
}
- private static Interop.ViewObjectHandle CreateNativeHandle(IEnumerable<Geocoordinates> coordinates, Color color, int width)
+ internal override void HandleClickedEvent()
{
- if (coordinates == null || coordinates.Count() < 2) return new Interop.ViewObjectHandle(IntPtr.Zero);
+ Clicked?.Invoke(this, EventArgs.Empty);
+ }
- IntPtr nativeHandle;
- var coordinateList = new GeocoordinatesList(coordinates.ToList(), false);
- var err = Interop.ViewObject.CreatePolyline(coordinateList.handle, (byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A, width, out nativeHandle);
- err.ThrowIfFailed("Failed to create native handle for polyline");
- return new Interop.ViewObjectHandle(nativeHandle);
+ 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;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
}
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs b/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs
index f40c358..00c9612 100755
--- a/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs
+++ b/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs
@@ -24,18 +24,19 @@ namespace Tizen.Maps
/// </summary>
public class ReverseGeocodeRequest : MapServiceRequest<PlaceAddress>
{
- private Interop.Service.ReverseGeocodeCallback _responseCallback;
+ private Interop.ReverseGeocodeCallback _geocodeCallback;
private List<PlaceAddress> _addressList = new List<PlaceAddress>();
- private GeocodePreference _preferences;
internal ReverseGeocodeRequest(MapService service, double latitude, double longitute) : base(service, ServiceRequestType.ReverseGeocode)
{
- _preferences = service.GeocodePreferences;
- _responseCallback = (result, id, index, total, addressHandle, userData) =>
+ // 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)
{
@@ -44,6 +45,7 @@ namespace Tizen.Maps
}
else
{
+ // If search is failed, the value of total is 0 and address is NULL
_requestTask?.TrySetException(errorCode.GetException(errMessage));
}
};
@@ -51,8 +53,8 @@ namespace Tizen.Maps
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get co-ordinates for given Coordinate: {0}:{1}", latitude, longitute);
- errorCode = Interop.Service.ReverseGeocode(_service, latitude, longitute, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ errMessage = $"Failed to get co-ordinates for given Coordinate: {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));
diff --git a/Tizen.Maps/Tizen.Maps/Route.cs b/Tizen.Maps/Tizen.Maps/Route.cs
index 255929b..32d364e 100755
--- a/Tizen.Maps/Tizen.Maps/Route.cs
+++ b/Tizen.Maps/Tizen.Maps/Route.cs
@@ -23,37 +23,13 @@ namespace Tizen.Maps
/// <summary>
/// Route information, used in Route Search requests
/// </summary>
- public class Route
+ public class Route : IDisposable
{
internal Interop.RouteHandle handle;
- private Area _bondingBox;
- private Geocoordinates _destination;
- private double _distance;
- private long _duration;
- private string _id = string.Empty;
- private Geocoordinates _origin;
- private List<Geocoordinates> _path;
-
- private Dictionary<string, string> _properties;
- private List<RouteSegment> _segments;
- private Interop.RouteTransportMode _transportMode;
- private Interop.DistanceUnit _unit;
-
- internal Route(IntPtr nativeHandle)
- {
- handle = new Interop.RouteHandle(nativeHandle);
-
- var err = Interop.Route.GetTransportMode(handle, out _transportMode);
- err.WarnIfFailed("Failed to get transport mode for the segment");
-
- err = Interop.Route.GetTotalDistance(handle, out _distance);
- err.WarnIfFailed("Failed to get distance for the segment");
- err = Interop.Route.GetDistanceUnit(handle, out _unit);
- err.WarnIfFailed("Failed to get distance for the segment");
-
- err = Interop.Route.GetTotalDuration(handle, out _duration);
- err.WarnIfFailed("Failed to get duration for the segment");
+ internal Route(Interop.RouteHandle nativeHandle)
+ {
+ handle = nativeHandle;
}
/// <summary>
@@ -63,49 +39,50 @@ namespace Tizen.Maps
{
get
{
- if (_destination != null) return _destination;
-
- IntPtr destinationHandle;
- var err = Interop.Route.GetDestination(handle, out destinationHandle);
- if (err.WarnIfFailed("Failed to get destination for the route"))
- {
- _destination = new Geocoordinates(destinationHandle);
- }
- return _destination;
+ return new Geocoordinates(handle.Destination);
}
}
/// <summary>
/// Total distance for this route
/// </summary>
- public double Distance { get { return _distance; } }
+ public double Distance
+ {
+ get
+ {
+ return handle.Distance;
+ }
+ }
/// <summary>
/// Total duration to cover this route
/// </summary>
- public double Duration { get { return _duration; } }
+ public double Duration
+ {
+ get
+ {
+ return handle.Duration;
+ }
+ }
public string Id
{
get
{
- if (string.IsNullOrEmpty(_id))
- {
- string id;
- var err = Interop.Route.GetRouteId(handle, out id);
- if (err.WarnIfFailed("Failed to get route id"))
- {
- _id = id;
- }
- }
- return _id;
+ return handle.Id;
}
}
/// <summary>
/// Transport Mode for this route
/// </summary>
- public TransportMode Mode { get { return (TransportMode)_transportMode; } }
+ public TransportMode Mode
+ {
+ get
+ {
+ return (TransportMode)handle.TransportMode;
+ }
+ }
/// <summary>
/// Origin coordinates for this route
@@ -114,15 +91,7 @@ namespace Tizen.Maps
{
get
{
- if (_origin != null) return _origin;
-
- IntPtr originHandle;
- var err = Interop.Route.GetOrigin(handle, out originHandle);
- if (err.WarnIfFailed("Failed to get origin for the route"))
- {
- _origin = new Geocoordinates(originHandle);
- }
- return _origin;
+ return new Geocoordinates(handle.Origin);
}
}
@@ -133,86 +102,63 @@ namespace Tizen.Maps
{
get
{
- if (_path != null) return _path;
-
- _path = new List<Geocoordinates>();
- Interop.Route.RoutePathCallback callback = (index, total, coordinateHandle, userData) =>
- {
- _path.Add(new Geocoordinates(coordinateHandle));
- return true;
- };
-
- var err = Interop.Route.ForeachPath(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get path coordinates for this route");
- return _path;
+ var path = new List<Geocoordinates>();
+ handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle)));
+ return path;
}
}
/// <summary>
- /// All properties attached with this route
+ /// Segment list for this route
/// </summary>
- public IDictionary<string, string> Properties
+ public IEnumerable<RouteSegment> Segments
{
get
{
- if (_properties != null) return _properties;
- _properties = new Dictionary<string, string>();
- Interop.Route.RoutePropertiesCallback callback = (index, total, key, value, userData) =>
- {
- _properties[key] = value;
- return true;
- };
- var err = Interop.Route.ForeachProperty(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get all properties for this route");
-
- return _properties;
+ var segments = new List<RouteSegment>();
+ handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle)));
+ return segments;
}
}
/// <summary>
- /// Segment list for this route
+ /// Distance unit for this route
/// </summary>
- public IEnumerable<RouteSegment> Segments
+ public DistanceUnit Unit
{
get
{
- if (_segments != null) return _segments;
-
- _segments = new List<RouteSegment>();
- Interop.Route.RouteSegmentCallback callback = (index, total, segmentHandle, userData) =>
- {
- _segments.Add(new RouteSegment(segmentHandle));
- return true;
- };
-
- var err = Interop.Route.ForeachSegment(handle, callback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get path segments for this route");
- return _segments;
+ return (DistanceUnit)handle.Unit;
}
}
/// <summary>
- /// Distance unit for this route
- /// </summary>
- public DistanceUnit Unit { get { return (DistanceUnit)_unit; } }
-
- /// <summary>
/// Bounding area for this route
/// </summary>
private Area BoundingBox
{
get
{
- if (_bondingBox != null) return _bondingBox;
-
- IntPtr areaHandle;
- var err = Interop.Route.GetBoundingBox(handle, out areaHandle);
- if (err.WarnIfFailed("Failed to get bonding box for the route"))
- {
- _bondingBox = new Area(areaHandle);
- }
- return _bondingBox;
+ return new Area(handle.BoundingBox);
}
}
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
}
}
diff --git a/Tizen.Maps/Tizen.Maps/RouteManeuver.cs b/Tizen.Maps/Tizen.Maps/RouteManeuver.cs
index 1b0e8fd..147738e 100755
--- a/Tizen.Maps/Tizen.Maps/RouteManeuver.cs
+++ b/Tizen.Maps/Tizen.Maps/RouteManeuver.cs
@@ -25,56 +25,23 @@ namespace Tizen.Maps
{
private Interop.RouteDirection _direction;
private Interop.RouteTurnType _turntype;
- private Geocoordinates _position;
- private string _road = string.Empty;
- private string _instruction = string.Empty;
- private string _locale = string.Empty;
+ private Geocoordinates _coordinates;
+ private string _road;
+ private string _instruction;
+ private string _locale;
private int _timeToNextInstruction;
private double _distanceToNextInstruction;
- internal RouteManeuver(IntPtr nativeHandle)
+ internal RouteManeuver(Interop.RouteManeuverHandle handle)
{
- var handle = new Interop.RouteManeuverHandle(nativeHandle);
-
- var err = Interop.RouteManeuver.GetDirectionId(handle, out _direction);
- err.WarnIfFailed("Failed to get direction type for this maneuver");
-
- err = Interop.RouteManeuver.GetTurnType(handle, out _turntype);
- err.WarnIfFailed("Failed to get turn type for this maneuver");
-
- err = Interop.RouteManeuver.GetTimeToNextInstruction(handle, out _timeToNextInstruction);
- err.WarnIfFailed("Failed to get time to next instruction for this maneuver");
-
- err = Interop.RouteManeuver.GetDistanceToNextInstruction(handle, out _distanceToNextInstruction);
- err.WarnIfFailed("Failed to get distance to next instruction for this maneuver");
-
- string instruction;
- err = Interop.RouteManeuver.GetInstructionText(handle, out instruction);
- if (err.WarnIfFailed("Failed to get instruction text for this maneuver"))
- {
- _instruction = instruction;
- }
-
- string locale;
- err = Interop.RouteManeuver.GetLocale(handle, out locale);
- if (err.WarnIfFailed("Failed to get locale for this maneuver"))
- {
- _locale = locale;
- }
-
- string road;
- err = Interop.RouteManeuver.GetRoadName(handle, out road);
- if (err.WarnIfFailed("Failed to get road name for this maneuver"))
- {
- _road = road;
- }
-
- IntPtr positionHandle;
- err = Interop.RouteManeuver.GetPosition(handle, out positionHandle);
- if (err.WarnIfFailed("Failed to get position for this maneuver"))
- {
- _position = new Geocoordinates(positionHandle);
- }
+ _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>
@@ -90,22 +57,22 @@ namespace Tizen.Maps
/// <summary>
/// Position for this maneuver
/// </summary>
- public Geocoordinates Position { get { return _position; } }
+ public Geocoordinates Position { get { return _coordinates; } }
/// <summary>
/// Name of the road for this maneuver
/// </summary>
- public string Road { get { return string.IsNullOrEmpty(_road) ? "" : _road; } }
+ public string Road { get { return _road; } }
/// <summary>
/// Instruction text for this maneuver
/// </summary>
- public string Instruction { get { return string.IsNullOrEmpty(_instruction) ? "" : _instruction; } }
+ public string Instruction { get { return _instruction; } }
/// <summary>
/// Locale for this maneuver
/// </summary>
- public string Locale { get { return string.IsNullOrEmpty(_locale) ? "" : _locale; } }
+ public string Locale { get { return _locale; } }
/// <summary>
/// Time to next instruction for this maneuver
diff --git a/Tizen.Maps/Tizen.Maps/RouteSearchPreference.cs b/Tizen.Maps/Tizen.Maps/RouteSearchPreference.cs
deleted file mode 100755
index 5704afc..0000000
--- a/Tizen.Maps/Tizen.Maps/RouteSearchPreference.cs
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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>
- /// Preferences for route search requests
- /// </summary>
- public class RouteSearchPreference
- {
- internal Interop.PreferenceHandle handle;
-
- private Interop.DistanceUnit? _distanceUnit;
- private Interop.RouteOptimization? _routeOptimization;
- private Interop.RouteTransportMode? _transportMode;
- private Interop.RouteFeatureWeight? _featureWeight;
- private Interop.RouteRequestFeature? _requestFeature;
- private bool? _searchAlternativeRoutes;
-
- /// <summary>
- /// Constructor for search preference
- /// </summary>
- public RouteSearchPreference()
- {
- IntPtr nativeHandle;
- var err = Interop.Preference.Create(out nativeHandle);
- err.ThrowIfFailed("Failed to create native preference handle");
-
- handle = new Interop.PreferenceHandle(nativeHandle);
- }
-
- internal RouteSearchPreference(Interop.PreferenceHandle handle)
- {
- this.handle = handle;
- }
-
- /// <summary>
- /// Distance unit
- /// </summary>
- public DistanceUnit Unit
- {
- get
- {
- if (_distanceUnit == null)
- {
- var err = Interop.Preference.GetDistanceUnit(handle, out _distanceUnit);
- err.WarnIfFailed("Failed to get distance unit for this preference");
- }
- return (DistanceUnit)_distanceUnit;
- }
- set
- {
- var err = Interop.Preference.SetDistanceUnit(handle, (Interop.DistanceUnit)value);
- if (err.WarnIfFailed("Failed to set distance unit for this preference"))
- {
- _distanceUnit = (Interop.DistanceUnit)value;
- }
- }
- }
-
- /// <summary>
- /// Selected route optimization
- /// </summary>
- public RouteOptimization Optimization
- {
- get
- {
- if (_routeOptimization == null)
- {
- var err = Interop.Preference.GetRouteOptimization(handle, out _routeOptimization);
- err.WarnIfFailed("Failed to get route optimization for this preference");
- }
- return (RouteOptimization)_routeOptimization;
- }
- set
- {
- var err = Interop.Preference.SetRouteOptimization(handle, (Interop.RouteOptimization)value);
- if (err.WarnIfFailed("Failed to set route optimization for this preference"))
- {
- _routeOptimization = (Interop.RouteOptimization)value;
- }
- }
- }
-
- /// <summary>
- /// Route transport mode
- /// </summary>
- public TransportMode Mode
- {
- get
- {
- if (_transportMode == null)
- {
- var err = Interop.Preference.GetRouteTransportMode(handle, out _transportMode);
- err.WarnIfFailed("Failed to get route transport mode for this preference");
- }
- return (TransportMode)_transportMode;
- }
- set
- {
- var err = Interop.Preference.SetRouteTransportMode(handle, (Interop.RouteTransportMode)value);
- if (err.WarnIfFailed("Failed to set route transport mode for this preference"))
- {
- _transportMode = (Interop.RouteTransportMode)value;
- }
- }
- }
-
- /// <summary>
- /// Route feature weight
- /// </summary>
- public RouteFeatureWeight RouteFeatureWeight
- {
- get
- {
- if (_featureWeight == null)
- {
- var err = Interop.Preference.GetRouteFeatureWeight(handle, out _featureWeight);
- err.WarnIfFailed("Failed to get route feature weight for this preference");
- }
- return (RouteFeatureWeight)_featureWeight;
- }
- set
- {
- var err = Interop.Preference.SetRouteFeatureWeight(handle, (Interop.RouteFeatureWeight)value);
- if (err.WarnIfFailed("Failed to set route feature weight for this preference"))
- {
- _featureWeight = (Interop.RouteFeatureWeight)value;
- }
- }
- }
-
- /// <summary>
- /// Route feature
- /// </summary>
- public RouteFeature RouteFeature
- {
- get
- {
- if (_requestFeature == null)
- {
- var err = Interop.Preference.GetRouteFeature(handle, out _requestFeature);
- err.WarnIfFailed("Failed to get route feature for this preference");
- }
- return (RouteFeature)_requestFeature;
- }
- set
- {
- var err = Interop.Preference.SetRouteFeature(handle, (Interop.RouteRequestFeature)value);
- if (err.WarnIfFailed("Failed to set route request feature for this preference"))
- {
- _requestFeature = (Interop.RouteRequestFeature)value;
- }
- }
- }
-
- /// <summary>
- /// Indicate if search for alternative routes is enabled.
- /// </summary>
- public bool SearchAlternativeRoutes
- {
- get
- {
- if (_searchAlternativeRoutes == null)
- {
- var err = Interop.Preference.GetRouteAlternativesEnabled(handle, out _searchAlternativeRoutes);
- err.WarnIfFailed("Failed to get preference for alternative route search");
- }
- return (bool)_searchAlternativeRoutes;
- }
- set
- {
- var err = Interop.Preference.SetRouteAlternativesEnabled(handle, value);
- if (err.WarnIfFailed("Failed to enable alternative route searches"))
- {
- _searchAlternativeRoutes = value;
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs b/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs
index 2e95560..5b70bd9 100755
--- a/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs
+++ b/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs
@@ -25,27 +25,25 @@ namespace Tizen.Maps
/// </summary>
public class RouteSearchRequest : MapServiceRequest<Route>
{
- private Interop.Service.SearchRouteCallback _responseCallback;
+ private Interop.SearchRouteCallback _routeCallback;
private List<Route> _routeList = new List<Route>();
-
- private Geocoordinates _from;
private Geocoordinates _to;
+ private Geocoordinates _from;
private List<Geocoordinates> _waypoints = new List<Geocoordinates>();
- private RouteSearchPreference _preferences;
internal RouteSearchRequest(MapService service, Geocoordinates from, Geocoordinates to) : this(service, ServiceRequestType.SearchByEndPoint)
{
- _from = from;
_to = to;
+ _from = from;
startExecutionAction = new Action(() =>
{
int requestID;
- errMessage = string.Format("Failed to get route list for given origin {0} and destination {1}", _from, _to);
+ errMessage = $"Failed to get route list for given origin {_from} and destination {_to}";
if (_waypoints?.Count == 0)
{
_type = ServiceRequestType.SearchByEndPoint;
- errorCode = Interop.Service.SearchRoute(_service, _from.handle, _to.handle, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ 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));
@@ -56,7 +54,7 @@ namespace Tizen.Maps
_type = ServiceRequestType.SearchWithWaypoints;
var waypoints = GetCoordinateListForWaypoints();
- errorCode = Interop.Service.SearchRouteWaypoints(_service, waypoints, waypoints.Length, _preferences.handle, _responseCallback, IntPtr.Zero, out requestID);
+ 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));
@@ -69,12 +67,14 @@ namespace Tizen.Maps
private RouteSearchRequest(MapService service, ServiceRequestType type) : base(service, type)
{
- _preferences = service.RouteSearchPreferences;
- _responseCallback = (result, id, index, total, routeHandle, userData) =>
+ // 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)
{
@@ -84,6 +84,7 @@ namespace Tizen.Maps
}
else
{
+ // If search is failed, the value of total is 0 and route is NULL.
_requestTask?.TrySetException(errorCode.GetException(errMessage));
return false;
}
diff --git a/Tizen.Maps/Tizen.Maps/RouteSegment.cs b/Tizen.Maps/Tizen.Maps/RouteSegment.cs
index 37b491a..2072b55 100755
--- a/Tizen.Maps/Tizen.Maps/RouteSegment.cs
+++ b/Tizen.Maps/Tizen.Maps/RouteSegment.cs
@@ -25,65 +25,25 @@ namespace Tizen.Maps
/// </summary>
public class RouteSegment
{
- internal Interop.RouteSegmentHandle handle;
- private Area _bondingBox;
+ private Geocoordinates _origin;
private Geocoordinates _destination;
private double _distance;
- private long _duration;
- private List<RouteManeuver> _manuevers;
- private Geocoordinates _origin;
- private List<Geocoordinates> _path;
-
- internal RouteSegment(IntPtr nativeHandle)
- {
- handle = new Interop.RouteSegmentHandle(nativeHandle);
-
- var err = Interop.RouteSegment.GetDistance(handle, out _distance);
- err.WarnIfFailed("Failed to get distance for the segment");
-
- err = Interop.RouteSegment.GetDuration(handle, out _duration);
- err.WarnIfFailed("Failed to get duration for the segment");
+ private double _duration;
+ private Area _boundingBox;
- IntPtr areaHandle;
- err = Interop.RouteSegment.GetBoundingBox(handle, out areaHandle);
- if (err.WarnIfFailed("Failed to get bonding box for the segment"))
- {
- _bondingBox = new Area(areaHandle);
- }
+ private List<RouteManeuver> _maneuvers = new List<RouteManeuver>();
+ private List<Geocoordinates> _path = new List<Geocoordinates>();
- IntPtr originHandle;
- err = Interop.RouteSegment.GetOrigin(handle, out originHandle);
- if (err.WarnIfFailed("Failed to get origin for the segment"))
- {
- _origin = new Geocoordinates(originHandle);
- }
-
- IntPtr destinationHandle;
- err = Interop.RouteSegment.GetDestination(handle, out destinationHandle);
- if (err.WarnIfFailed("Failed to get destination for the segment"))
- {
- _destination = new Geocoordinates(destinationHandle);
- }
-
- _manuevers = new List<RouteManeuver>();
- Interop.RouteSegment.SegmentManeuverCallback maneuvarCallback = (index, total, maneuverHandle, userData) =>
- {
- _manuevers.Add(new RouteManeuver(maneuverHandle));
- return true;
- };
-
- err = Interop.RouteSegment.ForeachManeuver(handle, maneuvarCallback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get path maneuver for this segment");
-
- _path = new List<Geocoordinates>();
- Interop.RouteSegment.SegmentPathCallback pathcallback = (index, total, coordinateHandle, userData) =>
- {
- _path.Add(new Geocoordinates(coordinateHandle));
- return true;
- };
-
- err = Interop.RouteSegment.ForeachPath(handle, pathcallback, IntPtr.Zero);
- err.WarnIfFailed("Failed to get path coordinates for this segment");
+ 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>
@@ -109,7 +69,7 @@ namespace Tizen.Maps
/// <summary>
/// Maneuver list for this segment path
/// </summary>
- public IEnumerable<RouteManeuver> Maneuvers { get { return _manuevers; } }
+ public IEnumerable<RouteManeuver> Maneuvers { get { return _maneuvers; } }
/// <summary>
/// Coordinates list for this segment path
@@ -119,6 +79,6 @@ namespace Tizen.Maps
/// <summary>
/// Bounding area for this segment
/// </summary>
- private Area BoundingBox { get { return _bondingBox; } }
+ private Area BoundingBox { get { return _boundingBox; } }
}
}
diff --git a/Tizen.Maps/Tizen.Maps/SearchPreference.cs b/Tizen.Maps/Tizen.Maps/SearchPreference.cs
new file mode 100755
index 0000000..b91a9c6
--- /dev/null
+++ b/Tizen.Maps/Tizen.Maps/SearchPreference.cs
@@ -0,0 +1,218 @@
+/*
+ * 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>
+ public class SearchPreference : IGeocodePreference, IPlaceSearchPreference, IRouteSearchPreference, IDisposable
+ {
+ internal Interop.PreferenceHandle handle;
+ private IReadOnlyDictionary<string, string> _properties = new Dictionary<string, string>();
+
+ /// <summary>
+ /// Constructor for search preference
+ /// </summary>
+ public SearchPreference()
+ {
+ handle = new Interop.PreferenceHandle();
+ }
+
+ /// <summary>
+ /// Constructor for search preference
+ /// </summary>
+ internal SearchPreference(Interop.PreferenceHandle nativeHandle)
+ {
+ handle = nativeHandle;
+ }
+
+ /// <summary>
+ /// Preferred language
+ /// </summary>
+ /// <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 e.g. "ko-KR"
+ /// </remarks>
+ public string Language
+ {
+ get
+ {
+ return handle.Language;
+ }
+ set
+ {
+ handle.Language = value;
+ }
+ }
+
+ /// <summary>
+ /// Maximum result count for a service request
+ /// </summary>
+ /// <remarks>Setting negative value will not have any effect on MaxResults value</remarks>
+ public int MaxResults
+ {
+ get
+ {
+ return handle.MaxResult;
+ }
+ set
+ {
+ handle.MaxResult = value;
+ }
+ }
+
+ /// <summary>
+ /// Distance unit
+ /// </summary>
+ public DistanceUnit Unit
+ {
+ get
+ {
+ return (DistanceUnit)handle.Unit;
+ }
+ set
+ {
+ handle.Unit = (Interop.DistanceUnit)value;
+ }
+ }
+
+ /// <summary>
+ /// Preferred country
+ /// </summary>
+ public string CountryCode
+ {
+ get
+ {
+ return handle.CountryCode;
+ }
+ set
+ {
+ handle.CountryCode = value;
+ }
+ }
+
+ /// <summary>
+ /// Search properties as key value pair
+ /// </summary>
+ public IReadOnlyDictionary<string, string> Properties
+ {
+ get
+ {
+ return _properties;
+ }
+ set
+ {
+ _properties = value;
+ }
+ }
+
+ /// <summary>
+ /// Selected route optimization
+ /// </summary>
+ public RouteOptimization Optimization
+ {
+ get
+ {
+ return (RouteOptimization)handle.Optimization;
+ }
+ set
+ {
+ handle.Optimization = (Interop.RouteOptimization)value;
+ }
+ }
+
+ /// <summary>
+ /// Route transport mode
+ /// </summary>
+ public TransportMode Mode
+ {
+ get
+ {
+ return (TransportMode)handle.TransportMode;
+ }
+ set
+ {
+ handle.TransportMode = (Interop.RouteTransportMode)value;
+ }
+ }
+
+ /// <summary>
+ /// Route feature weight
+ /// </summary>
+ public RouteFeatureWeight RouteFeatureWeight
+ {
+ get
+ {
+ return (RouteFeatureWeight)handle.FeatureWeight;
+ }
+ set
+ {
+ handle.FeatureWeight = (Interop.RouteFeatureWeight)value;
+ }
+ }
+
+ /// <summary>
+ /// Route feature
+ /// </summary>
+ public RouteFeature RouteFeature
+ {
+ get
+ {
+ return (RouteFeature)handle.Feature;
+ }
+ set
+ {
+ handle.Feature = (Interop.RouteRequestFeature)value;
+ }
+ }
+
+ /// <summary>
+ /// Indicate if search for alternative routes is enabled.
+ /// </summary>
+ public bool SearchAlternativeRoutes
+ {
+ get
+ {
+ return handle.AlternativesEnabled;
+ }
+ set
+ {
+ handle.AlternativesEnabled = value;
+ }
+ }
+
+ #region IDisposable Support
+ private bool _disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposedValue)
+ {
+ handle.Dispose();
+ _disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/packaging/csapi-maps.spec b/packaging/csapi-maps.spec
index 2d3530a..fcfbc6e 100644
--- a/packaging/csapi-maps.spec
+++ b/packaging/csapi-maps.spec
@@ -8,7 +8,7 @@
Name: csapi-maps
Summary: Tizen Map Service API for C#
-Version: 1.0.5
+Version: 1.0.6
Release: 1
Group: Development/Libraries
License: Apache-2.0