UNPKG

universal-geocoder

Version:

Universal geocoding abstraction server-side and client-side with multiple built-in providers

144 lines 7.26 kB
"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 LocationIQGeocoded = /** @class */ (function (_super) { __extends(LocationIQGeocoded, _super); function LocationIQGeocoded(_a) { var placeId = _a.placeId, displayName = _a.displayName, osmId = _a.osmId, osmType = _a.osmType, categories = _a.categories, types = _a.types, distance = _a.distance, precision = _a.precision, precisionCode = _a.precisionCode, precisionType = _a.precisionType, attribution = _a.attribution, subLocalityLevels = _a.subLocalityLevels, geocodedObject = __rest(_a, ["placeId", "displayName", "osmId", "osmType", "categories", "types", "distance", "precision", "precisionCode", "precisionType", "attribution", "subLocalityLevels"]); var _this = _super.call(this, geocodedObject) || this; _this.placeId = placeId; _this.displayName = displayName; _this.osmId = osmId; _this.osmType = osmType; _this.categories = categories; _this.types = types; _this.distance = distance; _this.precision = precision; _this.precisionCode = precisionCode; _this.precisionType = precisionType; _this.attribution = attribution; _this.subLocalityLevels = subLocalityLevels || []; return _this; } LocationIQGeocoded.create = function (object) { return new this(object); }; LocationIQGeocoded.prototype.toObject = function () { return __assign(__assign({}, _super.prototype.toObject.call(this)), { placeId: this.placeId, displayName: this.displayName, osmId: this.osmId, osmType: this.osmType, categories: this.categories, types: this.types, distance: this.distance, precision: this.precision, precisionCode: this.precisionCode, precisionType: this.precisionType, attribution: this.attribution, subLocalityLevels: this.subLocalityLevels }); }; LocationIQGeocoded.prototype.withPlaceId = function (placeId) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { placeId: placeId })); }; LocationIQGeocoded.prototype.getPlaceId = function () { return this.placeId; }; LocationIQGeocoded.prototype.withDisplayName = function (displayName) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { displayName: displayName })); }; LocationIQGeocoded.prototype.getDisplayName = function () { return this.displayName; }; LocationIQGeocoded.prototype.withOsmId = function (osmId) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { osmId: osmId })); }; LocationIQGeocoded.prototype.getOsmId = function () { return this.osmId; }; LocationIQGeocoded.prototype.withOsmType = function (osmType) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { osmType: osmType })); }; LocationIQGeocoded.prototype.getOsmType = function () { return this.osmType; }; LocationIQGeocoded.prototype.withCategories = function (categories) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { categories: categories })); }; LocationIQGeocoded.prototype.getCategories = function () { return this.categories; }; LocationIQGeocoded.prototype.withTypes = function (types) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { types: types })); }; LocationIQGeocoded.prototype.getTypes = function () { return this.types; }; LocationIQGeocoded.prototype.withDistance = function (distance) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { distance: distance })); }; LocationIQGeocoded.prototype.getDistance = function () { return this.distance; }; LocationIQGeocoded.prototype.withPrecision = function (precision) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { precision: precision })); }; LocationIQGeocoded.prototype.getPrecision = function () { return this.precision; }; LocationIQGeocoded.prototype.withPrecisionCode = function (precisionCode) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { precisionCode: precisionCode })); }; LocationIQGeocoded.prototype.getPrecisionCode = function () { return this.precisionCode; }; LocationIQGeocoded.prototype.withPrecisionType = function (precisionType) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { precisionType: precisionType })); }; LocationIQGeocoded.prototype.getPrecisionType = function () { return this.precisionType; }; LocationIQGeocoded.prototype.withAttribution = function (attribution) { return new LocationIQGeocoded(__assign(__assign({}, this.toObject()), { attribution: attribution })); }; LocationIQGeocoded.prototype.getAttribution = function () { return this.attribution; }; LocationIQGeocoded.prototype.addSubLocalityLevel = function (subLocalityLevel) { this.subLocalityLevels.push(subLocalityLevel); }; LocationIQGeocoded.prototype.getSubLocalityLevels = function () { return this.subLocalityLevels; }; return LocationIQGeocoded; }(Geocoded_1.default)); exports.default = LocationIQGeocoded; //# sourceMappingURL=LocationIQGeocoded.js.map