예제 #1
0
 /// <summary>
 /// Decodes binary OpenLR relative coordinate data into a coordinate.
 /// </summary>
 /// <param name="reference"></param>
 /// <param name="data"></param>
 /// <param name="startIndex"></param>
 /// <returns></returns>
 public static Coordinate DecodeRelative(Coordinate reference, byte[] data, int startIndex)
 {
     return(new Coordinate()
     {
         Latitude = reference.Latitude + (CoordinateConverter.DecodeInt16(data, startIndex + 2) / 100000.0),
         Longitude = reference.Longitude + (CoordinateConverter.DecodeInt16(data, startIndex + 0) / 100000.0)
     });
 }
예제 #2
0
 /// <summary>
 /// Decodes binary OpenLR coordinate data into a coordinate.
 /// </summary>
 /// <param name="data"></param>
 /// <param name="startIndex"></param>
 /// <returns></returns>
 public static Coordinate Decode(byte[] data, int startIndex)
 {
     return(new Coordinate()
     {
         Latitude = CoordinateConverter.DecodeDegrees(CoordinateConverter.DecodeInt24(data, startIndex + 3)),
         Longitude = CoordinateConverter.DecodeDegrees(CoordinateConverter.DecodeInt24(data, startIndex + 0))
     });
 }
예제 #3
0
 /// <summary>
 /// Decodes binary OpenLR relative coordinate data into a coordinate.
 /// </summary>
 /// <param name="reference"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public static Coordinate DecodeRelative(Coordinate reference, byte[] data)
 {
     return(CoordinateConverter.DecodeRelative(reference, data, 0));
 }
예제 #4
0
 /// <summary>
 /// Decodes binary OpenLR coordinate data into a coordinate.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static Coordinate Decode(byte[] data)
 {
     return(CoordinateConverter.Decode(data, 0));
 }
예제 #5
0
 /// <summary>
 /// Decodes the given coorrdinate into a binary OpenLR coordinate.
 /// </summary>
 /// <param name="reference"></param>
 /// <param name="coordinate"></param>
 /// <param name="data"></param>
 /// <param name="startIndex"></param>
 public static void EncodeRelative(Coordinate reference, Coordinate coordinate, byte[] data, int startIndex)
 {
     CoordinateConverter.EncodeInt16((int)((coordinate.Latitude - reference.Latitude) * 100000.0), data, startIndex + 2);
     CoordinateConverter.EncodeInt16((int)((coordinate.Longitude - reference.Longitude) * 100000.0), data, startIndex + 0);
 }
예제 #6
0
 /// <summary>
 /// Decodes the given coordinate into a binary OpenLR coordinate.
 /// </summary>
 /// <param name="coordinate"></param>
 /// <param name="data"></param>
 /// <param name="startIndex"></param>
 public static void Encode(Coordinate coordinate, byte[] data, int startIndex)
 {
     CoordinateConverter.EncodeInt24(CoordinateConverter.EncodeDegree(coordinate.Longitude), data, startIndex + 0);
     CoordinateConverter.EncodeInt24(CoordinateConverter.EncodeDegree(coordinate.Latitude), data, startIndex + 3);
 }