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;
28 private EvasObject _containedObject;
31 /// Creates normal overlay map object
33 /// <param name="coordinates"></param>
34 /// <param name="objectToContain"></param>
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");
47 _containedObject = objectToContain;
48 handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, Interop.ViewOverlayType.Normal);
51 public override bool IsVisible
53 get { return handle.IsVisible; }
54 set { handle.IsVisible = value; }
58 /// Geographical coordinates for overlay
60 public Geocoordinates Coordinates
64 return new Geocoordinates(handle.Coordinates);
68 // Overlay takes ownership of the native handle.
69 handle.Coordinates = value.handle;
70 value.handle.HasOwnership = false;
75 /// Minimum zoom level for overlay
77 public int MinimumZoomLevel
81 return handle.MinZoomLevel;
85 handle.MinZoomLevel = value;
90 /// Maximum zoom lever for overlay
92 public int MaximumZoomLevel
96 return handle.MaxZoomLevel;
100 handle.MaxZoomLevel = value;
104 // Overlay object does not support click events
105 internal override void HandleClickedEvent()
107 throw new NotSupportedException("Overlay object does not support click events");
110 internal override void InvalidateMapObject()
115 internal override Interop.ViewObjectHandle GetHandle()
120 #region IDisposable Support
121 private bool _disposedValue = false;
123 protected virtual void Dispose(bool disposing)
128 _disposedValue = true;
132 public void Dispose()
140 /// Bubble overlay map object
142 public class BubbleOverlay : Overlay
144 public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain) : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble)
150 /// Box Overlay map object
152 public class BoxOverlay : Overlay
155 /// Creates Box overlay
157 public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain) : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)