@nextgis/ngw-map 1.9.7 → 1.11.3
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/index.d.ts +39 -12
- package/lib/ngw-map.cjs.js +1 -1
- package/lib/ngw-map.cjs.prod.js +1 -1
- package/lib/ngw-map.esm-browser.js +47 -11
- 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 +88 -48
- 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.3; 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.3; 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 = {
|
|
@@ -1859,7 +1863,7 @@ var NgwMap = (function (exports) {
|
|
|
1859
1863
|
minZoom: 0,
|
|
1860
1864
|
maxZoom: 20,
|
|
1861
1865
|
paint: {
|
|
1862
|
-
color: '
|
|
1866
|
+
color: '#0000ff',
|
|
1863
1867
|
opacity: 0.4,
|
|
1864
1868
|
strokeOpacity: 1,
|
|
1865
1869
|
stroke: true,
|
|
@@ -1867,7 +1871,7 @@ var NgwMap = (function (exports) {
|
|
|
1867
1871
|
weight: 1,
|
|
1868
1872
|
},
|
|
1869
1873
|
selectedPaint: {
|
|
1870
|
-
color: '
|
|
1874
|
+
color: '#00008b',
|
|
1871
1875
|
opacity: 0.4,
|
|
1872
1876
|
strokeOpacity: 1,
|
|
1873
1877
|
stroke: true,
|
|
@@ -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;
|
|
@@ -3143,6 +3147,30 @@ var NgwMap = (function (exports) {
|
|
|
3143
3147
|
adapter.clearLayer(cb);
|
|
3144
3148
|
}
|
|
3145
3149
|
};
|
|
3150
|
+
WebMapLayers.prototype.setLayerPaint = function (layerDef, paint) {
|
|
3151
|
+
var layer = this.getLayer(layerDef);
|
|
3152
|
+
if (paint && layer && layer.setPaint) {
|
|
3153
|
+
layer.setPaint(paint);
|
|
3154
|
+
}
|
|
3155
|
+
};
|
|
3156
|
+
WebMapLayers.prototype.setLayerSelectedPaint = function (layerDef, paint) {
|
|
3157
|
+
var layer = this.getLayer(layerDef);
|
|
3158
|
+
if (paint && layer && layer.setSelectedPaint) {
|
|
3159
|
+
layer.setSelectedPaint(paint);
|
|
3160
|
+
}
|
|
3161
|
+
};
|
|
3162
|
+
WebMapLayers.prototype.updateLayerPaint = function (layerDef, paint) {
|
|
3163
|
+
var layer = this.getLayer(layerDef);
|
|
3164
|
+
if (paint && layer && layer.updatePaint) {
|
|
3165
|
+
layer.updatePaint(paint);
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3168
|
+
WebMapLayers.prototype.updateLayerSelectedPaint = function (layerDef, paint) {
|
|
3169
|
+
var layer = this.getLayer(layerDef);
|
|
3170
|
+
if (paint && layer && layer.updateSelectedPaint) {
|
|
3171
|
+
layer.updateSelectedPaint(paint);
|
|
3172
|
+
}
|
|
3173
|
+
};
|
|
3146
3174
|
WebMapLayers.prototype.getAttributions = function (options) {
|
|
3147
3175
|
var attributions = [];
|
|
3148
3176
|
for (var l in this._layers) {
|
|
@@ -4026,12 +4054,16 @@ var NgwMap = (function (exports) {
|
|
|
4026
4054
|
var _this = _super.call(this) || this;
|
|
4027
4055
|
_this.name = 'NetworkError';
|
|
4028
4056
|
Object.setPrototypeOf(_this, NetworkError.prototype);
|
|
4029
|
-
_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
|
|
4030
4058
|
return _this;
|
|
4031
4059
|
}
|
|
4032
4060
|
return NetworkError;
|
|
4033
4061
|
}(Error));
|
|
4034
4062
|
|
|
4063
|
+
function isObject(val) {
|
|
4064
|
+
return Object.prototype.toString.call(val) === '[object Object]';
|
|
4065
|
+
}
|
|
4066
|
+
|
|
4035
4067
|
var loadData;
|
|
4036
4068
|
// @ts-ignore
|
|
4037
4069
|
{
|
|
@@ -4067,7 +4099,7 @@ var NgwMap = (function (exports) {
|
|
|
4067
4099
|
}
|
|
4068
4100
|
};
|
|
4069
4101
|
xhr.onload = function () {
|
|
4070
|
-
if ([401, 403, 404, 500].indexOf(xhr.status) !== -1) {
|
|
4102
|
+
if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
|
|
4071
4103
|
error(new NgwError(getResponseText()));
|
|
4072
4104
|
}
|
|
4073
4105
|
processingResponse();
|
|
@@ -4122,7 +4154,7 @@ var NgwMap = (function (exports) {
|
|
|
4122
4154
|
data = new FormData();
|
|
4123
4155
|
data.append('file', options.file);
|
|
4124
4156
|
if (options.data) {
|
|
4125
|
-
for (var d in data) {
|
|
4157
|
+
for (var d in options.data) {
|
|
4126
4158
|
data.append(d, data[d]);
|
|
4127
4159
|
}
|
|
4128
4160
|
}
|
|
@@ -4214,10 +4246,6 @@ var NgwMap = (function (exports) {
|
|
|
4214
4246
|
}
|
|
4215
4247
|
}
|
|
4216
4248
|
|
|
4217
|
-
function isObject(val) {
|
|
4218
|
-
return Object.prototype.toString.call(val) === '[object Object]';
|
|
4219
|
-
}
|
|
4220
|
-
|
|
4221
4249
|
var exclude = ['description'];
|
|
4222
4250
|
/**
|
|
4223
4251
|
* @remarks
|
|
@@ -4468,7 +4496,7 @@ var NgwMap = (function (exports) {
|
|
|
4468
4496
|
ResourcesControl.prototype._fetchResourceById = function (id, requestOptions) {
|
|
4469
4497
|
var _this = this;
|
|
4470
4498
|
var promise = function () {
|
|
4471
|
-
return _this.connector.get('resource.item', requestOptions, { id: id })
|
|
4499
|
+
return _this.connector.get('resource.item', requestOptions, { id: id });
|
|
4472
4500
|
};
|
|
4473
4501
|
return this.cache
|
|
4474
4502
|
.add('resource.item', promise, {
|
|
@@ -4515,7 +4543,7 @@ var NgwMap = (function (exports) {
|
|
|
4515
4543
|
.then(function (apiItems) {
|
|
4516
4544
|
var apiItem = apiItems && apiItems[opt.name];
|
|
4517
4545
|
if (apiItem) {
|
|
4518
|
-
apiItem = __spreadArray([], apiItem);
|
|
4546
|
+
apiItem = __spreadArray([], apiItem, true);
|
|
4519
4547
|
var url = apiItem.shift();
|
|
4520
4548
|
if (apiItem.length) {
|
|
4521
4549
|
var replaceParams = {};
|
|
@@ -4537,12 +4565,12 @@ var NgwMap = (function (exports) {
|
|
|
4537
4565
|
if (Array.isArray(paramList)) {
|
|
4538
4566
|
delete params.paramList;
|
|
4539
4567
|
paramList.forEach(function (x) {
|
|
4540
|
-
paramArray_1.push(x[0]
|
|
4568
|
+
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
4541
4569
|
});
|
|
4542
4570
|
}
|
|
4543
4571
|
for (var p in params) {
|
|
4544
4572
|
if (apiItem.indexOf(p) === -1) {
|
|
4545
|
-
paramArray_1.push(p
|
|
4573
|
+
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
4546
4574
|
}
|
|
4547
4575
|
}
|
|
4548
4576
|
if (paramArray_1.length) {
|
|
@@ -4676,7 +4704,7 @@ var NgwMap = (function (exports) {
|
|
|
4676
4704
|
headers: this.getAuthorizationHeaders(credentials),
|
|
4677
4705
|
// withCredentials: true
|
|
4678
4706
|
};
|
|
4679
|
-
// Do not use
|
|
4707
|
+
// Do not use apiRequest('auth.current_user') to avoid circular-references
|
|
4680
4708
|
return this.makeQuery('/api/component/auth/current_user', {}, options)
|
|
4681
4709
|
.then(function (data) {
|
|
4682
4710
|
_this.user = data;
|
|
@@ -4703,7 +4731,7 @@ var NgwMap = (function (exports) {
|
|
|
4703
4731
|
credentials = credentials || this.options.auth;
|
|
4704
4732
|
if (credentials) {
|
|
4705
4733
|
var login = credentials.login, password = credentials.password;
|
|
4706
|
-
var str = unescape(encodeURIComponent(login
|
|
4734
|
+
var str = unescape(encodeURIComponent("".concat(login, ":").concat(password)));
|
|
4707
4735
|
// @ts-ignore
|
|
4708
4736
|
{
|
|
4709
4737
|
return window.btoa(str);
|
|
@@ -4988,7 +5016,7 @@ var NgwMap = (function (exports) {
|
|
|
4988
5016
|
if (value) {
|
|
4989
5017
|
var propElem = document.createElement('div');
|
|
4990
5018
|
element_1.appendChild(propElem);
|
|
4991
|
-
propElem.innerHTML = "<span>"
|
|
5019
|
+
propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
|
|
4992
5020
|
}
|
|
4993
5021
|
}
|
|
4994
5022
|
});
|
|
@@ -4997,7 +5025,7 @@ var NgwMap = (function (exports) {
|
|
|
4997
5025
|
for (var p in feature.properties) {
|
|
4998
5026
|
var propElem = document.createElement('div');
|
|
4999
5027
|
element_1.appendChild(propElem);
|
|
5000
|
-
propElem.innerHTML = "<span>"
|
|
5028
|
+
propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
|
|
5001
5029
|
}
|
|
5002
5030
|
}
|
|
5003
5031
|
return element_1;
|
|
@@ -5180,15 +5208,15 @@ var NgwMap = (function (exports) {
|
|
|
5180
5208
|
return b;
|
|
5181
5209
|
});
|
|
5182
5210
|
var v = vStart + value + vEnd;
|
|
5183
|
-
return [""
|
|
5211
|
+
return ["".concat(isFldStr).concat(field_, "__").concat(operation), v];
|
|
5184
5212
|
};
|
|
5185
5213
|
if (logic === 'any') {
|
|
5186
5214
|
filters_.forEach(function (f) {
|
|
5187
5215
|
if (isPropertyFilter(f)) {
|
|
5188
|
-
_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) })));
|
|
5189
5217
|
}
|
|
5190
5218
|
else {
|
|
5191
|
-
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams));
|
|
5219
|
+
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
|
|
5192
5220
|
}
|
|
5193
5221
|
});
|
|
5194
5222
|
}
|
|
@@ -5207,11 +5235,11 @@ var NgwMap = (function (exports) {
|
|
|
5207
5235
|
if (propertiesFilterList.length) {
|
|
5208
5236
|
for (var _a = 0, propertiesFilterList_1 = propertiesFilterList; _a < propertiesFilterList_1.length; _a++) {
|
|
5209
5237
|
var x = propertiesFilterList_1[_a];
|
|
5210
|
-
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));
|
|
5211
5239
|
}
|
|
5212
5240
|
}
|
|
5213
5241
|
else {
|
|
5214
|
-
_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) })));
|
|
5215
5243
|
}
|
|
5216
5244
|
}
|
|
5217
5245
|
return CancelablePromise.all(_queries).then(function (itemsParts) {
|
|
@@ -5230,7 +5258,7 @@ var NgwMap = (function (exports) {
|
|
|
5230
5258
|
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
5231
5259
|
return x + ' ' + y;
|
|
5232
5260
|
});
|
|
5233
|
-
return "POLYGON(("
|
|
5261
|
+
return "POLYGON((".concat(polygon.join(', '), "))");
|
|
5234
5262
|
}
|
|
5235
5263
|
function fetchNgwLayerItemsRequest(options) {
|
|
5236
5264
|
var params = __assign({}, FEATURE_REQUEST_PARAMS);
|
|
@@ -5285,7 +5313,7 @@ var NgwMap = (function (exports) {
|
|
|
5285
5313
|
dt_1.push(x);
|
|
5286
5314
|
});
|
|
5287
5315
|
}
|
|
5288
|
-
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();
|
|
5289
5317
|
}
|
|
5290
5318
|
}
|
|
5291
5319
|
};
|
|
@@ -5690,7 +5718,7 @@ var NgwMap = (function (exports) {
|
|
|
5690
5718
|
}
|
|
5691
5719
|
}
|
|
5692
5720
|
if (adapter === 'WMS') {
|
|
5693
|
-
url = baseUrl
|
|
5721
|
+
url = "".concat(baseUrl, "/api/resource/").concat(resourceId, "/wms");
|
|
5694
5722
|
var adapterOptions = options.adapterOptions;
|
|
5695
5723
|
return {
|
|
5696
5724
|
url: url,
|
|
@@ -5714,12 +5742,12 @@ var NgwMap = (function (exports) {
|
|
|
5714
5742
|
};
|
|
5715
5743
|
}
|
|
5716
5744
|
if (adapter === 'TERRAIN') {
|
|
5717
|
-
url = baseUrl +
|
|
5745
|
+
url = baseUrl + "/api/resource/".concat(resourceId, "/terrain_provider");
|
|
5718
5746
|
// `/api/resource/${resourceId}/terrain_provider/{z}/{x}/{y}.terrain`;
|
|
5719
5747
|
return { url: url, adapter: adapter };
|
|
5720
5748
|
}
|
|
5721
5749
|
if (adapter === 'MODEL_3D') {
|
|
5722
|
-
url = baseUrl +
|
|
5750
|
+
url = baseUrl + "/api/component/model_3d/".concat(resourceId, "/data.glb");
|
|
5723
5751
|
return { url: url };
|
|
5724
5752
|
}
|
|
5725
5753
|
if (adapter === 'TILE') {
|
|
@@ -6005,7 +6033,7 @@ var NgwMap = (function (exports) {
|
|
|
6005
6033
|
});
|
|
6006
6034
|
};
|
|
6007
6035
|
TreeHelper.prototype.getChildren = function () {
|
|
6008
|
-
return __spreadArray([], this._children);
|
|
6036
|
+
return __spreadArray([], this._children, true);
|
|
6009
6037
|
};
|
|
6010
6038
|
return TreeHelper;
|
|
6011
6039
|
}());
|
|
@@ -6527,7 +6555,7 @@ var NgwMap = (function (exports) {
|
|
|
6527
6555
|
return options;
|
|
6528
6556
|
};
|
|
6529
6557
|
NgwWebmapItem.prototype.getChildren = function (item) {
|
|
6530
|
-
return __spreadArray([], item.children).reverse();
|
|
6558
|
+
return __spreadArray([], item.children, true).reverse();
|
|
6531
6559
|
};
|
|
6532
6560
|
NgwWebmapItem.prototype._mapScaleToZoomLevel = function (scale) {
|
|
6533
6561
|
return setScaleRatio(scale);
|
|
@@ -6847,16 +6875,25 @@ var NgwMap = (function (exports) {
|
|
|
6847
6875
|
}
|
|
6848
6876
|
}
|
|
6849
6877
|
NgwWebmapLayerAdapter.prototype.addLayer = function (options) {
|
|
6878
|
+
var _a, _b;
|
|
6850
6879
|
return __awaiter(this, void 0, void 0, function () {
|
|
6851
|
-
var
|
|
6852
|
-
return __generator(this, function (
|
|
6853
|
-
switch (
|
|
6880
|
+
var _c, extentConstrained;
|
|
6881
|
+
return __generator(this, function (_d) {
|
|
6882
|
+
switch (_d.label) {
|
|
6854
6883
|
case 0:
|
|
6855
6884
|
this.options = __assign(__assign({}, this.options), options);
|
|
6856
|
-
|
|
6885
|
+
_c = this;
|
|
6857
6886
|
return [4 /*yield*/, this._getWebMapLayerItem()];
|
|
6858
6887
|
case 1:
|
|
6859
|
-
|
|
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
|
+
}
|
|
6860
6897
|
return [2 /*return*/, this.layer];
|
|
6861
6898
|
}
|
|
6862
6899
|
});
|
|
@@ -6879,6 +6916,9 @@ var NgwMap = (function (exports) {
|
|
|
6879
6916
|
this.options.webMap.showLayer(this._lastActiveBaselayer);
|
|
6880
6917
|
}
|
|
6881
6918
|
}
|
|
6919
|
+
if (this.options.useExtentConstrained && this._extent) {
|
|
6920
|
+
this.options.webMap.setView({ maxBounds: null });
|
|
6921
|
+
}
|
|
6882
6922
|
delete this.layer;
|
|
6883
6923
|
delete this.response;
|
|
6884
6924
|
delete this._webmapLayersIds;
|
|
@@ -7561,7 +7601,7 @@ var NgwMap = (function (exports) {
|
|
|
7561
7601
|
}
|
|
7562
7602
|
}
|
|
7563
7603
|
else {
|
|
7564
|
-
throw "Resource class '"
|
|
7604
|
+
throw "Resource class '".concat(cls, "' not yet supported.");
|
|
7565
7605
|
}
|
|
7566
7606
|
_a.label = 13;
|
|
7567
7607
|
case 13: return [3 /*break*/, 15];
|
|
@@ -7922,7 +7962,7 @@ var NgwMap = (function (exports) {
|
|
|
7922
7962
|
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
7923
7963
|
polygon.push(x + ' ' + y);
|
|
7924
7964
|
});
|
|
7925
|
-
var wkt = "POLYGON(("
|
|
7965
|
+
var wkt = "POLYGON((".concat(polygon.join(', '), "))");
|
|
7926
7966
|
var layers = options.layers;
|
|
7927
7967
|
var data = {
|
|
7928
7968
|
geom: wkt,
|
|
@@ -8012,7 +8052,7 @@ var NgwMap = (function (exports) {
|
|
|
8012
8052
|
function insertSvg(width, height, stroke, content) {
|
|
8013
8053
|
if (stroke === void 0) { stroke = 0; }
|
|
8014
8054
|
var s = stroke / 2;
|
|
8015
|
-
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>");
|
|
8016
8056
|
var oParser = new DOMParser();
|
|
8017
8057
|
var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
|
|
8018
8058
|
return oDOM.documentElement;
|
|
@@ -8032,7 +8072,7 @@ var NgwMap = (function (exports) {
|
|
|
8032
8072
|
var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
|
|
8033
8073
|
var svg = insertSvg(size, size, stroke * scale, path);
|
|
8034
8074
|
var fistChild = svg.firstChild;
|
|
8035
|
-
var transform = "scale("
|
|
8075
|
+
var transform = "scale(".concat(scale, ")");
|
|
8036
8076
|
fistChild.setAttribute('fill', color);
|
|
8037
8077
|
if (stroke) {
|
|
8038
8078
|
fistChild.setAttribute('stroke', strokeColor);
|
|
@@ -8253,7 +8293,7 @@ var NgwMap = (function (exports) {
|
|
|
8253
8293
|
resId = isObject$1(resource) && 'id' in resource
|
|
8254
8294
|
? resource.id
|
|
8255
8295
|
: keyname || resourceId || resource;
|
|
8256
|
-
console.error("Can't add NGW layer "
|
|
8296
|
+
console.error("Can't add NGW layer ".concat(resId, "."), er_1);
|
|
8257
8297
|
return [3 /*break*/, 5];
|
|
8258
8298
|
case 5: return [2 /*return*/];
|
|
8259
8299
|
}
|
|
@@ -8647,7 +8687,7 @@ var NgwMap = (function (exports) {
|
|
|
8647
8687
|
var identifyFeature = {
|
|
8648
8688
|
id: Number(featureId),
|
|
8649
8689
|
fields: feature.properties || {},
|
|
8650
|
-
label: "#"
|
|
8690
|
+
label: "#".concat(id),
|
|
8651
8691
|
layerId: Number(id),
|
|
8652
8692
|
parent: '',
|
|
8653
8693
|
geom: feature.geometry,
|