2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
21 internal static partial class Interop
23 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_type")]
24 internal static extern ErrorCode GetType(this MarkerHandle /* maps_view_object_h */ marker, out ViewMarkerType /* maps_view_marker_type_e */ type);
26 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_coordinates")]
27 internal static extern ErrorCode GetCoordinates(this MarkerHandle /* maps_view_object_h */ marker, out IntPtr /* maps_coordinates_h */ coordinates);
29 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_coordinates")]
30 internal static extern ErrorCode SetCoordinates(this MarkerHandle /* maps_view_object_h */ marker, CoordinatesHandle /* maps_coordinates_h */ coordinates);
32 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_image_file")]
33 internal static extern ErrorCode GetImageFile(this MarkerHandle /* maps_view_object_h */ marker, out string filePath);
35 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_image_file")]
36 internal static extern ErrorCode SetImageFile(this MarkerHandle /* maps_view_object_h */ marker, string filePath);
38 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_z_order")]
39 internal static extern ErrorCode GetZOrder(this MarkerHandle /* maps_view_object_h */ marker, out int zOrder);
41 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_z_order")]
42 internal static extern ErrorCode SetZOrder(this MarkerHandle /* maps_view_object_h */ marker, int zOrder);
44 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_size")]
45 internal static extern ErrorCode GetSize(this MarkerHandle /* maps_view_object_h */ marker, out int width, out int height);
47 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_resize")]
48 internal static extern ErrorCode Resize(this MarkerHandle /* maps_view_object_h */ marker, int width, int height);
50 internal static ErrorCode GetSize(this MarkerHandle /* maps_view_object_h */ marker, out Size size)
52 size = new Size(0, 0);
53 return GetSize(marker, out size.Width, out size.Height);
56 internal static ErrorCode SetSize(this MarkerHandle /* maps_view_object_h */ marker, Size size)
58 return Resize(marker, size.Width, size.Height);
61 internal class MarkerHandle : ViewObjectHandle
63 [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_marker")]
64 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);
66 internal ViewMarkerType Type
68 get { return NativeGet<ViewMarkerType>(this.GetType); }
71 internal string ImageFile
73 get { return NativeGet(this.GetImageFile); }
74 set { NativeSet(this.SetImageFile, value); }
79 get { return NativeGet<int>(this.GetZOrder); }
80 set { NativeSet(this.SetZOrder, value); }
83 internal Size MarkerSize
85 get { return NativeGet<Size>(this.GetSize); }
86 set { NativeSet(this.SetSize, value); }
89 internal CoordinatesHandle Coordinates
91 get { return NativeGet(this.GetCoordinates, CoordinatesHandle.Create); }
92 set { NativeSet(this.SetCoordinates, value); }
95 internal MarkerHandle(CoordinatesHandle coordinates, string imagePath, ViewMarkerType type) : base(IntPtr.Zero, true)
97 var clonedCoordinatesHandle = CoordinatesHandle.CloneFrom(coordinates);
98 CreateMarker(clonedCoordinatesHandle, imagePath, type, out handle).ThrowIfFailed("Failed to create native handle for marker");
99 clonedCoordinatesHandle.HasOwnership = false;