"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _Source = _interopRequireDefault(require("./Source"));
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
/**
 * @classdesc
 * An object defining the source connection to a 3DTiles dataset from a web server.
 *
 * @extends Source
 *
 * @property {boolean} isC3DTilesSource - Used to checkout whether this source is a isC3DTilesSource. Default is
 * true. You should not change this, as it is used internally for optimisation.
 * @property {string} url - The URL of the tileset json.
 * @property {string} baseUrl - The base URL to access tiles.
 */
class C3DTilesSource extends _Source.default {
  /**
   * Create a new Source for 3D Tiles data from a web server.
   *
   * @constructor
   * @extends Source
   *
   * @param {Object} source An object that can contain all properties of {@link Source}.
   * Only `url` is mandatory.
   */
  constructor(source) {
    super(source);
    this.isC3DTilesSource = true;
    this.baseUrl = this.url.slice(0, this.url.lastIndexOf('/') + 1);
    this.whenReady = _Fetcher.default.json(this.url, this.networkOptions);
  }
}
var _default = C3DTilesSource;
exports.default = _default;