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 public class Overlay : MapObject, IDisposable
27 internal Interop.OverlayHandle handle;
30 /// Creates a normal overlay map object.
32 /// <param name="coordinates"></param>
33 /// <param name="objectToContain"></param>
34 /// <exception cref="ArgumentException">Thrown when input coordinates or objectToContain are invalid</exception>
35 public Overlay(Geocoordinates coordinates, EvasObject objectToContain)
36 : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal)
40 internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
42 var err = Interop.ErrorCode.InvalidParameter;
43 if (coordinates == null || objectToContain == null)
45 err.ThrowIfFailed("given coordinates or parent evas object is null");
47 handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, type);
51 /// Gets or sets visibility of overlay map object.
53 public override bool IsVisible
55 get { return handle.IsVisible; }
56 set { handle.IsVisible = value; }
60 /// Gets or sets geographical coordinates for overlay map object.
62 public Geocoordinates Coordinates
66 return new Geocoordinates(handle.Coordinates);
70 // Overlay takes ownership of the native handle.
71 handle.Coordinates = value.handle;
72 value.handle.HasOwnership = false;
77 /// Gets or sets minimum zoom level for overlay map object.
79 public int MinimumZoomLevel
83 return handle.MinZoomLevel;
87 handle.MinZoomLevel = value;
92 /// Gets or sets maximum zoom lever for overlay map object.
94 public int MaximumZoomLevel
98 return handle.MaxZoomLevel;
102 handle.MaxZoomLevel = value;
106 // Overlay object does not support click events
107 internal override void HandleClickedEvent()
109 throw new NotSupportedException("Overlay object does not support click events");
112 internal override void InvalidateMapObject()
117 internal override Interop.ViewObjectHandle GetHandle()
122 #region IDisposable Support
123 private bool _disposedValue = false;
125 protected virtual void Dispose(bool disposing)
130 _disposedValue = true;
135 /// Releases all resources used by this object.
137 public void Dispose()
140 GC.SuppressFinalize(this);
146 /// Bubble overlay map object
148 public class BubbleOverlay : Overlay
151 /// Creates a Bubble overlay.
153 /// <param name="coordinates">The geographical coordinates to be pointed</param>
154 /// <param name="objectToContain">The EvasObject to be shown</param>
155 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
156 /// <exception cref="ArgumentException">Thrown when input coordinates or objectToContain are invalid</exception>
157 public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain)
158 : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble)
164 /// Box Overlay map object
166 public class BoxOverlay : Overlay
169 /// Creates a Box overlay.
171 /// <param name="coordinates">The geographical coordinates to be pointed</param>
172 /// <param name="objectToContain">The EvasObject to be shown</param>
173 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
174 /// <exception cref="ArgumentException">Thrown when input coordinates or objectToContain are invalid</exception>
175 public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain)
176 : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)