@nextgis/ngw-map 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ngw-map.cjs.js +1 -1
- package/lib/ngw-map.cjs.prod.js +1 -1
- package/lib/ngw-map.esm-browser.js +21 -9
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +1 -1
- package/lib/ngw-map.esm-bundler.prod.js +1 -1
- package/lib/ngw-map.global.js +62 -46
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.11.0; author: NextGIS */
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import CancelablePromise from '@nextgis/cancelable-promise';
|
|
4
4
|
import { deepmerge, deprecatedWarn, defined, isObject } from '@nextgis/utils';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{EventEmitter as e}from"events";import t from"@nextgis/cancelable-promise";import{deepmerge as s,deprecatedWarn as r,defined as o,isObject as i}from"@nextgis/utils";import{WebMap as n}from"@nextgis/webmap";export*from"@nextgis/webmap";import{NgwKit as a,createNgwLayerAdapter as c,fetchNgwLayerItem as h,fetchNgwLayerItems as d,fetchNgwLayerFeature as l,fetchNgwLayerFeatureCollection as m,fetchIdentifyItem as u,fetchIdentifyGeoJson as y,fetchNgwResourceExtent as p,sendIdentifyRequest as f,getCompanyLogo as g,getIdentifyItems as w,createIdentifyItem as L}from"@nextgis/ngw-kit";import{getIcon as I}from"@nextgis/icons";import _ from"@nextgis/ngw-connector";import{QmsKit as b}from"@nextgis/qms-kit";function N(e,t,s,r){if("number"==typeof t||"string"==typeof t)t=Number(t),e.push({...s,resource:t});else if(Array.isArray(t)){const[o,i]=t;e.push({...s,resource:o,id:i,...r})}else"object"==typeof t&&e.push({...s,...t,...r})}const v={target:"map",baseUrl:"",whitlabel:!1,controls:["ZOOM","ATTRIBUTION"],controlsOptions:{ZOOM:{position:"top-left"},ATTRIBUTION:{position:"bottom-right",customAttribution:['<a href="https://nextgis.com" target="_blank">©NextGIS</a>']}},pixelRadius:10};class F extends n{constructor(t){super(function(e){const t=[new b];return e.starterKits&&e.starterKits.forEach((e=>{t.push(e)})),e.connector?e.connector&&(e.baseUrl=e.connector.options.baseUrl):e.connector=new _({baseUrl:e.baseUrl||"",auth:e.auth}),(e=s(v,e)).center||e.bounds||(e.bounds=[-179,-90,180,90]),e.connector&&t.push(new a({connector:e.connector,auth:e.auth})),{...e,starterKits:t,create:!1}}(t)),this.emitter=new e,this._ngwLayers={},this._promises={select:[],identify:[]},t.connector&&(this.connector=t.connector),this._createWebMap().then((()=>{const e=this.getContainer();e&&e.classList.add("ngw-map-container"),this.options.whitlabel&&this._whiteLabel()}))}async addControl(e,t,s){return await this.onLoad("controls:create"),super.addControl(e,t,s)}async addNgwLayer(e){await this.onMapLoad();const{keyname:t,resourceId:s}=e;(t||void 0!==s)&&r("set `resource` options instead of `keyname` or `resourceId`");const n=e.resource;if(!t&&!s&&!n)throw new Error("resource, resourceId or keyname is required parameter to add NGW layer");if(o(this.options.baseUrl))try{o(this.options.setViewDelay)&&(e.adapterOptions=e.adapterOptions||{},o(e.adapterOptions.setViewDelay)||(e.adapterOptions.setViewDelay=this.options.setViewDelay));const t=c(e,this,this.connector),s={visibility:!0,...e,...e.adapterOptions},r=await this.addLayer(t,s),i=r&&this.getLayerId(r);if(r&&i&&(this._ngwLayers[i]={layer:r,resourceId:r.resourceId},r.options.name=r.options.name||r.item&&r.item.resource.display_name,r.options.baselayer)){if(this.getActiveBaseLayer())return r}return r}catch(
|
|
1
|
+
import{EventEmitter as e}from"events";import t from"@nextgis/cancelable-promise";import{deepmerge as s,deprecatedWarn as r,defined as o,isObject as i}from"@nextgis/utils";import{WebMap as n}from"@nextgis/webmap";export*from"@nextgis/webmap";import{NgwKit as a,createNgwLayerAdapter as c,fetchNgwLayerItem as h,fetchNgwLayerItems as d,fetchNgwLayerFeature as l,fetchNgwLayerFeatureCollection as m,fetchIdentifyItem as u,fetchIdentifyGeoJson as y,fetchNgwResourceExtent as p,sendIdentifyRequest as f,getCompanyLogo as g,getIdentifyItems as w,createIdentifyItem as L}from"@nextgis/ngw-kit";import{getIcon as I}from"@nextgis/icons";import _ from"@nextgis/ngw-connector";import{QmsKit as b}from"@nextgis/qms-kit";function N(e,t,s,r){if("number"==typeof t||"string"==typeof t)t=Number(t),e.push({...s,resource:t});else if(Array.isArray(t)){const[o,i]=t;e.push({...s,resource:o,id:i,...r})}else"object"==typeof t&&e.push({...s,...t,...r})}const v={target:"map",baseUrl:"",whitlabel:!1,controls:["ZOOM","ATTRIBUTION"],controlsOptions:{ZOOM:{position:"top-left"},ATTRIBUTION:{position:"bottom-right",customAttribution:['<a href="https://nextgis.com" target="_blank">©NextGIS</a>']}},pixelRadius:10};class F extends n{constructor(t){super(function(e){const t=[new b];return e.starterKits&&e.starterKits.forEach((e=>{t.push(e)})),e.connector?e.connector&&(e.baseUrl=e.connector.options.baseUrl):e.connector=new _({baseUrl:e.baseUrl||"",auth:e.auth}),(e=s(v,e)).center||e.bounds||(e.bounds=[-179,-90,180,90]),e.connector&&t.push(new a({connector:e.connector,auth:e.auth})),{...e,starterKits:t,create:!1}}(t)),this.emitter=new e,this._ngwLayers={},this._promises={select:[],identify:[]},t.connector&&(this.connector=t.connector),this._createWebMap().then((()=>{const e=this.getContainer();e&&e.classList.add("ngw-map-container"),this.options.whitlabel&&this._whiteLabel()}))}async addControl(e,t,s){return await this.onLoad("controls:create"),super.addControl(e,t,s)}async addNgwLayer(e){await this.onMapLoad();const{keyname:t,resourceId:s}=e;(t||void 0!==s)&&r("set `resource` options instead of `keyname` or `resourceId`");const n=e.resource;if(!t&&!s&&!n)throw new Error("resource, resourceId or keyname is required parameter to add NGW layer");if(o(this.options.baseUrl))try{o(this.options.setViewDelay)&&(e.adapterOptions=e.adapterOptions||{},o(e.adapterOptions.setViewDelay)||(e.adapterOptions.setViewDelay=this.options.setViewDelay));const t=c(e,this,this.connector),s={visibility:!0,...e,...e.adapterOptions},r=await this.addLayer(t,s),i=r&&this.getLayerId(r);if(r&&i&&(this._ngwLayers[i]={layer:r,resourceId:r.resourceId},r.options.name=r.options.name||r.item&&r.item.resource.display_name,r.options.baselayer)){if(this.getActiveBaseLayer())return r}return r}catch(a){const e=i(n)&&"id"in n?n.id:t||s||n;console.error(`Can't add NGW layer ${e}.`,a)}}fit(){const{center:e,zoom:t,bounds:s}=this.options;e?(this.setCenter(e),t&&this.setZoom(t)):s&&this.fitBounds(s)}fetchNgwLayerItem(e){return h({connector:this.connector,...e})}fetchNgwLayerItems(e){return d({connector:this.connector,...e})}fetchNgwLayerFeature(e){return l({connector:this.connector,...e})}fetchNgwLayerFeatures(e){return m({connector:this.connector,...e})}fetchIdentifyItem(e,t){const s=u({identify:e,connector:this.connector,requestOptions:t});return this._addPromise("identify",s),s}fetchIdentifyGeoJson(e,s=!1){const r=y({identify:e,connector:this.connector,multiple:s});return r&&"then"in r?(this._addPromise("identify",r),r):t.resolve(r)}getIdentifyGeoJson(e,t=!1){return this.fetchIdentifyGeoJson(e,t)}async getNgwLayers(){return await this.onLoad(),this._ngwLayers}async getNgwLayerByResourceId(e){for(const t in this._ngwLayers){const s=this._ngwLayers[t];if(s.resourceId===e)return s&&s.layer;if(s.layer.getIdentificationIds){const t=await s.layer.getIdentificationIds();if(t&&t.some((t=>t===e)))return s.layer}if(s.layer.getDependLayers){const t=s.layer.getDependLayers().find((t=>t.item&&t.item.parentId===e));if(t)return t.layer}}}async fitLayer(e,t){let s;s="string"==typeof e||"number"==typeof e?String(s):e.id;const r=s&&this._ngwLayers[s];if(r)if(r.layer.getBounds){const e=await r.layer.getBounds();e&&this.fitBounds(e,t)}else{let e;if(r.layer.item)e=r.layer.item;else{const t=r.resourceId;e=await this.connector.getResource(t)}e&&p(e,this.connector).then((e=>{e&&this.fitBounds(e,t)}))}else super.fitLayer(e,t)}async zoomToLayer(e){return this.fitLayer(e)}onLoad(e="ngw-map:create"){return super.onLoad(e)}removeLayer(e){const t=this.getLayer(e);if(t){const e=this.getLayerId(t);e&&delete this._ngwLayers[e],super.removeLayer(t)}}enableSelection(){this.$$selectFromNgwRaster||(this.$$selectFromNgwRaster=e=>{this.emitter.listenerCount("ngw:select")&&this._selectFromNgwRaster(e)},this.$$selectFromNgwVector=e=>{this.emitter.listenerCount("ngw:select")&&this._selectFromNgwVector(e)},this.emitter.on("click",this.$$selectFromNgwRaster),this.emitter.on("layer:click",this.$$selectFromNgwVector))}disableSelection(){this.$$selectFromNgwRaster&&(this.emitter.removeListener("click",this.$$selectFromNgwRaster),this.emitter.removeListener("click",this._selectFromNgwVector),this.$$selectFromNgwRaster=void 0,this.$$selectFromNgwVector=void 0)}getNgwLayerItem(e){return this.fetchNgwLayerItem(e)}getNgwLayerItems(e){return this.fetchNgwLayerItems(e)}getNgwLayerFeature(e){return this.fetchNgwLayerFeature(e)}getNgwLayerFeatures(e){return this.fetchNgwLayerFeatures(e)}cancelPromise(...e){this.cancelPromises(...e)}cancelPromises(...e){e.length||(e=Object.keys(this._promises)),e.forEach((e=>{const t=this._promises[e];t&&(t.forEach((e=>e.cancel())),this._promises[e]=[])}))}_addPromise(e,t){const s=this._promises[e];if(s&&-1===s.indexOf(t)){const e=()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)};t.then(e),t.catch(e),s.push(t)}}_isFitFromResource(){const e=this._initMapState;return!e.zoom||!e.center}async _createWebMap(){await this.create(),this.options.qmsId&&this._addQmsBaseLayer(),this.options.osm&&this._addOsmBaseLayer();const e=[],t=this._isFitFromResource();if(this.options.webmapId&&N(e,this.options.webmapId,{fit:t}),this.options.resources&&Array.isArray(this.options.resources))for(const r of this.options.resources){const s={};t||(s.fit=!1),N(e,r,{},s)}for(const r of e)try{await this.addNgwLayer(r)}catch(s){console.warn(s)}this._emitStatusEvent("ngw-map:create",this),this.enableSelection()}_addOsmBaseLayer(){this.addBaseLayer("OSM")}_addQmsBaseLayer(){let e,t;Array.isArray(this.options.qmsId)?(e=this.options.qmsId[0],t=this.options.qmsId[1]):e=Number(this.options.qmsId);const s={qmsId:e};t&&(s.id=t),this.addBaseLayer("QMS",s)}_selectFromNgwVector(e){const t=e.layer,s=t.item&&t.item.resource.id,r=e.feature;if(void 0!==s&&r){const e=r.id;if(e){const t={featureCount:1,[s]:{featureCount:1,features:[{id:Number(e),fields:r.properties||{},label:`#${s}`,layerId:Number(s),parent:"",geom:r.geometry}]}};return this._emitStatusEvent("ngw:select",this._prepareToIdentify({...t,resources:[s],sourceType:"vector"})),t}}}async _selectFromNgwRaster(e){this._emitStatusEvent("ngw:preselect");const t=[],s=Object.values(this._ngwLayers);s.sort(((e,t)=>e.layer.order&&t.layer.order?t.layer.order-e.layer.order:1)),s.forEach((e=>{const s=e.layer,r="function"==typeof s.getIdentificationIds&&s.getIdentificationIds;r&&s.options.selectable&&this.isLayerVisible(s)&&t.push(r.call(s))}));const r=Promise.all(t),o=await r,i=[];if(o.forEach((e=>{e&&e.forEach((e=>i.push(e)))})),!i.length)return void this._emitStatusEvent("ngw:select",null);const n=this.options.pixelRadius||10,a=this.getCenter();let c=this.getZoom();if(c=void 0!==c?c:20,!a||!c)return void this._emitStatusEvent("ngw:select",null);const h=function(e,t,s){return(s=null!=s?s:10)*(40075016.686*Math.abs(Math.cos(180*e[1]/Math.PI))/Math.pow(2,t+8))*5e-4}(a,c,n),d=f(e,{layers:i,connector:this.connector,radius:h}).then((t=>(this._emitStatusEvent("ngw:select",this._prepareToIdentify({...t,resources:i,sourceType:"raster",event:e})),t)));return this._addPromise("select",d),d}_prepareToIdentify(e){return{...e,getIdentifyItems:()=>w(e,!0).map((e=>L({feature:e.feature,connector:this.connector})))}}async _whiteLabel(){const e=this.getContainer();if(e){const t=await g(this.connector,this.options.companyLogoOptions);t&&e.appendChild(t)}}}async function O(e){return new F(e).onLoad()}F.getIcon=I;export{F as NgwMap,O as createNgwMap};
|
|
2
2
|
//# sourceMappingURL=ngw-map.esm-bundler.prod.js.map
|
package/lib/ngw-map.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.11.0; author: NextGIS */
|
|
2
2
|
var NgwMap = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -106,10 +106,14 @@ var NgwMap = (function (exports) {
|
|
|
106
106
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
function __spreadArray(to, from) {
|
|
110
|
-
for (var i = 0,
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
function __spreadArray(to, from, pack) {
|
|
110
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
111
|
+
if (ar || !(i in from)) {
|
|
112
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
113
|
+
ar[i] = from[i];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
function __asyncValues(o) {
|
|
@@ -1113,7 +1117,7 @@ var NgwMap = (function (exports) {
|
|
|
1113
1117
|
|
|
1114
1118
|
/** @internal */
|
|
1115
1119
|
function deprecatedWarn(message) {
|
|
1116
|
-
console.warn("DEPRECATED WARN: "
|
|
1120
|
+
console.warn("DEPRECATED WARN: ".concat(message));
|
|
1117
1121
|
}
|
|
1118
1122
|
|
|
1119
1123
|
// based on https://github.com/bvaughn/debounce-decorator
|
|
@@ -1409,7 +1413,7 @@ var NgwMap = (function (exports) {
|
|
|
1409
1413
|
return true;
|
|
1410
1414
|
if (iLike && a.toUpperCase() === b.toUpperCase())
|
|
1411
1415
|
return true;
|
|
1412
|
-
var re =
|
|
1416
|
+
var re = "^".concat(reEscape(a), "$").replace(/%/g, '.*').replace('_', '.');
|
|
1413
1417
|
return new RegExp(re, iLike ? 'i' : '').exec(b) !== null;
|
|
1414
1418
|
}
|
|
1415
1419
|
var operationsAliases = {
|
|
@@ -2649,7 +2653,7 @@ var NgwMap = (function (exports) {
|
|
|
2649
2653
|
}
|
|
2650
2654
|
layerId = String(_adapter.id);
|
|
2651
2655
|
if (this._layers[layerId]) {
|
|
2652
|
-
throw Error("layer with id '"
|
|
2656
|
+
throw Error("layer with id '".concat(layerId, "' already exist"));
|
|
2653
2657
|
}
|
|
2654
2658
|
if (!layerId) return [3 /*break*/, 8];
|
|
2655
2659
|
this._layers[layerId] = _adapter;
|
|
@@ -4050,12 +4054,16 @@ var NgwMap = (function (exports) {
|
|
|
4050
4054
|
var _this = _super.call(this) || this;
|
|
4051
4055
|
_this.name = 'NetworkError';
|
|
4052
4056
|
Object.setPrototypeOf(_this, NetworkError.prototype);
|
|
4053
|
-
_this.message = "Unable to request "
|
|
4057
|
+
_this.message = "Unable to request ".concat(url, ".\n Possibly invalid NGW URL entered or CORS not configured to get request from ").concat(location.origin); // /control-panel/cors
|
|
4054
4058
|
return _this;
|
|
4055
4059
|
}
|
|
4056
4060
|
return NetworkError;
|
|
4057
4061
|
}(Error));
|
|
4058
4062
|
|
|
4063
|
+
function isObject(val) {
|
|
4064
|
+
return Object.prototype.toString.call(val) === '[object Object]';
|
|
4065
|
+
}
|
|
4066
|
+
|
|
4059
4067
|
var loadData;
|
|
4060
4068
|
// @ts-ignore
|
|
4061
4069
|
{
|
|
@@ -4091,7 +4099,7 @@ var NgwMap = (function (exports) {
|
|
|
4091
4099
|
}
|
|
4092
4100
|
};
|
|
4093
4101
|
xhr.onload = function () {
|
|
4094
|
-
if ([401, 403, 404, 500].indexOf(xhr.status) !== -1) {
|
|
4102
|
+
if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
|
|
4095
4103
|
error(new NgwError(getResponseText()));
|
|
4096
4104
|
}
|
|
4097
4105
|
processingResponse();
|
|
@@ -4146,7 +4154,7 @@ var NgwMap = (function (exports) {
|
|
|
4146
4154
|
data = new FormData();
|
|
4147
4155
|
data.append('file', options.file);
|
|
4148
4156
|
if (options.data) {
|
|
4149
|
-
for (var d in data) {
|
|
4157
|
+
for (var d in options.data) {
|
|
4150
4158
|
data.append(d, data[d]);
|
|
4151
4159
|
}
|
|
4152
4160
|
}
|
|
@@ -4238,10 +4246,6 @@ var NgwMap = (function (exports) {
|
|
|
4238
4246
|
}
|
|
4239
4247
|
}
|
|
4240
4248
|
|
|
4241
|
-
function isObject(val) {
|
|
4242
|
-
return Object.prototype.toString.call(val) === '[object Object]';
|
|
4243
|
-
}
|
|
4244
|
-
|
|
4245
4249
|
var exclude = ['description'];
|
|
4246
4250
|
/**
|
|
4247
4251
|
* @remarks
|
|
@@ -4492,7 +4496,7 @@ var NgwMap = (function (exports) {
|
|
|
4492
4496
|
ResourcesControl.prototype._fetchResourceById = function (id, requestOptions) {
|
|
4493
4497
|
var _this = this;
|
|
4494
4498
|
var promise = function () {
|
|
4495
|
-
return _this.connector.get('resource.item', requestOptions, { id: id })
|
|
4499
|
+
return _this.connector.get('resource.item', requestOptions, { id: id });
|
|
4496
4500
|
};
|
|
4497
4501
|
return this.cache
|
|
4498
4502
|
.add('resource.item', promise, {
|
|
@@ -4539,7 +4543,7 @@ var NgwMap = (function (exports) {
|
|
|
4539
4543
|
.then(function (apiItems) {
|
|
4540
4544
|
var apiItem = apiItems && apiItems[opt.name];
|
|
4541
4545
|
if (apiItem) {
|
|
4542
|
-
apiItem = __spreadArray([], apiItem);
|
|
4546
|
+
apiItem = __spreadArray([], apiItem, true);
|
|
4543
4547
|
var url = apiItem.shift();
|
|
4544
4548
|
if (apiItem.length) {
|
|
4545
4549
|
var replaceParams = {};
|
|
@@ -4561,12 +4565,12 @@ var NgwMap = (function (exports) {
|
|
|
4561
4565
|
if (Array.isArray(paramList)) {
|
|
4562
4566
|
delete params.paramList;
|
|
4563
4567
|
paramList.forEach(function (x) {
|
|
4564
|
-
paramArray_1.push(x[0]
|
|
4568
|
+
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
4565
4569
|
});
|
|
4566
4570
|
}
|
|
4567
4571
|
for (var p in params) {
|
|
4568
4572
|
if (apiItem.indexOf(p) === -1) {
|
|
4569
|
-
paramArray_1.push(p
|
|
4573
|
+
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
4570
4574
|
}
|
|
4571
4575
|
}
|
|
4572
4576
|
if (paramArray_1.length) {
|
|
@@ -4700,7 +4704,7 @@ var NgwMap = (function (exports) {
|
|
|
4700
4704
|
headers: this.getAuthorizationHeaders(credentials),
|
|
4701
4705
|
// withCredentials: true
|
|
4702
4706
|
};
|
|
4703
|
-
// Do not use
|
|
4707
|
+
// Do not use apiRequest('auth.current_user') to avoid circular-references
|
|
4704
4708
|
return this.makeQuery('/api/component/auth/current_user', {}, options)
|
|
4705
4709
|
.then(function (data) {
|
|
4706
4710
|
_this.user = data;
|
|
@@ -4727,7 +4731,7 @@ var NgwMap = (function (exports) {
|
|
|
4727
4731
|
credentials = credentials || this.options.auth;
|
|
4728
4732
|
if (credentials) {
|
|
4729
4733
|
var login = credentials.login, password = credentials.password;
|
|
4730
|
-
var str = unescape(encodeURIComponent(login
|
|
4734
|
+
var str = unescape(encodeURIComponent("".concat(login, ":").concat(password)));
|
|
4731
4735
|
// @ts-ignore
|
|
4732
4736
|
{
|
|
4733
4737
|
return window.btoa(str);
|
|
@@ -5012,7 +5016,7 @@ var NgwMap = (function (exports) {
|
|
|
5012
5016
|
if (value) {
|
|
5013
5017
|
var propElem = document.createElement('div');
|
|
5014
5018
|
element_1.appendChild(propElem);
|
|
5015
|
-
propElem.innerHTML = "<span>"
|
|
5019
|
+
propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
|
|
5016
5020
|
}
|
|
5017
5021
|
}
|
|
5018
5022
|
});
|
|
@@ -5021,7 +5025,7 @@ var NgwMap = (function (exports) {
|
|
|
5021
5025
|
for (var p in feature.properties) {
|
|
5022
5026
|
var propElem = document.createElement('div');
|
|
5023
5027
|
element_1.appendChild(propElem);
|
|
5024
|
-
propElem.innerHTML = "<span>"
|
|
5028
|
+
propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
|
|
5025
5029
|
}
|
|
5026
5030
|
}
|
|
5027
5031
|
return element_1;
|
|
@@ -5204,15 +5208,15 @@ var NgwMap = (function (exports) {
|
|
|
5204
5208
|
return b;
|
|
5205
5209
|
});
|
|
5206
5210
|
var v = vStart + value + vEnd;
|
|
5207
|
-
return [""
|
|
5211
|
+
return ["".concat(isFldStr).concat(field_, "__").concat(operation), v];
|
|
5208
5212
|
};
|
|
5209
5213
|
if (logic === 'any') {
|
|
5210
5214
|
filters_.forEach(function (f) {
|
|
5211
5215
|
if (isPropertyFilter(f)) {
|
|
5212
|
-
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), [createParam(f)]) })));
|
|
5216
|
+
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), [createParam(f)], false) })));
|
|
5213
5217
|
}
|
|
5214
5218
|
else {
|
|
5215
|
-
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams));
|
|
5219
|
+
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
|
|
5216
5220
|
}
|
|
5217
5221
|
});
|
|
5218
5222
|
}
|
|
@@ -5231,11 +5235,11 @@ var NgwMap = (function (exports) {
|
|
|
5231
5235
|
if (propertiesFilterList.length) {
|
|
5232
5236
|
for (var _a = 0, propertiesFilterList_1 = propertiesFilterList; _a < propertiesFilterList_1.length; _a++) {
|
|
5233
5237
|
var x = propertiesFilterList_1[_a];
|
|
5234
|
-
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams, true), filters_2));
|
|
5238
|
+
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams, true), filters_2, true));
|
|
5235
5239
|
}
|
|
5236
5240
|
}
|
|
5237
5241
|
else {
|
|
5238
|
-
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), filters_2) })));
|
|
5242
|
+
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), filters_2, true) })));
|
|
5239
5243
|
}
|
|
5240
5244
|
}
|
|
5241
5245
|
return CancelablePromise.all(_queries).then(function (itemsParts) {
|
|
@@ -5254,7 +5258,7 @@ var NgwMap = (function (exports) {
|
|
|
5254
5258
|
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
5255
5259
|
return x + ' ' + y;
|
|
5256
5260
|
});
|
|
5257
|
-
return "POLYGON(("
|
|
5261
|
+
return "POLYGON((".concat(polygon.join(', '), "))");
|
|
5258
5262
|
}
|
|
5259
5263
|
function fetchNgwLayerItemsRequest(options) {
|
|
5260
5264
|
var params = __assign({}, FEATURE_REQUEST_PARAMS);
|
|
@@ -5309,7 +5313,7 @@ var NgwMap = (function (exports) {
|
|
|
5309
5313
|
dt_1.push(x);
|
|
5310
5314
|
});
|
|
5311
5315
|
}
|
|
5312
|
-
fields[f] = new (Date.bind.apply(Date, __spreadArray([void 0], dt_1)))().toISOString();
|
|
5316
|
+
fields[f] = new (Date.bind.apply(Date, __spreadArray([void 0], dt_1, false)))().toISOString();
|
|
5313
5317
|
}
|
|
5314
5318
|
}
|
|
5315
5319
|
};
|
|
@@ -5714,7 +5718,7 @@ var NgwMap = (function (exports) {
|
|
|
5714
5718
|
}
|
|
5715
5719
|
}
|
|
5716
5720
|
if (adapter === 'WMS') {
|
|
5717
|
-
url = baseUrl
|
|
5721
|
+
url = "".concat(baseUrl, "/api/resource/").concat(resourceId, "/wms");
|
|
5718
5722
|
var adapterOptions = options.adapterOptions;
|
|
5719
5723
|
return {
|
|
5720
5724
|
url: url,
|
|
@@ -5738,12 +5742,12 @@ var NgwMap = (function (exports) {
|
|
|
5738
5742
|
};
|
|
5739
5743
|
}
|
|
5740
5744
|
if (adapter === 'TERRAIN') {
|
|
5741
|
-
url = baseUrl +
|
|
5745
|
+
url = baseUrl + "/api/resource/".concat(resourceId, "/terrain_provider");
|
|
5742
5746
|
// `/api/resource/${resourceId}/terrain_provider/{z}/{x}/{y}.terrain`;
|
|
5743
5747
|
return { url: url, adapter: adapter };
|
|
5744
5748
|
}
|
|
5745
5749
|
if (adapter === 'MODEL_3D') {
|
|
5746
|
-
url = baseUrl +
|
|
5750
|
+
url = baseUrl + "/api/component/model_3d/".concat(resourceId, "/data.glb");
|
|
5747
5751
|
return { url: url };
|
|
5748
5752
|
}
|
|
5749
5753
|
if (adapter === 'TILE') {
|
|
@@ -6029,7 +6033,7 @@ var NgwMap = (function (exports) {
|
|
|
6029
6033
|
});
|
|
6030
6034
|
};
|
|
6031
6035
|
TreeHelper.prototype.getChildren = function () {
|
|
6032
|
-
return __spreadArray([], this._children);
|
|
6036
|
+
return __spreadArray([], this._children, true);
|
|
6033
6037
|
};
|
|
6034
6038
|
return TreeHelper;
|
|
6035
6039
|
}());
|
|
@@ -6551,7 +6555,7 @@ var NgwMap = (function (exports) {
|
|
|
6551
6555
|
return options;
|
|
6552
6556
|
};
|
|
6553
6557
|
NgwWebmapItem.prototype.getChildren = function (item) {
|
|
6554
|
-
return __spreadArray([], item.children).reverse();
|
|
6558
|
+
return __spreadArray([], item.children, true).reverse();
|
|
6555
6559
|
};
|
|
6556
6560
|
NgwWebmapItem.prototype._mapScaleToZoomLevel = function (scale) {
|
|
6557
6561
|
return setScaleRatio(scale);
|
|
@@ -6871,16 +6875,25 @@ var NgwMap = (function (exports) {
|
|
|
6871
6875
|
}
|
|
6872
6876
|
}
|
|
6873
6877
|
NgwWebmapLayerAdapter.prototype.addLayer = function (options) {
|
|
6878
|
+
var _a, _b;
|
|
6874
6879
|
return __awaiter(this, void 0, void 0, function () {
|
|
6875
|
-
var
|
|
6876
|
-
return __generator(this, function (
|
|
6877
|
-
switch (
|
|
6880
|
+
var _c, extentConstrained;
|
|
6881
|
+
return __generator(this, function (_d) {
|
|
6882
|
+
switch (_d.label) {
|
|
6878
6883
|
case 0:
|
|
6879
6884
|
this.options = __assign(__assign({}, this.options), options);
|
|
6880
|
-
|
|
6885
|
+
_c = this;
|
|
6881
6886
|
return [4 /*yield*/, this._getWebMapLayerItem()];
|
|
6882
6887
|
case 1:
|
|
6883
|
-
|
|
6888
|
+
_c.layer = _d.sent();
|
|
6889
|
+
extentConstrained = (_b = (_a = this.response) === null || _a === void 0 ? void 0 : _a.webmap) === null || _b === void 0 ? void 0 : _b.extent_constrained;
|
|
6890
|
+
if (this.options.useExtentConstrained &&
|
|
6891
|
+
this._extent &&
|
|
6892
|
+
extentConstrained) {
|
|
6893
|
+
this.options.webMap.setView({ maxBounds: this._extent });
|
|
6894
|
+
// @ts-ignore
|
|
6895
|
+
window.webmap = this.options.webMap;
|
|
6896
|
+
}
|
|
6884
6897
|
return [2 /*return*/, this.layer];
|
|
6885
6898
|
}
|
|
6886
6899
|
});
|
|
@@ -6903,6 +6916,9 @@ var NgwMap = (function (exports) {
|
|
|
6903
6916
|
this.options.webMap.showLayer(this._lastActiveBaselayer);
|
|
6904
6917
|
}
|
|
6905
6918
|
}
|
|
6919
|
+
if (this.options.useExtentConstrained && this._extent) {
|
|
6920
|
+
this.options.webMap.setView({ maxBounds: null });
|
|
6921
|
+
}
|
|
6906
6922
|
delete this.layer;
|
|
6907
6923
|
delete this.response;
|
|
6908
6924
|
delete this._webmapLayersIds;
|
|
@@ -7585,7 +7601,7 @@ var NgwMap = (function (exports) {
|
|
|
7585
7601
|
}
|
|
7586
7602
|
}
|
|
7587
7603
|
else {
|
|
7588
|
-
throw "Resource class '"
|
|
7604
|
+
throw "Resource class '".concat(cls, "' not yet supported.");
|
|
7589
7605
|
}
|
|
7590
7606
|
_a.label = 13;
|
|
7591
7607
|
case 13: return [3 /*break*/, 15];
|
|
@@ -7946,7 +7962,7 @@ var NgwMap = (function (exports) {
|
|
|
7946
7962
|
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
7947
7963
|
polygon.push(x + ' ' + y);
|
|
7948
7964
|
});
|
|
7949
|
-
var wkt = "POLYGON(("
|
|
7965
|
+
var wkt = "POLYGON((".concat(polygon.join(', '), "))");
|
|
7950
7966
|
var layers = options.layers;
|
|
7951
7967
|
var data = {
|
|
7952
7968
|
geom: wkt,
|
|
@@ -8036,7 +8052,7 @@ var NgwMap = (function (exports) {
|
|
|
8036
8052
|
function insertSvg(width, height, stroke, content) {
|
|
8037
8053
|
if (stroke === void 0) { stroke = 0; }
|
|
8038
8054
|
var s = stroke / 2;
|
|
8039
|
-
var svg = "<svg\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\""
|
|
8055
|
+
var svg = "<svg\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(width, "\"\n height=\"").concat(height, "\"\n viewBox=\"-").concat(s, " -").concat(s, " ").concat(width + stroke, " ").concat(height + stroke, "\"\n >").concat(content, "</svg>");
|
|
8040
8056
|
var oParser = new DOMParser();
|
|
8041
8057
|
var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
|
|
8042
8058
|
return oDOM.documentElement;
|
|
@@ -8056,7 +8072,7 @@ var NgwMap = (function (exports) {
|
|
|
8056
8072
|
var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
|
|
8057
8073
|
var svg = insertSvg(size, size, stroke * scale, path);
|
|
8058
8074
|
var fistChild = svg.firstChild;
|
|
8059
|
-
var transform = "scale("
|
|
8075
|
+
var transform = "scale(".concat(scale, ")");
|
|
8060
8076
|
fistChild.setAttribute('fill', color);
|
|
8061
8077
|
if (stroke) {
|
|
8062
8078
|
fistChild.setAttribute('stroke', strokeColor);
|
|
@@ -8277,7 +8293,7 @@ var NgwMap = (function (exports) {
|
|
|
8277
8293
|
resId = isObject$1(resource) && 'id' in resource
|
|
8278
8294
|
? resource.id
|
|
8279
8295
|
: keyname || resourceId || resource;
|
|
8280
|
-
console.error("Can't add NGW layer "
|
|
8296
|
+
console.error("Can't add NGW layer ".concat(resId, "."), er_1);
|
|
8281
8297
|
return [3 /*break*/, 5];
|
|
8282
8298
|
case 5: return [2 /*return*/];
|
|
8283
8299
|
}
|
|
@@ -8671,7 +8687,7 @@ var NgwMap = (function (exports) {
|
|
|
8671
8687
|
var identifyFeature = {
|
|
8672
8688
|
id: Number(featureId),
|
|
8673
8689
|
fields: feature.properties || {},
|
|
8674
|
-
label: "#"
|
|
8690
|
+
label: "#".concat(id),
|
|
8675
8691
|
layerId: Number(id),
|
|
8676
8692
|
parent: '',
|
|
8677
8693
|
geom: feature.geometry,
|