Esempio n. 1
0
        public static List <UtmSheet> GetIndexSheets(BoundingBox geographicIntersectRegion, UtmIndexType type, int utmZone)
        {
            switch (type)
            {
            case UtmIndexType.Ncc2kBlock:
                return(GetIndexSheets(geographicIntersectRegion, _2kUtmBlockWidth, _2kUtmBlockHeight, UtmIndexType.Ncc2kBlock, utmZone));

            case UtmIndexType.Ncc2kSheet:
                return(GetIndexSheets(geographicIntersectRegion, _2kUtmSheetWidth, _2kUtmSheetHeight, UtmIndexType.Ncc2kSheet, utmZone));

            case UtmIndexType.Ncc1k:
                return(GetIndexSheets(geographicIntersectRegion, _1kUtmSheetWidth, _1kUtmSheetHeight, UtmIndexType.Ncc1k, utmZone));

            case UtmIndexType.Ncc500:
                return(GetIndexSheets(geographicIntersectRegion, _500UtmSheetWidth, _500UtmSheetHeight, UtmIndexType.Ncc500, utmZone));

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 2
0
        private static List <UtmSheet> GetIndexSheets(BoundingBox geographicIntersectRegion, double utmWidth, double utmHeight, UtmIndexType type, int utmZone)
        {
            var geoBound = BoundingBoxHelper.UtmMbbToGeodeticWgs84Mbb(_2kUtmBoudingBox, utmZone)
                           .Intersect(geographicIntersectRegion);

            List <UtmSheet> result = new List <UtmSheet>();

            if (geoBound.IsNaN())
            {
                return(result);
            }

            var utmBound = BoundingBoxHelper.GeodeticWgs84MbbToUtmMbb(geoBound, utmZone)
                           .Intersect(_2kUtmBoudingBox);

            if (utmBound.IsNaN())
            {
                return(result);
            }

            int iStart = (int)Math.Floor((utmBound.XMin - _2kUtmXmin) / utmWidth);

            int iEnd = (int)Math.Ceiling((utmBound.XMax - _2kUtmXmin) / utmWidth);

            int jStart = (int)Math.Floor((utmBound.YMin - _2kUtmYmin) / utmHeight);

            int jEnd = (int)Math.Ceiling((utmBound.YMax - _2kUtmYmin) / utmHeight);

            for (int i = iStart; i < iEnd; i++)
            {
                for (int j = jStart; j < jEnd; j++)
                {
                    var startX = _2kUtmXmin + i * utmWidth;

                    var startY = _2kUtmYmin + j * utmHeight;

                    result.Add(UtmSheet.Create(new BoundingBox(startX, startY, startX + utmWidth, startY + utmHeight), type, utmZone));
                }
            }

            return(result);
        }
Esempio n. 3
0
        //private static string Get2kBlockSheetName(double minUtmX, double maxUtmY)
        //{
        //    //  A   B   C   ...     T   U
        //    //1
        //    //2
        //    //.
        //    //.
        //    //70
        //    //****************************
        //    var column = ((int)Math.Round((minUtmX - _2kUtmBoudingBox.XMin) / _2kUtmBlockWidth)).Number2String(true);

        //    var row = Math.Round((_2kUtmBoudingBox.YMax - maxUtmY) / _2kUtmBlockHeight);

        //    return $"{column}{row.ToString("00")}";
        //}

        public static UtmSheet GetIndexSheet(double longitude, double latitude, int utmZone, UtmIndexType type)
        {
            switch (type)
            {
            case UtmIndexType.Ncc2kBlock:
                return(UtmSheet.Create2kUtmBlock(longitude, latitude, utmZone));

            case UtmIndexType.Ncc2kSheet:
                return(UtmSheet.Create2kUtmSheet(longitude, latitude, utmZone));

            case UtmIndexType.Ncc1k:
                return(UtmSheet.Create1kUtmSheet(longitude, latitude, utmZone));

            case UtmIndexType.Ncc500:
                return(UtmSheet.Create500UtmSheet(longitude, latitude, utmZone));

            default:
                throw new NotImplementedException();
            }
        }