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 /// Gets an instance of <see cref="Geocoordinates"/> object which representing destination coordinates for this route.
39 /// <since_tizen>3</since_tizen>
40 public Geocoordinates Destination
44 return new Geocoordinates(handle.Destination);
49 /// Gets total distance for this route.
51 /// <since_tizen>3</since_tizen>
52 public double Distance
56 return handle.Distance;
61 /// Get total duration to cover this route.
63 /// <since_tizen>3</since_tizen>
64 public double Duration
68 return handle.Duration;
73 /// Gets an ID for this route.
75 /// <since_tizen>3</since_tizen>
85 /// Gets transport mode for this route.
87 /// <since_tizen>3</since_tizen>
88 public TransportMode Mode
92 return (TransportMode)handle.TransportMode;
97 /// Gets origin coordinates for this route.
99 /// <since_tizen>3</since_tizen>
100 public Geocoordinates Origin
104 return new Geocoordinates(handle.Origin);
109 /// Gets a coordinates list for this route.
111 /// <since_tizen>3</since_tizen>
112 public IEnumerable<Geocoordinates> Path
116 var path = new List<Geocoordinates>();
117 handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle)));
123 /// Gets a segment list for this route.
125 /// <since_tizen>3</since_tizen>
126 public IEnumerable<RouteSegment> Segments
130 var segments = new List<RouteSegment>();
131 handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle)));
137 /// Gets distance unit for this route.
139 /// <since_tizen>3</since_tizen>
140 public DistanceUnit Unit
144 return (DistanceUnit)handle.Unit;
149 /// Gets an instance of <see cref="Area"/> object which representing bounding area for this route.
151 private Area BoundingBox
155 return new Area(handle.BoundingBox);
159 #region IDisposable Support
160 private bool _disposedValue = false;
162 protected virtual void Dispose(bool disposing)
167 _disposedValue = true;
172 /// Releases all resources used by this object.
174 /// <since_tizen>3</since_tizen>
175 public void Dispose()
178 GC.SuppressFinalize(this);