示例#1
0
文件: Tile.cs 项目: mstarZheng/geosot
        /// <summary>
        /// 获取Tile的范围四至
        /// </summary>
        /// <returns></returns>
        public LngLatBbox GetBbox()
        {
            var cellSize = new CellSize();
            var cell     = cellSize.GetCellSizeInDegree(Level);
            var L        = new LngLatSegments(this.Corner.Lng.Code >> (32 - Level) << (32 - Level), true);
            var B        = new LngLatSegments(this.Corner.Lat.Code >> (32 - Level) << (32 - Level), false);
            var bbox     = new LngLatBbox();

            if (L.G == 1)
            {
                bbox.East = L.Degree;
                bbox.West = bbox.East - cell;
            }
            else
            {
                bbox.West = L.Degree;
                bbox.East = bbox.West + cell;
            }
            if (B.G == 1)
            {
                bbox.North = B.Degree;
                bbox.South = bbox.North - cell;
            }
            else
            {
                bbox.South = B.Degree;
                bbox.North = bbox.South + cell;
            }
            return(bbox);
        }
示例#2
0
        public LngLat(string dms)
        {
            var str = dms.Split(",");

            this.Lat = new LngLatSegments(str[0]);
            this.Lng = new LngLatSegments(str[1]);
        }
示例#3
0
        public void DecodeLngLat(ulong code, ref double lat, ref double lng)
        {
            var  morton = new Morton2D();
            uint L      = 0; // 横轴
            uint B      = 0; // 竖轴

            morton.Magicbits(code, ref L, ref B);
            lng = new LngLatSegments(L, true).Degree;
            lat = new LngLatSegments(B, false).Degree;
        }
示例#4
0
        public void DecodeLngLat(UInt64 code, ref double lat, ref double lng)
        {
            var    morton = new Morton2D();
            UInt32 L      = 0; // 横轴
            UInt32 B      = 0; // 竖轴

            morton.Magicbits(code, ref L, ref B);
            lng = new LngLatSegments(L, true).Degree;
            lat = new LngLatSegments(B, false).Degree;
        }
示例#5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="b">SOT角点二维编码下侧</param>
 /// <param name="l">SOT角点二维编码左侧</param>
 public LngLat(UInt32 b, UInt32 l)
 {
     this.Lat = new LngLatSegments(b);
     this.Lng = new LngLatSegments(l);
 }
示例#6
0
 public LngLat(double lat, double lng)
 {
     this.Lat = new LngLatSegments(lat);
     this.Lng = new LngLatSegments(lng);
 }
示例#7
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="b">SOT角点二维编码下侧</param>
 /// <param name="l">SOT角点二维编码左侧</param>
 public LngLat(uint b, uint l)
 {
     this.Lat = new LngLatSegments(b, false);
     this.Lng = new LngLatSegments(l, true);
 }
示例#8
0
        public uint EncodeLngLat(double x)
        {
            var segs = new LngLatSegments(x);

            return(segs.G << 31 | segs.D << 23 | segs.M << 17 | segs.S << 11 | segs.S11);
        }