{"size": 767, "ext": "js", "max_stars_repo_path": "3DTileset/Extension.js", "max_stars_repo_name": "YDJaken/ThreeEarth", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "3DTileset/Extension.js", "max_issues_repo_name": "YDJaken/ThreeEarth", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "3DTileset/Extension.js", "max_forks_repo_name": "YDJaken/ThreeEarth", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.1842105263, "max_line_length": 62, "alphanum_fraction": 0.5384615385}
/**
 * 3D Tiles基础数据类 - Extension
 * @Author DongYi
 */
import {Check} from "../Check/Check.js";

class Extension {
    constructor(obj) {
        obj = Check.object(obj, 'Extension:请输入Extension对象。');
        if (Check.undefine(obj)) return;
        // 是否为拓展模块
        this.isExtension = true;
        // 记录拓展的内容
        this.data = obj;
    }

    /**
     * 将Extension对象转化为JSON字符串
     * @return {string}
     */
    toJSON() {
        return `"${this.data.name}":{${this.data.toString()}`;
    }

    /**
     * 将传入的JSON对象变为Extension对象
     * @param obj
     * @return {BoundingVolume}
     */
    loadFromJSON(obj) {
        obj = Check.object(obj);
        if (Check.undefine(obj)) return;
        this.data = obj;
        return this;
    }
}

export {Extension}