Exemple #1
0
        internal SubFileParameter(SubFileParameterBuilder subFileParameterBuilder)
        {
            StartAddress      = subFileParameterBuilder.StartAddress;
            IndexStartAddress = subFileParameterBuilder.IndexStartAddress;
            SubFileSize       = subFileParameterBuilder.SubFileSize;
            BaseZoomLevel     = subFileParameterBuilder.BaseZoomLevel;
            ZoomLevelMin      = subFileParameterBuilder.ZoomLevelMin;
            ZoomLevelMax      = subFileParameterBuilder.ZoomLevelMax;
            HashCodeValue     = CalculateHashCode();

            // calculate the XY numbers of the boundary tiles in this sub-file
            var tmin = Tilebelt.PointToTile(subFileParameterBuilder.BoundingBox.MinX, subFileParameterBuilder.BoundingBox.MinY, BaseZoomLevel);

            BoundaryTileBottom = tmin.Y;
            BoundaryTileLeft   = tmin.X;

            var tmax = Tilebelt.PointToTile(subFileParameterBuilder.BoundingBox.MaxX, subFileParameterBuilder.BoundingBox.MaxY, BaseZoomLevel);

            BoundaryTileTop   = tmax.Y;
            BoundaryTileRight = tmax.X;

            // calculate the horizontal and vertical amount of blocks in this sub-file
            BlocksWidth  = BoundaryTileRight - BoundaryTileLeft + 1;
            BlocksHeight = BoundaryTileBottom - BoundaryTileTop + 1;

            // calculate the total amount of blocks in this sub-file
            NumberOfBlocks = BlocksWidth * BlocksHeight;

            IndexEndAddress = IndexStartAddress + NumberOfBlocks * BYTES_PER_INDEX_ENTRY;
        }
Exemple #2
0
        public static List <Tile> BboxToTiles(double[] bbox, int level)
        {
            var minTile = Tilebelt.PointToTile(bbox[0], bbox[1], level);
            var maxTile = Tilebelt.PointToTile(bbox[2], bbox[3], level);
            var result  = new List <Tile>();

            for (var lon = minTile.X; lon <= maxTile.X; lon++)
            {
                for (var lat = maxTile.Y; lat <= minTile.Y; lat++)
                {
                    var t = new Tile(lon, lat, level);
                    result.Add(t);
                }
            }
            return(result);
        }
Exemple #3
0
        public static List <Tile> GetTilesInArea(double minx, double miny, double maxx, double maxy, int levelFrom, int levelTo)
        {
            var res = new List <Tile>();

            for (var z = levelFrom; z <= levelTo; z++)
            {
                var tile  = Tilebelt.PointToTile(minx, miny, z);
                var tile1 = Tilebelt.PointToTile(maxx, maxy, z);

                for (var x = tile.X; x <= tile1.X; x++)
                {
                    for (var y = tile1.Y; y <= tile.Y; y++)
                    {
                        var t = new Tile(x, y, z);
                        res.Add(t);
                    }
                }
            }
            return(res);
        }