Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Tizen.Maps / RouteSegment.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     /// Place Segment information, used in Route Search requests
25     /// </summary>
26     /// <since_tizen>3</since_tizen>
27     public class RouteSegment
28     {
29         private Geocoordinates _origin;
30         private Geocoordinates _destination;
31         private double _distance;
32         private double _duration;
33         private Area _boundingBox;
34
35         private List<RouteManeuver> _maneuvers = new List<RouteManeuver>();
36         private List<Geocoordinates> _path = new List<Geocoordinates>();
37
38         internal RouteSegment(Interop.RouteSegmentHandle handle)
39         {
40             _origin = new Geocoordinates(handle.Origin);
41             _destination = new Geocoordinates(handle.Destination);
42             _distance = handle.Distance;
43             _duration = handle.Duration;
44             _boundingBox = new Area(handle.BoundingBox);
45
46             handle.ForeachManeuver(maneuverHandle => _maneuvers.Add(new RouteManeuver(maneuverHandle)));
47             handle.ForeachPath(pathHandle => _path.Add(new Geocoordinates(pathHandle)));
48         }
49
50         /// <summary>
51         /// Gets an origin coordinates for this segment.
52         /// </summary>
53         /// <since_tizen>3</since_tizen>
54         public Geocoordinates Origin { get { return _origin; } }
55
56         /// <summary>
57         /// Gets a destination coordinates for this segment.
58         /// </summary>
59         /// <since_tizen>3</since_tizen>
60         public Geocoordinates Destination { get { return _destination; } }
61
62         /// <summary>
63         /// Gets total distance for this segment.
64         /// </summary>
65         /// <since_tizen>3</since_tizen>
66         public double Distance { get { return _distance; } }
67
68         /// <summary>
69         /// Gets total duration to cover this segment.
70         /// </summary>
71         /// <since_tizen>3</since_tizen>
72         public double Duration { get { return _duration; } }
73
74         /// <summary>
75         /// Gets a maneuver list for this segment.
76         /// </summary>
77         /// <since_tizen>3</since_tizen>
78         public IEnumerable<RouteManeuver> Maneuvers { get { return _maneuvers; } }
79
80         /// <summary>
81         /// Gets a coordinates list for this segment.
82         /// </summary>
83         /// <since_tizen>3</since_tizen>
84         public IEnumerable<Geocoordinates> Path { get { return _path; } }
85
86         private Area BoundingBox { get { return _boundingBox; } }
87     }
88 }