Deprecating Tizen.Maps APIs (#5108)
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Tizen.Maps / Overlay.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using EvasObject = ElmSharp.EvasObject;
19
20 namespace Tizen.Maps
21 {
22     /// <summary>
23     /// Overlay map object.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     [Obsolete("Deprecated since API11. Might be removed in API13.")]
27     public class Overlay : MapObject, IDisposable
28     {
29         internal Interop.OverlayHandle handle;
30
31         /// <summary>
32         /// Creates a normal overlay map object.
33         /// </summary>
34         /// <since_tizen> 3 </since_tizen>
35         /// <param name="coordinates"></param>
36         /// <param name="objectToContain"></param>
37         /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid.</exception>
38         [Obsolete("Deprecated since API10. Might be removed in API12.")]
39         public Overlay(Geocoordinates coordinates, EvasObject objectToContain)
40             : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal)
41         {
42         }
43
44         internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
45         {
46             var err = Interop.ErrorCode.InvalidParameter;
47             if (coordinates == null || objectToContain == null)
48             {
49                 err.ThrowIfFailed("given coordinates or parent evas object is null");
50             }
51             handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, type);
52         }
53
54         /// <summary>
55         /// Destroy the Overlay object.
56         /// </summary>
57         ~Overlay()
58         {
59             Dispose(false);
60         }
61
62         /// <summary>
63         /// Gets or sets the visibility of an overlay map object.
64         /// </summary>
65         /// <since_tizen> 3 </since_tizen>
66         [Obsolete("Deprecated since API11. Might be removed in API13.")]
67         public override bool IsVisible
68         {
69             get { return handle.IsVisible; }
70             set { handle.IsVisible = value; }
71         }
72
73         /// <summary>
74         /// Gets or sets geographical coordinates for an overlay map object.
75         /// </summary>
76         /// <since_tizen> 3 </since_tizen>
77         [Obsolete("Deprecated since API11. Might be removed in API13.")]
78         public Geocoordinates Coordinates
79         {
80             get
81             {
82                 return new Geocoordinates(handle.Coordinates);
83             }
84             set
85             {
86                 // Overlay takes ownership of the native handle.
87                 handle.Coordinates = value.handle;
88                 value.handle.HasOwnership = false;
89             }
90         }
91
92         /// <summary>
93         /// Gets or sets minimum zoom level for an overlay map object.
94         /// </summary>
95         /// <since_tizen> 3 </since_tizen>
96         [Obsolete("Deprecated since API10. Might be removed in API12.")]
97         public int MinimumZoomLevel
98         {
99             get
100             {
101                 return handle.MinZoomLevel;
102             }
103             set
104             {
105                 handle.MinZoomLevel = value;
106             }
107         }
108
109         /// <summary>
110         /// Gets or sets maximum zoom lever for an overlay map object.
111         /// </summary>
112         /// <since_tizen> 3 </since_tizen>
113         [Obsolete("Deprecated since API10. Might be removed in API12.")]
114         public int MaximumZoomLevel
115         {
116             get
117             {
118                 return handle.MaxZoomLevel;
119             }
120             set
121             {
122                 handle.MaxZoomLevel = value;
123             }
124         }
125
126         // Overlay object does not support click events
127         internal override void HandleClickedEvent()
128         {
129             throw new NotSupportedException("Overlay object does not support click events");
130         }
131
132         internal override void InvalidateMapObject()
133         {
134             handle = null;
135         }
136
137         internal override Interop.ViewObjectHandle GetHandle()
138         {
139             return handle;
140         }
141
142         #region IDisposable Support
143         private bool _disposedValue = false;
144
145         /// <summary>
146         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
147         /// </summary>
148         /// <param name="disposing">If true, managed and unmanaged resources can be disposed, otherwise only unmanaged resources can be disposed.</param>
149         /// <since_tizen> 3 </since_tizen>
150         [Obsolete("Deprecated since API11. Might be removed in API13.")]
151         protected virtual void Dispose(bool disposing)
152         {
153             if (!_disposedValue)
154             {
155                 handle?.Dispose();
156                 _disposedValue = true;
157             }
158         }
159
160         /// <summary>
161         /// Releases all the resources used by this object.
162         /// </summary>
163         /// <since_tizen> 3 </since_tizen>
164         [Obsolete("Deprecated since API11. Might be removed in API13.")]
165         public void Dispose()
166         {
167             Dispose(true);
168             GC.SuppressFinalize(this);
169         }
170         #endregion
171     }
172
173     /// <summary>
174     /// The bubble overlay map object.
175     /// </summary>
176     /// <since_tizen> 3 </since_tizen>
177     [Obsolete("Deprecated since API11. Might be removed in API13.")]
178     public class BubbleOverlay : Overlay
179     {
180         /// <summary>
181         /// Creates a bubble overlay.
182         /// </summary>
183         /// <since_tizen> 3 </since_tizen>
184         /// <param name="coordinates">The geographical coordinates to be pointed.</param>
185         /// <param name="objectToContain">The EvasObject to be shown.</param>
186         /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
187         /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid.</exception>
188         [Obsolete("Deprecated since API11. Might be removed in API13.")]
189         public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain)
190             : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble)
191         {
192         }
193     }
194
195     /// <summary>
196     /// The box overlay map object.
197     /// </summary>
198     /// <since_tizen> 3 </since_tizen>
199     [Obsolete("Deprecated since API11. Might be removed in API13.")]
200     public class BoxOverlay : Overlay
201     {
202         /// <summary>
203         /// Creates a box overlay.
204         /// </summary>
205         /// <since_tizen> 3 </since_tizen>
206         /// <param name="coordinates">The geographical coordinates to be pointed.</param>
207         /// <param name="objectToContain">The EvasObject to be shown.</param>
208         /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
209         /// <exception cref="ArgumentException">Thrown when the input coordinates or objectToContain are invalid</exception>
210         [Obsolete("Deprecated since API11. Might be removed in API13.")]
211         public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain)
212             : base(coordinates, objectToContain, Interop.ViewOverlayType.Box)
213         {
214         }
215     }
216 }