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 normal overlay map object
32 /// <param name="coordinates"></param>
33 /// <param name="objectToContain"></param>
34 public Overlay(Geocoordinates coordinates, EvasObject objectToContain) : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal)
38 internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
40 var err = Interop.ErrorCode.InvalidParameter;
41 if (coordinates == null || objectToContain == null)
43 err.ThrowIfFailed("given coordinates or parent evas object is null");
45 handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, Interop.ViewOverlayType.Normal);
48 public override bool IsVisible
50 get { return handle.IsVisible; }
51 set { handle.IsVisible = value; }
55 /// Geographical coordinates for overlay
57 public Geocoordinates Coordinates
61 return new Geocoordinates(handle.Coordinates);
65 // Overlay takes ownership of the native handle.
66 handle.Coordinates = value.handle;
67 value.handle.HasOwnership = false;
72 /// Minimum zoom level for overlay
74 public int MinimumZoomLevel
78 return handle.MinZoomLevel;
82 handle.MinZoomLevel = value;
87 /// Maximum zoom lever for overlay
89 public int MaximumZoomLevel
93 return handle.MaxZoomLevel;
97 handle.MaxZoomLevel = value;
101 // Overlay object does not support click events
102 internal override void HandleClickedEvent()
104 throw new NotSupportedException("Overlay object does not support click events");
107 internal override void InvalidateMapObject()
112 internal override Interop.ViewObjectHandle GetHandle()
117 #region IDisposable Support
118 private bool _disposedValue = false;
120 protected virtual void Dispose(bool disposing)
125 _disposedValue = true;
129 public void Dispose()
132 GC.SuppressFinalize(this);
138 /// Bubble overlay map object
140 public class BubbleOverlay : Overlay
142 public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain) : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble)
148 /// Box Overlay map object
150 public class BoxOverlay : Overlay
153 /// Creates Box overlay
155 public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain) : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)