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 EvasObject = ElmSharp.EvasObject;
23 /// Overlay map object.
25 /// <since_tizen> 3 </since_tizen>
26 public class Overlay : MapObject, IDisposable
28 internal Interop.OverlayHandle handle;
31 /// Creates a normal overlay map object.
33 /// <since_tizen> 3 </since_tizen>
34 /// <param name="coordinates"></param>
35 /// <param name="objectToContain"></param>
36 /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid.</exception>
37 public Overlay(Geocoordinates coordinates, EvasObject objectToContain)
38 : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal)
42 internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
44 var err = Interop.ErrorCode.InvalidParameter;
45 if (coordinates == null || objectToContain == null)
47 err.ThrowIfFailed("given coordinates or parent evas object is null");
49 handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, type);
53 /// Gets or sets the visibility of an overlay map object.
55 /// <since_tizen> 3 </since_tizen>
56 public override bool IsVisible
58 get { return handle.IsVisible; }
59 set { handle.IsVisible = value; }
63 /// Gets or sets geographical coordinates for an overlay map object.
65 /// <since_tizen> 3 </since_tizen>
66 public Geocoordinates Coordinates
70 return new Geocoordinates(handle.Coordinates);
74 // Overlay takes ownership of the native handle.
75 handle.Coordinates = value.handle;
76 value.handle.HasOwnership = false;
81 /// Gets or sets minimum zoom level for an overlay map object.
83 /// <since_tizen> 3 </since_tizen>
84 public int MinimumZoomLevel
88 return handle.MinZoomLevel;
92 handle.MinZoomLevel = value;
97 /// Gets or sets maximum zoom lever for an overlay map object.
99 /// <since_tizen> 3 </since_tizen>
100 public int MaximumZoomLevel
104 return handle.MaxZoomLevel;
108 handle.MaxZoomLevel = value;
112 // Overlay object does not support click events
113 internal override void HandleClickedEvent()
115 throw new NotSupportedException("Overlay object does not support click events");
118 internal override void InvalidateMapObject()
123 internal override Interop.ViewObjectHandle GetHandle()
128 #region IDisposable Support
129 private bool _disposedValue = false;
132 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
134 /// <since_tizen> 3 </since_tizen>
135 /// <param name="disposing">If true, managed and unmanaged resources can be disposed, otherwise only unmanaged resources can be disposed.</param>
136 protected virtual void Dispose(bool disposing)
141 _disposedValue = true;
146 /// Releases all the resources used by this object.
148 /// <since_tizen> 3 </since_tizen>
149 public void Dispose()
152 GC.SuppressFinalize(this);
158 /// The bubble overlay map object.
160 /// <since_tizen> 3 </since_tizen>
161 public class BubbleOverlay : Overlay
164 /// Creates a bubble overlay.
166 /// <since_tizen> 3 </since_tizen>
167 /// <param name="coordinates">The geographical coordinates to be pointed.</param>
168 /// <param name="objectToContain">The EvasObject to be shown.</param>
169 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
170 /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid.</exception>
171 public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain)
172 : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble)
178 /// The box overlay map object.
180 /// <since_tizen> 3 </since_tizen>
181 public class BoxOverlay : Overlay
184 /// Creates a box overlay.
186 /// <since_tizen> 3 </since_tizen>
187 /// <param name="coordinates">The geographical coordinates to be pointed.</param>
188 /// <param name="objectToContain">The EvasObject to be shown.</param>
189 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
190 /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid</exception>
191 public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain)
192 : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)