index.esm.js 8.16 KB
Newer Older
Hanadi's avatar
Hanadi committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*! *****************************************************************************
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 };