Пример #1
0
        /// <summary>
        /// Decodes the given data into a location reference.
        /// </summary>
        public static RectangleLocation Decode(byte[] data)
        {
            var rectangleLocation = new RectangleLocation();

            rectangleLocation.LowerLeft  = CoordinateConverter.Decode(data, 1);
            rectangleLocation.UpperRight = CoordinateConverter.DecodeRelative(rectangleLocation.LowerLeft, data, 7);
            return(rectangleLocation);
        }
Пример #2
0
 /// <summary>
 /// Decodes the given location.
 /// </summary>
 public static ReferencedRectangle Decode(RectangleLocation location)
 {
     return(new ReferencedRectangle()
     {
         LowerLeftLatitude = location.LowerLeft.Latitude,
         LowerLeftLongitude = location.LowerLeft.Longitude,
         UpperRightLatitude = location.UpperRight.Latitude,
         UpperRightLongitude = location.UpperRight.Longitude
     });
 }
Пример #3
0
        public void DecodeReferencedRectangleLocation()
        {
            // build the location to decode.
            var location = new RectangleLocation();

            location.LowerLeft            = new Model.Coordinate();
            location.LowerLeft.Latitude   = 49.60586;
            location.LowerLeft.Longitude  = 6.12555;
            location.UpperRight           = new Model.Coordinate();
            location.UpperRight.Longitude = 6.12875;
            location.UpperRight.Latitude  = 49.60711;

            // decode the location
            //var decoder = new GeoCoordinateLocationDecoder();
            var referencedLocation = ReferencedRectangleCodec.Decode(location);

            // confirm result.
            Assert.IsNotNull(referencedLocation);
            Assert.AreEqual(referencedLocation.LowerLeftLatitude, location.LowerLeft.Latitude);
            Assert.AreEqual(referencedLocation.LowerLeftLongitude, location.LowerLeft.Longitude);
            Assert.AreEqual(referencedLocation.UpperRightLatitude, location.UpperRight.Latitude);
            Assert.AreEqual(referencedLocation.UpperRightLongitude, location.UpperRight.Longitude);
        }