Release 4.0.0-preview1-00052
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Tizen.Maps / Place.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 System.Collections.Generic;
19
20 namespace Tizen.Maps
21 {
22     /// <summary>
23     /// Place information, used in Place Discovery and Search
24     /// </summary>
25     /// <since_tizen>3</since_tizen>
26     public class Place : IDisposable
27     {
28         internal Interop.PlaceHandle handle;
29
30         internal Place(Interop.PlaceHandle nativeHandle)
31         {
32             handle = nativeHandle;
33         }
34
35         /// <summary>
36         /// Gets ID string for the place.
37         /// </summary>
38         /// <since_tizen>3</since_tizen>
39         public string Id
40         {
41             get
42             {
43                 return handle.Id;
44             }
45         }
46
47         /// <summary>
48         /// Gets name string for the place.
49         /// </summary>
50         /// <since_tizen>3</since_tizen>
51         public string Name
52         {
53             get
54             {
55                 return handle.Name;
56             }
57         }
58
59         /// <summary>
60         /// Gets view URI for the place.
61         /// </summary>
62         /// <since_tizen>3</since_tizen>
63         public string Uri
64         {
65             get
66             {
67                 return handle.Uri;
68             }
69         }
70
71         /// <summary>
72         /// Gets distance for the place from the center.
73         /// </summary>
74         /// <since_tizen>3</since_tizen>
75         public int Distance
76         {
77             get
78             {
79                 return handle.Distance;
80             }
81         }
82
83         /// <summary>
84         /// Gets geographical location for the place.
85         /// </summary>
86         /// <since_tizen>3</since_tizen>
87         public Geocoordinates Coordinates
88         {
89             get
90             {
91                 return new Geocoordinates(handle.Coordinates);
92             }
93         }
94
95         /// <summary>
96         /// Gets address for the place.
97         /// </summary>
98         /// <since_tizen>3</since_tizen>
99         public PlaceAddress Address
100         {
101             get
102             {
103                 return new PlaceAddress(handle.Address);
104             }
105         }
106
107         /// <summary>
108         /// Gets rating for the place.
109         /// </summary>
110         /// <since_tizen>3</since_tizen>
111         public PlaceRating Rating
112         {
113             get
114             {
115                 return new PlaceRating(handle.Rating);
116             }
117         }
118
119         /// <summary>
120         /// Gets supplier link for the place.
121         /// </summary>
122         /// <since_tizen>3</since_tizen>
123         public PlaceLink Supplier
124         {
125             get
126             {
127                 return new PlaceLink(handle.Supplier);
128             }
129         }
130
131         /// <summary>
132         /// Gets related link for the place.
133         /// </summary>
134         /// <since_tizen>3</since_tizen>
135         public PlaceLink Related
136         {
137             get
138             {
139                 return new PlaceLink(handle.Related);
140             }
141         }
142
143         /// <summary>
144         /// Gets all properties attached to this place.
145         /// </summary>
146         /// <since_tizen>3</since_tizen>
147         public IDictionary<string, string> Properties
148         {
149             get
150             {
151                 var properties = new Dictionary<string, string>();
152                 handle.ForeachProperty((key, value) => properties[key] = value);
153                 return properties;
154             }
155         }
156
157         /// <summary>
158         /// Gets all categories attached to this place.
159         /// </summary>
160         /// <since_tizen>3</since_tizen>
161         public IEnumerable<PlaceCategory> Categories
162         {
163             get
164             {
165                 var categories = new List<PlaceCategory>();
166                 handle.ForeachCategory((categoryHandle) => categories.Add(new PlaceCategory(categoryHandle)));
167                 return categories;
168             }
169         }
170
171         /// <summary>
172         /// Gets all attributes attached to this place.
173         /// </summary>
174         /// <since_tizen>3</since_tizen>
175         public IEnumerable<PlaceAttribute> Attributes
176         {
177             get
178             {
179                 var attributes = new List<PlaceAttribute>();
180                 handle.ForeachAttribute((attributeHandle) => attributes.Add(new PlaceAttribute(attributeHandle)));
181                 return attributes;
182             }
183         }
184
185         /// <summary>
186         /// Gets all contacts attached to this place.
187         /// </summary>
188         /// <since_tizen>3</since_tizen>
189         public IEnumerable<PlaceContact> Contacts
190         {
191             get
192             {
193                 var contacts = new List<PlaceContact>();
194                 handle.ForeachContact((contactHandle) => contacts.Add(new PlaceContact(contactHandle)));
195                 return contacts;
196             }
197         }
198
199         /// <summary>
200         /// Gets all editorials attached to this place.
201         /// </summary>
202         /// <since_tizen>3</since_tizen>
203         public IEnumerable<PlaceEditorial> Editorials
204         {
205             get
206             {
207                 var editorials = new List<PlaceEditorial>();
208                 handle.ForeachEditorial((editorialHandle) => editorials.Add(new PlaceEditorial(editorialHandle)));
209                 return editorials;
210             }
211         }
212
213         /// <summary>
214         /// Gets all images attached to this place.
215         /// </summary>
216         /// <since_tizen>3</since_tizen>
217         public IEnumerable<PlaceImage> Images
218         {
219             get
220             {
221                 var images = new List<PlaceImage>();
222                 handle.ForeachImage((imageHandle) => images.Add(new PlaceImage(imageHandle)));
223                 return images;
224             }
225         }
226
227         /// <summary>
228         /// Gets all reviews attached to this place.
229         /// </summary>
230         /// <since_tizen>3</since_tizen>
231         public IEnumerable<PlaceReview> Reviews
232         {
233             get
234             {
235                 var reviews = new List<PlaceReview>();
236                 handle.ForeachReview((reviewHandle) => reviews.Add(new PlaceReview(reviewHandle)));
237                 return reviews;
238             }
239         }
240
241         #region IDisposable Support
242         private bool _disposedValue = false;
243
244         protected virtual void Dispose(bool disposing)
245         {
246             if (!_disposedValue)
247             {
248                 handle.Dispose();
249                 _disposedValue = true;
250             }
251         }
252
253         /// <summary>
254         /// Releases all resources used by this object.
255         /// </summary>
256         /// <since_tizen>3</since_tizen>
257         public void Dispose()
258         {
259             Dispose(true);
260             GC.SuppressFinalize(this);
261         }
262         #endregion
263     }
264 }