/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var Exception = /** @class */ (function (_super) { __extends(Exception, _super); function Exception(code, description) { var _this = _super.call(this, description) || this; _this.name = "OGC_Exception"; _this.code = code; _this.description = description; return _this; } return Exception; }(Error)); var ExceptionCode; (function (ExceptionCode) { ExceptionCode["MISSING_REQUIRED_FIELD"] = "MISSING_REQUIRED_FIELD"; })(ExceptionCode || (ExceptionCode = {})); function validateRequiredFields(obj, fields, className) { fields.forEach(function (field) { if (!obj.hasOwnProperty(field)) throw new Exception(ExceptionCode.MISSING_REQUIRED_FIELD, "Missing field " + field + (className ? " from " + className : '')); }); } var SpatialExtent = /** @class */ (function () { function SpatialExtent() { } SpatialExtent.fromJson = function (jsonObj) { validateRequiredFields(jsonObj, ["bbox"], SpatialExtent.name); var spatialExtent = new SpatialExtent(); spatialExtent.crs = jsonObj["crs"]; spatialExtent.bbox = jsonObj["bbox"]; return spatialExtent; }; return SpatialExtent; }()); var TemporalExtent = /** @class */ (function () { function TemporalExtent() { } TemporalExtent.fromJson = function (jsonObj) { var temporalExtent = new TemporalExtent(); temporalExtent.trs = jsonObj["trs"]; temporalExtent.interval = jsonObj["interval"]; return temporalExtent; }; return TemporalExtent; }()); var Extent = /** @class */ (function () { function Extent() { } Extent.fromJson = function (jsonObj) { validateRequiredFields(jsonObj, ["spatial"], Extent.name); var extent = new Extent(); extent.spatial = SpatialExtent.fromJson(jsonObj["spatial"]); if (jsonObj.hasOwnProperty("temporal")) extent.temporal = TemporalExtent.fromJson(jsonObj["temporal"]); return extent; }; return Extent; }()); var BoundingVolume = /** @class */ (function () { function BoundingVolume() { } BoundingVolume.fromJson = function (jsonObj) { var boundingVolume = new BoundingVolume(); boundingVolume.box = jsonObj["box"]; boundingVolume.region = jsonObj["region"]; boundingVolume.sphere = jsonObj["sphere"]; return boundingVolume; }; return BoundingVolume; }()); var Link = /** @class */ (function () { function Link() { } Link.fromJson = function (jsonObj) { validateRequiredFields(jsonObj, ["href", "rel"], Link.name); var link = new Link(); link.href = jsonObj["href"]; link.rel = jsonObj["rel"]; if ("title" in jsonObj) link.title = jsonObj["title"]; if ("type" in jsonObj) link.type = jsonObj["type"]; if ("hreflang" in jsonObj) link.hreflang = jsonObj["hreflang"]; return link; }; return Link; }()); var _3DContainer = /** @class */ (function () { function _3DContainer() { } _3DContainer.fromJson = function (jsonObj) { var _a; validateRequiredFields(jsonObj, ["id", "extent", "links"], _3DContainer.name); var 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 = (_a = jsonObj["children"]) === null || _a === void 0 ? void 0 : _a.map(_3DContainer.fromJson); container.content = jsonObj["content"].map(Link.fromJson); return container; }; return _3DContainer; }()); var Collections = /** @class */ (function () { function Collections() { } Collections.fromJson = function (jsonObj) { var _a, _b; var collections = new Collections(); collections.links = (_a = jsonObj["links"]) === null || _a === void 0 ? void 0 : _a.map(Link.fromJson); collections.collections = (_b = jsonObj["collections"]) === null || _b === void 0 ? void 0 : _b.map(_3DContainer.fromJson); return collections; }; return Collections; }()); var Conformance = /** @class */ (function () { function Conformance() { } Conformance.fromJson = function (jsonObj) { validateRequiredFields(jsonObj, ["conformsTo"], Conformance.name); var conformance = new Conformance(); conformance.conformsTo = jsonObj["conformsTo"]; return conformance; }; return Conformance; }()); var LandingPage = /** @class */ (function () { function LandingPage() { } LandingPage.fromJson = function (jsonObj) { validateRequiredFields(jsonObj, ["links"], LandingPage.name); var landingPage = new LandingPage(); landingPage.title = jsonObj["title"]; landingPage.description = jsonObj["description"]; landingPage.links = jsonObj["links"].map(Link.fromJson); return landingPage; }; return LandingPage; }()); var RelationshipLink; (function (RelationshipLink) { RelationshipLink[RelationshipLink["affinemap"] = 0] = "affinemap"; RelationshipLink[RelationshipLink["alternate"] = 1] = "alternate"; RelationshipLink[RelationshipLink["collection"] = 2] = "collection"; RelationshipLink[RelationshipLink["conformance"] = 3] = "conformance"; RelationshipLink[RelationshipLink["data"] = 4] = "data"; RelationshipLink[RelationshipLink["dataset"] = 5] = "dataset"; RelationshipLink[RelationshipLink["describedBy"] = 6] = "describedBy"; RelationshipLink[RelationshipLink["distribution"] = 7] = "distribution"; RelationshipLink[RelationshipLink["item"] = 8] = "item"; RelationshipLink[RelationshipLink["items"] = 9] = "items"; RelationshipLink[RelationshipLink["original"] = 10] = "original"; RelationshipLink[RelationshipLink["parent"] = 11] = "parent"; RelationshipLink[RelationshipLink["root"] = 12] = "root"; RelationshipLink[RelationshipLink["scheme"] = 13] = "scheme"; RelationshipLink[RelationshipLink["self"] = 14] = "self"; RelationshipLink[RelationshipLink["service"] = 15] = "service"; RelationshipLink[RelationshipLink["service-desc"] = 16] = "service-desc"; })(RelationshipLink || (RelationshipLink = {})); var Root = /** @class */ (function () { function Root() { } return Root; }()); export { BoundingVolume, Collections, Conformance, Exception, ExceptionCode, Extent, LandingPage, Link, RelationshipLink, Root, SpatialExtent, TemporalExtent, _3DContainer };