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 /// Destination coordinates for this route
38 public Geocoordinates Destination
42 return new Geocoordinates(handle.Destination);
47 /// Total distance for this route
49 public double Distance
53 return handle.Distance;
58 /// Total duration to cover this route
60 public double Duration
64 return handle.Duration;
77 /// Transport Mode for this route
79 public TransportMode Mode
83 return (TransportMode)handle.TransportMode;
88 /// Origin coordinates for this route
90 public Geocoordinates Origin
94 return new Geocoordinates(handle.Origin);
99 /// Coordinates list for this route
101 public IEnumerable<Geocoordinates> Path
105 var path = new List<Geocoordinates>();
106 handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle)));
112 /// Segment list for this route
114 public IEnumerable<RouteSegment> Segments
118 var segments = new List<RouteSegment>();
119 handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle)));
125 /// Distance unit for this route
127 public DistanceUnit Unit
131 return (DistanceUnit)handle.Unit;
136 /// Bounding area for this route
138 private Area BoundingBox
142 return new Area(handle.BoundingBox);
146 #region IDisposable Support
147 private bool _disposedValue = false;
149 protected virtual void Dispose(bool disposing)
154 _disposedValue = true;
158 public void Dispose()
161 GC.SuppressFinalize(this);