import {Extent} from "./Extent"; import {BoundingVolume} from "./BoundingVolume"; import {Link} from "./Link"; import {validateRequiredFields} from "./Helpers"; export class _3DContainer { id!: string; title?: string; description?: string; collectionType?: string; itemType?: string; extent!: Extent; contentExtent?: BoundingVolume; crs?: string[]; links!: Link[]; children?: _3DContainer[]; content?: Link[]; static fromJson(jsonObj: any): _3DContainer { validateRequiredFields(jsonObj, ["id", "extent", "links"], _3DContainer.name); const container = new _3DContainer(); container.id = jsonObj["id"]; container.title = jsonObj["title"]; container.description = jsonObj["description"]; container.collectionType = jsonObj["collectionType"]; container.itemType = jsonObj["itemType"]; container.extent = Extent.fromJson(jsonObj["extent"]); if (jsonObj.hasOwnProperty("contentExtent")) container.contentExtent = BoundingVolume.fromJson(jsonObj["contentExtent"]); container.crs = jsonObj["crs"]; container.links = jsonObj["links"].map(Link.fromJson); container.children = jsonObj["children"]?.map(_3DContainer.fromJson); container.content = jsonObj["content"].map(Link.fromJson); return container; } }