"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuadtreePrimitive = void 0;
var QuadtreeTile_1 = require("./QuadtreeTile");
var rootTraversalDetails = [];
var QuadtreePrimitive = /** @class */ (function () {
    function QuadtreePrimitive(options) {
        this._tilesToRender = [];
        this._levelZeroTiles = [];
        this.tileCacheSize = 100; //地形块的缓冲区
        if (!options.tileProvider) {
            throw ("options.tileProvider 参数是必须的");
        }
        // if (options.tileProvider.quadtree) {
        //     throw ("A QuadtreeTileProvider can only be used with a single QuadtreePrimitive");
        // }
        this._tileProvider = options.tileProvider;
        this._tileProvider.quadtree = this;
    }
    Object.defineProperty(QuadtreePrimitive.prototype, "tileProvider", {
        get: function () {
            return this._tileProvider;
        },
        enumerable: false,
        configurable: true
    });
    QuadtreePrimitive.prototype.selectTilesForRendering = function (frameState) {
        var i;
        if (!this._levelZeroTiles) {
            var tilingScheme = this._tileProvider.tilingScheme;
            this._levelZeroTiles = QuadtreeTile_1.QuadtreeTile.createLevelZeroTiles(tilingScheme);
            var numberOfRootTiles = this._levelZeroTiles.length;
            if (rootTraversalDetails.length < numberOfRootTiles) {
                rootTraversalDetails = new Array(numberOfRootTiles);
                for (i = 0; i < numberOfRootTiles; ++i) {
                    if (rootTraversalDetails[i] === undefined) {
                        // rootTraversalDetails[i] = new TraversalDetails();
                    }
                }
            }
        }
        else {
        }
    };
    QuadtreePrimitive.prototype.update = function () {
        this.selectTilesForRendering({});
    };
    return QuadtreePrimitive;
}());
exports.QuadtreePrimitive = QuadtreePrimitive;
