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 public class Route : IDisposable
28 internal Interop.RouteHandle handle;
30 internal Route(Interop.RouteHandle nativeHandle)
32 handle = nativeHandle;
36 /// Gets an instance of <see cref="Geocoordinates"/> object which representing destination coordinates for this route.
38 public Geocoordinates Destination
42 return new Geocoordinates(handle.Destination);
47 /// Gets total distance for this route.
49 public double Distance
53 return handle.Distance;
58 /// Get total duration to cover this route.
60 public double Duration
64 return handle.Duration;
69 /// Gets an ID for this route.
80 /// Gets transport mode for this route.
82 public TransportMode Mode
86 return (TransportMode)handle.TransportMode;
91 /// Gets origin coordinates for this route.
93 public Geocoordinates Origin
97 return new Geocoordinates(handle.Origin);
102 /// Gets a coordinates list for this route.
104 public IEnumerable<Geocoordinates> Path
108 var path = new List<Geocoordinates>();
109 handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle)));
115 /// Gets a segment list for this route.
117 public IEnumerable<RouteSegment> Segments
121 var segments = new List<RouteSegment>();
122 handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle)));
128 /// Gets distance unit for this route.
130 public DistanceUnit Unit
134 return (DistanceUnit)handle.Unit;
139 /// Gets an instance of <see cref="Area"/> object which representing bounding area for this route.
141 private Area BoundingBox
145 return new Area(handle.BoundingBox);
149 #region IDisposable Support
150 private bool _disposedValue = false;
152 protected virtual void Dispose(bool disposing)
157 _disposedValue = true;
162 /// Releases all resources used by this object.
164 public void Dispose()
167 GC.SuppressFinalize(this);