Modify documentation of APIs
[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     public class Overlay : MapObject, IDisposable
26     {
27         internal Interop.OverlayHandle handle;
28
29         /// <summary>
30         /// Creates a normal overlay map object.
31         /// </summary>
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)
37         {
38         }
39
40         internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type)
41         {
42             var err = Interop.ErrorCode.InvalidParameter;
43             if (coordinates == null || objectToContain == null)
44             {
45                 err.ThrowIfFailed("given coordinates or parent evas object is null");
46             }
47             handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, type);
48         }
49
50         /// <summary>
51         /// Gets or sets visibility of overlay map object.
52         /// </summary>
53         public override bool IsVisible
54         {
55             get { return handle.IsVisible; }
56             set { handle.IsVisible = value; }
57         }
58
59         /// <summary>
60         /// Gets or sets geographical coordinates for overlay map object.
61         /// </summary>
62         public Geocoordinates Coordinates
63         {
64             get
65             {
66                 return new Geocoordinates(handle.Coordinates);
67             }
68             set
69             {
70                 // Overlay takes ownership of the native handle.
71                 handle.Coordinates = value.handle;
72                 value.handle.HasOwnership = false;
73             }
74         }
75
76         /// <summary>
77         /// Gets or sets minimum zoom level for overlay map object.
78         /// </summary>
79         public int MinimumZoomLevel
80         {
81             get
82             {
83                 return handle.MinZoomLevel;
84             }
85             set
86             {
87                 handle.MinZoomLevel = value;
88             }
89         }
90
91         /// <summary>
92         /// Gets or sets maximum zoom lever for overlay map object.
93         /// </summary>
94         public int MaximumZoomLevel
95         {
96             get
97             {
98                 return handle.MaxZoomLevel;
99             }
100             set
101             {
102                 handle.MaxZoomLevel = value;
103             }
104         }
105
106         // Overlay object does not support click events
107         internal override void HandleClickedEvent()
108         {
109             throw new NotSupportedException("Overlay object does not support click events");
110         }
111
112         internal override void InvalidateMapObject()
113         {
114             handle = null;
115         }
116
117         internal override Interop.ViewObjectHandle GetHandle()
118         {
119             return handle;
120         }
121
122         #region IDisposable Support
123         private bool _disposedValue = false;
124
125         protected virtual void Dispose(bool disposing)
126         {
127             if (!_disposedValue)
128             {
129                 handle.Dispose();
130                 _disposedValue = true;
131             }
132         }
133
134         /// <summary>
135         /// Releases all resources used by this object.
136         /// </summary>
137         public void Dispose()
138         {
139             Dispose(true);
140             GC.SuppressFinalize(this);
141         }
142         #endregion
143     }
144
145     /// <summary>
146     /// Bubble overlay map object
147     /// </summary>
148     public class BubbleOverlay : Overlay
149     {
150         /// <summary>
151         /// Creates a Bubble overlay.
152         /// </summary>
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)
159         {
160         }
161     }
162
163     /// <summary>
164     /// Box Overlay map object
165     /// </summary>
166     public class BoxOverlay : Overlay
167     {
168         /// <summary>
169         /// Creates a Box overlay.
170         /// </summary>
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)
177         {
178         }
179     }
180 }