/// <summary> /// Initializes a new instance of the <see cref="GpxTrackSegment"/> class. /// </summary> /// <param name="waypoints"> /// The value for <see cref="Waypoints"/>. /// </param> /// <param name="extensions"> /// The value for <see cref="Extensions"/>. /// </param> public GpxTrackSegment(ImmutableGpxWaypointTable waypoints, object extensions) { if (waypoints != null) { Waypoints = waypoints; } Extensions = extensions; }
/// <summary> /// Initializes a new instance of the <see cref="GpxRoute"/> class. /// </summary> /// <param name="name"> /// The value for <see cref="Name"/>. /// </param> /// <param name="comment"> /// The value for <see cref="Comment"/>. /// </param> /// <param name="description"> /// The value for <see cref="Description"/>. /// </param> /// <param name="source"> /// The value for <see cref="Source"/>. /// </param> /// <param name="links"> /// The value for <see cref="Links"/>. /// </param> /// <param name="number"> /// The value for <see cref="Number"/>. /// </param> /// <param name="classification"> /// The value for <see cref="Classification"/>. /// </param> /// <param name="extensions"> /// The value for <see cref="Extensions"/>. /// </param> /// <param name="waypoints"> /// The value for <see cref="Waypoints"/>. /// </param> public GpxRoute(string name, string comment, string description, string source, ImmutableArray <GpxWebLink> links, uint?number, string classification, object extensions, ImmutableGpxWaypointTable waypoints) { Name = name; Comment = comment; Description = description; Source = source; if (!links.IsDefault) { Links = links; } Number = number; Classification = classification; Extensions = extensions; if (!(waypoints is null)) { Waypoints = waypoints; } }
private static ILineString BuildLineString(ImmutableGpxWaypointTable waypoints, IGeometryFactory geometryFactory) { Coordinate[] coords; if (waypoints.Count == 1) { var waypoint = waypoints[0]; coords = new Coordinate[2]; coords[0] = coords[1] = new Coordinate(waypoint.Longitude, waypoint.Latitude, waypoint.ElevationInMeters ?? Coordinate.NullOrdinate); } else { coords = new Coordinate[waypoints.Count]; for (int i = 0; i < coords.Length; i++) { var waypoint = waypoints[i]; coords[i] = new Coordinate(waypoint.Longitude, waypoint.Latitude, waypoint.ElevationInMeters ?? Coordinate.NullOrdinate); } } return(geometryFactory.CreateLineString(coords)); }