universal-geocoder
Version:
Universal geocoding abstraction server-side and client-side with multiple built-in providers
116 lines • 5.56 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
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);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var Geocoded_1 = __importDefault(require("../../Geocoded"));
var NominatimGeocoded = /** @class */ (function (_super) {
__extends(NominatimGeocoded, _super);
function NominatimGeocoded(_a) {
var displayName = _a.displayName, osmId = _a.osmId, osmType = _a.osmType, categories = _a.categories, types = _a.types, attribution = _a.attribution, subLocalityLevels = _a.subLocalityLevels, shape = _a.shape, geocodedObject = __rest(_a, ["displayName", "osmId", "osmType", "categories", "types", "attribution", "subLocalityLevels", "shape"]);
var _this = _super.call(this, geocodedObject) || this;
_this.displayName = displayName;
_this.osmId = osmId;
_this.osmType = osmType;
_this.categories = categories;
_this.types = types;
_this.attribution = attribution;
_this.subLocalityLevels = subLocalityLevels || [];
_this.shape = shape;
return _this;
}
NominatimGeocoded.create = function (object) {
return new this(object);
};
NominatimGeocoded.prototype.toObject = function () {
return __assign(__assign({}, _super.prototype.toObject.call(this)), { displayName: this.displayName, osmId: this.osmId, osmType: this.osmType, categories: this.categories, types: this.types, attribution: this.attribution, subLocalityLevels: this.subLocalityLevels, shape: this.shape });
};
NominatimGeocoded.prototype.withDisplayName = function (displayName) {
return new NominatimGeocoded(__assign(__assign({}, this.toObject()), { displayName: displayName }));
};
NominatimGeocoded.prototype.getDisplayName = function () {
return this.displayName;
};
NominatimGeocoded.prototype.withOsmId = function (osmId) {
return new NominatimGeocoded(__assign(__assign({}, this.toObject()), { osmId: osmId }));
};
NominatimGeocoded.prototype.getOsmId = function () {
return this.osmId;
};
NominatimGeocoded.prototype.withOsmType = function (osmType) {
return new NominatimGeocoded(__assign(__assign({}, this.toObject()), { osmType: osmType }));
};
NominatimGeocoded.prototype.getOsmType = function () {
return this.osmType;
};
NominatimGeocoded.prototype.withCategories = function (categories) {
return new NominatimGeocoded(__assign(__assign({}, this.toObject()), { categories: categories }));
};
NominatimGeocoded.prototype.getCategories = function () {
return this.categories;
};
NominatimGeocoded.prototype.withTypes = function (types) {
return new NominatimGeocoded(__assign(__assign({}, this.toObject()), { types: types }));
};
NominatimGeocoded.prototype.getTypes = function () {
return this.types;
};
NominatimGeocoded.prototype.withAttribution = function (attribution) {
return new NominatimGeocoded(__assign(__assign({}, this.toObject()), { attribution: attribution }));
};
NominatimGeocoded.prototype.getAttribution = function () {
return this.attribution;
};
NominatimGeocoded.prototype.addSubLocalityLevel = function (subLocalityLevel) {
this.subLocalityLevels.push(subLocalityLevel);
};
NominatimGeocoded.prototype.getSubLocalityLevels = function () {
return this.subLocalityLevels;
};
NominatimGeocoded.prototype.withShape = function (shape) {
return new NominatimGeocoded(__assign(__assign({}, this.toObject()), { shape: shape }));
};
NominatimGeocoded.prototype.getShape = function () {
return this.shape;
};
return NominatimGeocoded;
}(Geocoded_1.default));
exports.default = NominatimGeocoded;
//# sourceMappingURL=NominatimGeocoded.js.map