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 /// <exception cref="ArgumentException">Throws if input coordinates or objectToContain are invalid</exception>
35 public Overlay(Geocoordinates coordinates, EvasObject objectToContain) : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal)
39 internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
41 var err = Interop.ErrorCode.InvalidParameter;
42 if (coordinates == null || objectToContain == null)
44 err.ThrowIfFailed("given coordinates or parent evas object is null");
46 handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, type);
49 public override bool IsVisible
51 get { return handle.IsVisible; }
52 set { handle.IsVisible = value; }
56 /// Geographical coordinates for overlay
58 public Geocoordinates Coordinates
62 return new Geocoordinates(handle.Coordinates);
66 // Overlay takes ownership of the native handle.
67 handle.Coordinates = value.handle;
68 value.handle.HasOwnership = false;
73 /// Minimum zoom level for overlay
75 public int MinimumZoomLevel
79 return handle.MinZoomLevel;
83 handle.MinZoomLevel = value;
88 /// Maximum zoom lever for overlay
90 public int MaximumZoomLevel
94 return handle.MaxZoomLevel;
98 handle.MaxZoomLevel = value;
102 // Overlay object does not support click events
103 internal override void HandleClickedEvent()
105 throw new NotSupportedException("Overlay object does not support click events");
108 internal override void InvalidateMapObject()
113 internal override Interop.ViewObjectHandle GetHandle()
118 #region IDisposable Support
119 private bool _disposedValue = false;
121 protected virtual void Dispose(bool disposing)
126 _disposedValue = true;
130 public void Dispose()
133 GC.SuppressFinalize(this);
139 /// Bubble overlay map object
141 public class BubbleOverlay : Overlay
144 /// Creates Box overlay
146 /// <exception cref="ArgumentException">Throws if input coordinates or objectToContain are invalid</exception>
147 public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain) : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble)
153 /// Box Overlay map object
155 public class BoxOverlay : Overlay
158 /// Creates Box overlay
160 /// <exception cref="ArgumentException">Throws if input coordinates or objectToContain are invalid</exception>
161 public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain) : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)