Exemplo n.º 1
0
        public void OffsetEarth2014()
        {
            var coor = new HealCoor {
                Latitude = -89.9917, Longitude = -179.9917
            };

            Assert.AreEqual(0, coor.Offset());

            var allRecords = 10800 * 21600; // 233280000;

            coor = new HealCoor {
                Latitude = 0, Longitude = 0
            };

            // not accurate transforming
            Assert.AreEqual(allRecords / 2d, coor.Offset(), 11000);

            // not accurate transforming
            coor = new HealCoor {
                Latitude = 89.9917, Longitude = 179.9917
            };
            Assert.AreEqual(allRecords - 1, coor.Offset());
        }
Exemplo n.º 2
0
        public int GetAltitude(HealCoor place)
        {
            var position = place.Offset(_accuracyMin) * 2;
            int a, b;

            if (_readAllAtStart)
            {
                a = _buf[position];
                b = _buf[position + 1];
            }
            else
            {
                _stream.Position = position;
                a = _stream.ReadByte();
                b = _stream.ReadByte();
            }
            var int16 = (ushort)(a << 8) + b;

            if (a >= 0x80)
            {
                return(-((int16 ^ 0xffff) + 1));
            }
            return(int16);
        }