2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.Collections.Generic;
24 /// Route information, used in Route Search requests.
26 /// <since_tizen> 3 </since_tizen>
27 public class Route : IDisposable
29 internal Interop.RouteHandle handle;
31 internal Route(Interop.RouteHandle nativeHandle)
33 handle = nativeHandle;
37 /// Destroy the Route object.
45 /// Gets an instance of <see cref="Geocoordinates"/> object representing destination coordinates for this route.
47 /// <since_tizen> 3 </since_tizen>
48 public Geocoordinates Destination
52 return new Geocoordinates(handle.Destination);
57 /// Gets the total distance for this route.
59 /// <since_tizen> 3 </since_tizen>
60 public double Distance
64 return handle.Distance;
69 /// Get the total duration to cover this route.
71 /// <since_tizen> 3 </since_tizen>
72 public double Duration
76 return handle.Duration;
81 /// Gets an ID for this route.
83 /// <since_tizen> 3 </since_tizen>
93 /// Gets the transport mode for this route.
95 /// <since_tizen> 3 </since_tizen>
96 public TransportMode Mode
100 return (TransportMode)handle.TransportMode;
105 /// Gets the origin coordinates for this route.
107 /// <since_tizen> 3 </since_tizen>
108 public Geocoordinates Origin
112 return new Geocoordinates(handle.Origin);
117 /// Gets a coordinates list for this route.
119 /// <since_tizen> 3 </since_tizen>
120 public IEnumerable<Geocoordinates> Path
124 var path = new List<Geocoordinates>();
125 handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle)));
131 /// Gets a segment list for this route.
133 /// <since_tizen> 3 </since_tizen>
134 public IEnumerable<RouteSegment> Segments
138 var segments = new List<RouteSegment>();
139 handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle)));
145 /// Gets the distance unit for this route.
147 /// <since_tizen> 3 </since_tizen>
148 public DistanceUnit Unit
152 return (DistanceUnit)handle.Unit;
157 /// Gets an instance of <see cref="Area"/> object which representing bounding area for this route.
159 private Area BoundingBox
163 return new Area(handle.BoundingBox);
167 #region IDisposable Support
168 private bool _disposedValue = false;
171 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
173 /// <param name="disposing">If true, managed and unmanaged resources can be disposed, otherwise only unmanaged resources can be disposed.</param>
174 /// <since_tizen> 3 </since_tizen>
175 protected virtual void Dispose(bool disposing)
180 _disposedValue = true;
185 /// Releases all the resources used by this object.
187 /// <since_tizen> 3 </since_tizen>
188 public void Dispose()
191 GC.SuppressFinalize(this);