/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; namespace Tizen.Maps { /// /// Place information, used in place discovery and search requests. /// /// 3 public class Place : IDisposable { internal Interop.PlaceHandle handle; internal Place(Interop.PlaceHandle nativeHandle) { handle = nativeHandle; } /// /// Destroy the Place object. /// ~Place() { Dispose(false); } /// /// Gets an ID string for the place. /// /// 3 public string Id { get { return handle.Id; } } /// /// Gets name string for the place. /// /// 3 public string Name { get { return handle.Name; } } /// /// Gets a view URI for the place. /// /// 3 public string Uri { get { return handle.Uri; } } /// /// Gets a distance for the place from the center. /// /// 3 public int Distance { get { return handle.Distance; } } /// /// Gets a geographical location for the place. /// /// 3 public Geocoordinates Coordinates { get { return new Geocoordinates(handle.Coordinates); } } /// /// Gets an address for the place. /// /// 3 public PlaceAddress Address { get { return new PlaceAddress(handle.Address); } } /// /// Gets a rating for the place. /// /// 3 public PlaceRating Rating { get { return new PlaceRating(handle.Rating); } } /// /// Gets a supplier link for the place. /// /// 3 public PlaceLink Supplier { get { return new PlaceLink(handle.Supplier); } } /// /// Gets a related link for the place. /// /// 3 public PlaceLink Related { get { return new PlaceLink(handle.Related); } } /// /// Gets all the properties attached to this place. /// /// 3 public IDictionary Properties { get { var properties = new Dictionary(); handle.ForeachProperty((key, value) => properties[key] = value); return properties; } } /// /// Gets all the categories attached to this place. /// /// 3 public IEnumerable Categories { get { var categories = new List(); handle.ForeachCategory((categoryHandle) => categories.Add(new PlaceCategory(categoryHandle))); return categories; } } /// /// Gets all the attributes attached to this place. /// /// 3 public IEnumerable Attributes { get { var attributes = new List(); handle.ForeachAttribute((attributeHandle) => attributes.Add(new PlaceAttribute(attributeHandle))); return attributes; } } /// /// Gets all the contacts attached to this place. /// /// 3 public IEnumerable Contacts { get { var contacts = new List(); handle.ForeachContact((contactHandle) => contacts.Add(new PlaceContact(contactHandle))); return contacts; } } /// /// Gets all the editorials attached to this place. /// /// 3 public IEnumerable Editorials { get { var editorials = new List(); handle.ForeachEditorial((editorialHandle) => editorials.Add(new PlaceEditorial(editorialHandle))); return editorials; } } /// /// Gets all the images attached to this place. /// /// 3 public IEnumerable Images { get { var images = new List(); handle.ForeachImage((imageHandle) => images.Add(new PlaceImage(imageHandle))); return images; } } /// /// Gets all the reviews attached to this place. /// /// 3 public IEnumerable Reviews { get { var reviews = new List(); handle.ForeachReview((reviewHandle) => reviews.Add(new PlaceReview(reviewHandle))); return reviews; } } #region IDisposable Support private bool _disposedValue = false; /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// /// If true, managed and unmanaged resources can be disposed, otherwise only unmanaged resources can be disposed. protected virtual void Dispose(bool disposing) { if (!_disposedValue) { handle?.Dispose(); _disposedValue = true; } } /// /// Releases all the resources used by this object. /// /// 3 public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion } }