Modify documentation of APIs
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Tizen.Maps / Route.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
18 using System;
19 using System.Collections.Generic;
20
21 namespace Tizen.Maps
22 {
23     /// <summary>
24     /// Route information, used in Route Search requests.
25     /// </summary>
26     public class Route : IDisposable
27     {
28         internal Interop.RouteHandle handle;
29
30         internal Route(Interop.RouteHandle nativeHandle)
31         {
32             handle = nativeHandle;
33         }
34
35         /// <summary>
36         /// Gets an instance of <see cref="Geocoordinates"/> object which representing destination coordinates for this route.
37         /// </summary>
38         public Geocoordinates Destination
39         {
40             get
41             {
42                 return new Geocoordinates(handle.Destination);
43             }
44         }
45
46         /// <summary>
47         /// Gets total distance for this route.
48         /// </summary>
49         public double Distance
50         {
51             get
52             {
53                 return handle.Distance;
54             }
55         }
56
57         /// <summary>
58         /// Get total duration to cover this route.
59         /// </summary>
60         public double Duration
61         {
62             get
63             {
64                 return handle.Duration;
65             }
66         }
67
68         /// <summary>
69         /// Gets an ID for this route.
70         /// </summary>
71         public string Id
72         {
73             get
74             {
75                 return handle.Id;
76             }
77         }
78
79         /// <summary>
80         /// Gets transport mode for this route.
81         /// </summary>
82         public TransportMode Mode
83         {
84             get
85             {
86                 return (TransportMode)handle.TransportMode;
87             }
88         }
89
90         /// <summary>
91         /// Gets origin coordinates for this route.
92         /// </summary>
93         public Geocoordinates Origin
94         {
95             get
96             {
97                 return new Geocoordinates(handle.Origin);
98             }
99         }
100
101         /// <summary>
102         /// Gets a coordinates list for this route.
103         /// </summary>
104         public IEnumerable<Geocoordinates> Path
105         {
106             get
107             {
108                 var path = new List<Geocoordinates>();
109                 handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle)));
110                 return path;
111             }
112         }
113
114         /// <summary>
115         /// Gets a segment list for this route.
116         /// </summary>
117         public IEnumerable<RouteSegment> Segments
118         {
119             get
120             {
121                 var segments = new List<RouteSegment>();
122                 handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle)));
123                 return segments;
124             }
125         }
126
127         /// <summary>
128         /// Gets distance unit for this route.
129         /// </summary>
130         public DistanceUnit Unit
131         {
132             get
133             {
134                 return (DistanceUnit)handle.Unit;
135             }
136         }
137
138         /// <summary>
139         /// Gets an instance of <see cref="Area"/> object which representing bounding area for this route.
140         /// </summary>
141         private Area BoundingBox
142         {
143             get
144             {
145                 return new Area(handle.BoundingBox);
146             }
147         }
148
149         #region IDisposable Support
150         private bool _disposedValue = false;
151
152         protected virtual void Dispose(bool disposing)
153         {
154             if (!_disposedValue)
155             {
156                 handle.Dispose();
157                 _disposedValue = true;
158             }
159         }
160
161         /// <summary>
162         /// Releases all resources used by this object.
163         /// </summary>
164         public void Dispose()
165         {
166             Dispose(true);
167             GC.SuppressFinalize(this);
168         }
169         #endregion
170     }
171 }