@opengeoweb/webmap 2.0.1 → 2.1.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/webmap.umd.js CHANGED
@@ -3433,15 +3433,11 @@
3433
3433
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3434
3434
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
3435
3435
  * */
3436
- var WMDrawMarker = function WMDrawMarker(context, coordx, coordy, fillColor, outlineColor) {
3436
+ var WMDrawMarker = function WMDrawMarker(context, coordx, coordy, fillColor) {
3437
3437
  if (fillColor === void 0) {
3438
3438
  fillColor = '#FFF';
3439
3439
  }
3440
3440
 
3441
- if (outlineColor === void 0) {
3442
- outlineColor = '#000';
3443
- }
3444
-
3445
3441
  var ctx = context;
3446
3442
  var coord = {
3447
3443
  x: parseInt(coordx.toString(), 10),
@@ -3450,8 +3446,8 @@
3450
3446
  ctx.fillStyle = fillColor;
3451
3447
  ctx.globalAlpha = 1.0;
3452
3448
  ctx.beginPath();
3453
- var topRadius = 9;
3454
- var topHeight = 2.5 * topRadius;
3449
+ var topRadius = 7;
3450
+ var topHeight = 2 * topRadius;
3455
3451
  ctx.arc(coord.x, coord.y - topHeight, topRadius, Math.PI, Math.PI * 2);
3456
3452
  ctx.bezierCurveTo(coord.x + topRadius, coord.y - topHeight, coord.x + topRadius / 1.6, coord.y - topRadius, coord.x, coord.y);
3457
3453
  ctx.bezierCurveTo(coord.x, coord.y, coord.x - topRadius / 1.6, coord.y - topRadius, coord.x - topRadius, coord.y - topHeight);
@@ -3461,13 +3457,7 @@
3461
3457
 
3462
3458
  ctx.fillStyle = '#FFF';
3463
3459
  ctx.beginPath();
3464
- ctx.arc(coord.x, coord.y - topHeight, topRadius / 2, Math.PI * 2, 0);
3465
- ctx.fill();
3466
- /* Fill marker exact location */
3467
-
3468
- ctx.fillStyle = outlineColor;
3469
- ctx.beginPath();
3470
- ctx.arc(coord.x, coord.y, 2, Math.PI * 2, 0);
3460
+ ctx.arc(coord.x, coord.y - topHeight, topRadius / 2.5, Math.PI * 2, 0);
3471
3461
  ctx.fill();
3472
3462
  };
3473
3463
 
@@ -3563,7 +3553,7 @@
3563
3553
 
3564
3554
  MapPin.prototype.drawMarker = function (ctx) {
3565
3555
  if (isDefined(this.x) && isDefined(this.y)) {
3566
- WMDrawMarker(ctx, this.x, this.y, '#9090FF', '#000');
3556
+ WMDrawMarker(ctx, this.x, this.y, '#051039');
3567
3557
  }
3568
3558
  };
3569
3559
 
@@ -4037,7 +4027,6 @@
4037
4027
  this.previousMouseButtonState = 'up';
4038
4028
  /* Binds */
4039
4029
 
4040
- this.setXML2JSONURL = this.setXML2JSONURL.bind(this);
4041
4030
  this.setWMTileRendererTileSettings = this.setWMTileRendererTileSettings.bind(this);
4042
4031
  this.makeComponentId = this.makeComponentId.bind(this);
4043
4032
  this.setMessage = this.setMessage.bind(this);
@@ -4162,10 +4151,6 @@
4162
4151
  this.init();
4163
4152
  }
4164
4153
 
4165
- WMJSMap.prototype.setXML2JSONURL = function (_xml2jsonrequest) {
4166
- this.xml2jsonrequest = _xml2jsonrequest;
4167
- };
4168
-
4169
4154
  WMJSMap.prototype.setWMTileRendererTileSettings = function (_WMTileRendererTileSettings) {
4170
4155
  this.tileRenderSettings = _WMTileRendererTileSettings;
4171
4156
  };
@@ -4474,6 +4459,7 @@
4474
4459
 
4475
4460
  ctx.font = '10px Helvetica';
4476
4461
  ctx.textBaseline = 'middle';
4462
+ ctx.textAlign = 'left';
4477
4463
 
4478
4464
  if (isDefined(this.mouseGeoCoordXY)) {
4479
4465
  var roundingFactor = 1.0 / Math.pow(10, parseInt(Math.log((this.bbox.right - this.bbox.left) / this.width) / Math.log(10), 10) - 2);
@@ -4505,6 +4491,30 @@
4505
4491
 
4506
4492
  ctx.fillStyle = '#000000';
4507
4493
  ctx.fillText("Map projection: " + this.srs, 5, this.height - 26);
4494
+ /* Show layer metadata */
4495
+
4496
+ if (this.showLayerInfo === true) {
4497
+ var metadataX = 100;
4498
+ var metadataY = 100;
4499
+ var dimStartX = 150;
4500
+ var rowHeight = 26;
4501
+ var rowNumber = 0;
4502
+ drawTextBG(ctx, 'Layer name', metadataX, metadataY + rowNumber * rowHeight, 10);
4503
+ drawTextBG(ctx, 'Dimensions', metadataX + dimStartX, metadataY + rowNumber * rowHeight, 10);
4504
+ rowNumber += 1;
4505
+
4506
+ for (var j = 0; j < this.layers.length; j += 1) {
4507
+ var layer = this.layers[j];
4508
+ drawTextBG(ctx, "#" + j + ":" + layer.name, metadataX, metadataY + rowNumber * rowHeight, 10);
4509
+
4510
+ for (var d = 0; d < layer.dimensions.length; d += 1) {
4511
+ var dimension = layer.dimensions[d];
4512
+ drawTextBG(ctx, dimension.name + " = " + dimension.currentValue, metadataX + d * 200 + dimStartX, metadataY + rowNumber * rowHeight, 10);
4513
+ }
4514
+
4515
+ rowNumber += 1;
4516
+ }
4517
+ }
4508
4518
  };
4509
4519
  /* Is called when the WebMapJS object is created */
4510
4520
 
@@ -4912,10 +4922,10 @@
4912
4922
  reject(new Error('layer has no constructor'));
4913
4923
  return;
4914
4924
  }
4925
+ /* Set a reference in the layer to this map */
4915
4926
 
4916
- if (!layer.parentMaps.includes(_this)) {
4917
- layer.parentMaps.push(_this);
4918
- }
4927
+
4928
+ layer.parentMap = _this;
4919
4929
 
4920
4930
  _this.layers.push(layer);
4921
4931
 
@@ -4950,6 +4960,11 @@
4950
4960
  }
4951
4961
 
4952
4962
  if (!_srs) _srs = 'EPSG:4326';
4963
+
4964
+ if (this.srs !== _srs) {
4965
+ this.defaultBBOX.setBBOX(_bbox);
4966
+ }
4967
+
4953
4968
  this.srs = _srs;
4954
4969
 
4955
4970
  if (this.proj4.srs !== this.srs || !isDefined(this.proj4.projection)) {
@@ -4963,7 +4978,6 @@
4963
4978
  }
4964
4979
 
4965
4980
  this.setBBOX(_bbox);
4966
- this.defaultBBOX.setBBOX(_bbox);
4967
4981
  this.updateMouseCursorCoordinates(undefined);
4968
4982
  this.callBack.triggerEvent('onsetprojection', [this.srs, this.bbox]);
4969
4983
  };
@@ -5250,12 +5264,19 @@
5250
5264
  if (animationList !== undefined) {
5251
5265
  if (_typeof(animationList) === 'object') {
5252
5266
  if (animationList.length > 0) {
5267
+ // Ensure the time dimension has been loaded for the map before starting animation
5268
+ var timeDim = this.getDimension('time');
5269
+
5270
+ if (!timeDim) {
5271
+ return;
5272
+ }
5273
+
5274
+ var selectedTime = timeDim.currentValue;
5253
5275
  this.isAnimating = true;
5254
5276
  this.callBack.triggerEvent('onstartanimation', this);
5255
5277
  this.currentAnimationStep = 0;
5256
5278
  this.animationList = [];
5257
5279
  this.mouseHoverAnimationBox = false;
5258
- var selectedTime = this.getDimension('time').currentValue;
5259
5280
 
5260
5281
  for (var j = 0; j < animationList.length; j += 1) {
5261
5282
  if (selectedTime && animationList[j].value === selectedTime) {
@@ -5427,9 +5448,7 @@
5427
5448
  this.baseLayers = layer;
5428
5449
 
5429
5450
  for (var j = 0; j < this.baseLayers.length; j += 1) {
5430
- if (!this.baseLayers[j].parentMaps.includes(this)) {
5431
- this.baseLayers[j].parentMaps.push(this);
5432
- }
5451
+ this.baseLayers[j].parentMap = this;
5433
5452
 
5434
5453
  if (this.baseLayers[j].keepOnTop !== true) {
5435
5454
  this.numBaseLayers += 1;
@@ -7301,7 +7320,7 @@
7301
7320
  * Global getcapabilities function
7302
7321
  */
7303
7322
 
7304
- var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, xml2jsonrequestURL, options, disableCache) {
7323
+ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, options, disableCache) {
7305
7324
  if (disableCache === void 0) {
7306
7325
  disableCache = false;
7307
7326
  }
@@ -7349,7 +7368,6 @@
7349
7368
  random: Math.random()
7350
7369
  } : {};
7351
7370
  var url = getWMSUrl(service, addParams);
7352
- var newXml2jsonrequestURL = xml2jsonrequestURL;
7353
7371
  WMXMLParser(url, headers).then(function (data) {
7354
7372
  try {
7355
7373
  succes(data);
@@ -7359,7 +7377,7 @@
7359
7377
  })["catch"](function () {
7360
7378
  loadGetCapabilitiesViaProxy(url, succes, function () {
7361
7379
  fail("Request failed for " + url);
7362
- }, newXml2jsonrequestURL);
7380
+ }, WMServiceStoreXML2JSONRequest.proxy);
7363
7381
  });
7364
7382
  };
7365
7383
  var sortByKey = function sortByKey(array, key) {
@@ -7390,7 +7408,11 @@
7390
7408
  name: layers[j].Name.value,
7391
7409
  text: layers[j].Title.value,
7392
7410
  leaf: isleaf,
7393
- path: path
7411
+ path: path,
7412
+ keywords: toArray(layers[j].KeywordList && layers[j].KeywordList.Keyword).map(function (keywords) {
7413
+ return keywords.value;
7414
+ }),
7415
+ "abstract": layers[j].Abstract && layers[j].Abstract.value
7394
7416
  };
7395
7417
  } else {
7396
7418
  var nodeText = isNull(layers[j].Title) ? 'Layer' : layers[j].Title.value;
@@ -7416,7 +7438,6 @@
7416
7438
  *
7417
7439
  * options:
7418
7440
  * service
7419
- * xml2jsonrequestURL
7420
7441
  * title (optional)
7421
7442
  */
7422
7443
 
@@ -7437,7 +7458,6 @@
7437
7458
  if (options) {
7438
7459
  this.service = options.service;
7439
7460
  this.title = options.title;
7440
- this.xml2jsonrequestURL = options.xml2jsonrequestURL;
7441
7461
  }
7442
7462
 
7443
7463
  this.checkVersion111 = this.checkVersion111.bind(this);
@@ -7554,7 +7574,7 @@
7554
7574
  */
7555
7575
 
7556
7576
 
7557
- WMJSService.prototype.getCapabilities = function (succescallback, failcallback, forceReload, xml2jsonrequestURL, options) {
7577
+ WMJSService.prototype.getCapabilities = function (succescallback, failcallback, forceReload, options) {
7558
7578
  var _this = this;
7559
7579
 
7560
7580
  if (options) {
@@ -7639,7 +7659,7 @@
7639
7659
  return null;
7640
7660
  }, function () {
7641
7661
  return null;
7642
- }, false, xml2jsonrequestURL, options);
7662
+ }, false, options);
7643
7663
 
7644
7664
  var current;
7645
7665
 
@@ -7648,7 +7668,7 @@
7648
7668
  }
7649
7669
  };
7650
7670
 
7651
- WMJSGetCapabilities(this.service, succes, fail_1, xml2jsonrequestURL, options);
7671
+ WMJSGetCapabilities(this.service, succes, fail_1, options);
7652
7672
  } else {
7653
7673
  /* The callbacks are not allowed to be called in the scope of this object.
7654
7674
  By using window.setTimeOut they are externally called
@@ -7692,13 +7712,9 @@
7692
7712
  */
7693
7713
 
7694
7714
 
7695
- WMJSService.prototype.getNodes = function (succes, failure, forceReload, xml2jsonrequestURL, options) {
7715
+ WMJSService.prototype.getNodes = function (succes, failure, forceReload, options) {
7696
7716
  var _this = this;
7697
7717
 
7698
- if (xml2jsonrequestURL === void 0) {
7699
- xml2jsonrequestURL = this.xml2jsonrequestURL;
7700
- }
7701
-
7702
7718
  this.nodeCache = undefined;
7703
7719
 
7704
7720
  if (!failure) {
@@ -7713,7 +7729,9 @@
7713
7729
  leaf: false,
7714
7730
  expanded: true,
7715
7731
  children: [],
7716
- text: ''
7732
+ text: '',
7733
+ keywords: [],
7734
+ "abstract": ''
7717
7735
  };
7718
7736
 
7719
7737
  var rootLayer = _this.getCapabilityElement(jsonData).Layer;
@@ -7745,29 +7763,20 @@
7745
7763
  failure(data);
7746
7764
  };
7747
7765
 
7748
- this.getCapabilities(callback, fail, forceReload, xml2jsonrequestURL, options);
7766
+ this.getCapabilities(callback, fail, forceReload, options);
7749
7767
  };
7750
7768
  /** Calls succes with an array of all layerobjects
7751
7769
  * Calls failure when something goes wrong
7752
7770
  */
7753
7771
 
7754
7772
 
7755
- WMJSService.prototype.getLayerObjectsFlat = function (succes, failure, forceReload, xml2jsonrequestURL, options) {
7773
+ WMJSService.prototype.getLayerObjectsFlat = function (succes, failure, forceReload, options) {
7756
7774
  var _this = this;
7757
7775
 
7758
- if (xml2jsonrequestURL === void 0) {
7759
- xml2jsonrequestURL = this.xml2jsonrequestURL;
7760
- }
7761
-
7762
7776
  if (options === void 0) {
7763
7777
  options = this._options;
7764
7778
  }
7765
7779
 
7766
- if (!xml2jsonrequestURL) {
7767
- // eslint-disable-next-line no-param-reassign
7768
- xml2jsonrequestURL = this.xml2jsonrequestURL;
7769
- }
7770
-
7771
7780
  if (isDefined(this._flatLayerObject) && forceReload !== true) {
7772
7781
  succes(this._flatLayerObject);
7773
7782
  return;
@@ -7792,7 +7801,7 @@
7792
7801
  succes(_this._flatLayerObject);
7793
7802
  };
7794
7803
 
7795
- this.getNodes(callback, failure, forceReload, xml2jsonrequestURL, options);
7804
+ this.getNodes(callback, failure, forceReload, options);
7796
7805
  };
7797
7806
 
7798
7807
  return WMJSService;
@@ -7815,20 +7824,15 @@
7815
7824
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
7816
7825
  * */
7817
7826
 
7818
- var WMGetServiceFromStore = function WMGetServiceFromStore(serviceName, xml2jsonrequestURL) {
7827
+ var WMGetServiceFromStore = function WMGetServiceFromStore(serviceName) {
7819
7828
  for (var j = 0; j < WMServiceStore.length; j += 1) {
7820
7829
  if (WMServiceStore[j].service === serviceName) {
7821
7830
  return WMServiceStore[j];
7822
7831
  }
7823
7832
  }
7824
7833
 
7825
- if (xml2jsonrequestURL) {
7826
- WMServiceStoreXML2JSONRequest.proxy = xml2jsonrequestURL;
7827
- }
7828
-
7829
7834
  var service = new WMJSService({
7830
- service: serviceName,
7831
- xml2jsonrequestURL: WMServiceStoreXML2JSONRequest.proxy
7835
+ service: serviceName
7832
7836
  });
7833
7837
  WMServiceStore.push(service);
7834
7838
  return service;
@@ -7985,8 +7989,8 @@
7985
7989
  });
7986
7990
  /* Check if the dimension should take the value from the map */
7987
7991
 
7988
- if (layer.parentMaps.length > 0) {
7989
- var mapDim = layer.parentMaps[0].getDimension(layerDim.name);
7992
+ if (layer.parentMap) {
7993
+ var mapDim = layer.parentMap.getDimension(layerDim.name);
7990
7994
 
7991
7995
  if (mapDim && mapDim.linked && isDefined(mapDim.currentValue)) {
7992
7996
  var dimensionCurrentValue = dimension.getClosestValue(mapDim.currentValue);
@@ -8093,8 +8097,8 @@
8093
8097
  wmLayer.handleReferenceTime('reference_time', refTimeDimension.getValue());
8094
8098
  }
8095
8099
 
8096
- if (wmLayer.parentMaps && wmLayer.parentMaps.length > 0) {
8097
- wmLayer.parentMaps[0].configureMapDimensions(wmLayer);
8100
+ if (wmLayer.parentMap) {
8101
+ wmLayer.parentMap.configureMapDimensions(wmLayer);
8098
8102
  }
8099
8103
  };
8100
8104
 
@@ -8194,8 +8198,8 @@
8194
8198
  this.type = options.type;
8195
8199
  }
8196
8200
 
8197
- if (options.parentMaps) {
8198
- this.parentMaps = options.parentMaps;
8201
+ if (options.parentMap) {
8202
+ this.parentMap = options.parentMap;
8199
8203
  }
8200
8204
 
8201
8205
  if (options.headers) {
@@ -8209,8 +8213,6 @@
8209
8213
  this.timer = undefined;
8210
8214
  this.service = undefined; // URL of the WMS Service
8211
8215
 
8212
- this.WMJSService = undefined; // Corresponding WMJSService
8213
-
8214
8216
  this.getmapURL = undefined;
8215
8217
  this.getfeatureinfoURL = undefined;
8216
8218
  this.getlegendgraphicURL = undefined;
@@ -8241,9 +8243,8 @@
8241
8243
  this.id = '-1';
8242
8244
  this.opacity = 1.0; // Ranges from 0.0-1.0
8243
8245
 
8244
- this.getCapabilitiesDoc = undefined;
8245
8246
  this.serviceTitle = 'not defined';
8246
- this.parentMaps = [];
8247
+ this.parentMap = null;
8247
8248
  this.sldURL = null;
8248
8249
  this.isConfigured = false;
8249
8250
  };
@@ -8260,7 +8261,7 @@
8260
8261
  if (this.autoupdate) {
8261
8262
  var numDeltaMS = 60000;
8262
8263
  this.timer = setInterval(function () {
8263
- _this.parseLayer(undefined, true, undefined);
8264
+ _this.parseLayer(undefined, true);
8264
8265
  }, numDeltaMS);
8265
8266
  } else {
8266
8267
  clearInterval(this.timer);
@@ -8277,7 +8278,7 @@
8277
8278
  clearInterval(this.timer);
8278
8279
  } else {
8279
8280
  this.timer = setInterval(function () {
8280
- _this.parseLayer(callback, true, undefined);
8281
+ _this.parseLayer(callback, true);
8281
8282
  }, interval);
8282
8283
  }
8283
8284
  }
@@ -8285,10 +8286,7 @@
8285
8286
 
8286
8287
  WMLayer.prototype.setOpacity = function (opacityValue) {
8287
8288
  this.opacity = parseFloat(opacityValue);
8288
-
8289
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8290
- this.parentMaps[j].redrawBuffer();
8291
- }
8289
+ this.parentMap && this.parentMap.redrawBuffer();
8292
8290
  };
8293
8291
 
8294
8292
  WMLayer.prototype.getOpacity = function () {
@@ -8296,37 +8294,37 @@
8296
8294
  };
8297
8295
 
8298
8296
  WMLayer.prototype.remove = function () {
8299
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8300
- this.parentMaps[j].deleteLayer(this);
8301
- this.parentMaps[j].draw('WMLayer::remove');
8297
+ if (this.parentMap) {
8298
+ this.parentMap.deleteLayer(this);
8299
+ this.parentMap.draw('WMLayer::remove');
8302
8300
  }
8303
8301
 
8304
8302
  clearInterval(this.timer);
8305
8303
  };
8306
8304
 
8307
8305
  WMLayer.prototype.moveUp = function () {
8308
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8309
- this.parentMaps[j].moveLayerUp(this);
8310
- this.parentMaps[j].draw('WMLayer::moveUp');
8306
+ if (this.parentMap) {
8307
+ this.parentMap.moveLayerUp(this);
8308
+ this.parentMap.draw('WMLayer::moveUp');
8311
8309
  }
8312
8310
  };
8313
8311
 
8314
8312
  WMLayer.prototype.moveDown = function () {
8315
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8316
- this.parentMaps[j].moveLayerDown(this);
8317
- this.parentMaps[j].draw('WMLayer::moveDown');
8313
+ if (this.parentMap) {
8314
+ this.parentMap.moveLayerDown(this);
8315
+ this.parentMap.draw('WMLayer::moveDown');
8318
8316
  }
8319
8317
  };
8320
8318
 
8321
8319
  WMLayer.prototype.zoomToLayer = function () {
8322
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8323
- this.parentMaps[j].zoomToLayer(this);
8320
+ if (this.parentMap) {
8321
+ this.parentMap.zoomToLayer(this);
8324
8322
  }
8325
8323
  };
8326
8324
 
8327
8325
  WMLayer.prototype.draw = function (e) {
8328
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8329
- this.parentMaps[j].draw("WMLayer::draw::" + e);
8326
+ if (this.parentMap) {
8327
+ this.parentMap.draw("WMLayer::draw::" + e);
8330
8328
  }
8331
8329
  };
8332
8330
 
@@ -8343,9 +8341,9 @@
8343
8341
  timeDim.setTimeValuesForReferenceTime(value, referenceTimeDim);
8344
8342
 
8345
8343
  if (updateMapDimensions) {
8346
- if (this.parentMaps && this.parentMaps.length > 0) {
8344
+ if (this.parentMap) {
8347
8345
  if (this.enabled !== false) {
8348
- this.parentMaps[0].getListener().triggerEvent('ondimchange', 'time');
8346
+ this.parentMap.getListener().triggerEvent('ondimchange', 'time');
8349
8347
  }
8350
8348
  }
8351
8349
  }
@@ -8373,42 +8371,40 @@
8373
8371
 
8374
8372
  if (updateMapDimensions) {
8375
8373
  if (dim.linked === true) {
8376
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8377
- this.parentMaps[j].setDimension(name, dim.getValue());
8374
+ if (this.parentMap) {
8375
+ this.parentMap.setDimension(name, dim.getValue());
8378
8376
  }
8379
8377
  }
8380
8378
  }
8381
8379
  };
8382
8380
 
8383
- WMLayer.prototype.__parseGetCapForLayer = function (layer, getcapabilitiesjson, layerDoneCallback, fail) {
8381
+ WMLayer.prototype.__parseGetCapForLayer = function (getcapabilitiesjson, layerDoneCallback, fail) {
8384
8382
  var _this = this;
8385
8383
 
8386
- var jsondata = getcapabilitiesjson;
8387
-
8388
- if (!jsondata) {
8384
+ if (!getcapabilitiesjson) {
8389
8385
  this.title = I18n.service_has_error.text;
8390
8386
  this["abstract"] = I18n.not_available_message.text;
8391
- fail(layer, I18n.unable_to_connect_server.text);
8387
+ fail(this, I18n.unable_to_connect_server.text);
8392
8388
  return;
8393
8389
  }
8394
8390
 
8395
- var j = 0; // Get the capability object
8391
+ var wmjsService = WMGetServiceFromStore(this.service); // Get the capability object
8396
8392
 
8397
8393
  var capabilityObject;
8398
8394
 
8399
8395
  try {
8400
- capabilityObject = layer.WMJSService.getCapabilityElement(getcapabilitiesjson);
8396
+ capabilityObject = wmjsService.getCapabilityElement(getcapabilitiesjson);
8401
8397
  } catch (_a) {
8402
- fail(layer, 'No capability element in service');
8398
+ fail(this, 'No capability element in service');
8403
8399
  return;
8404
8400
  }
8405
8401
 
8406
- this.version = layer.WMJSService.version; // Get the rootLayer
8402
+ this.version = wmjsService.version; // Get the rootLayer
8407
8403
 
8408
8404
  var rootLayer = capabilityObject.Layer;
8409
8405
 
8410
8406
  if (!isDefined(rootLayer)) {
8411
- fail(layer, 'No Layer element in service');
8407
+ fail(this, 'No Layer element in service');
8412
8408
  return;
8413
8409
  }
8414
8410
 
@@ -8480,10 +8476,9 @@
8480
8476
  } // TODO Should be arranged also for the other services:
8481
8477
 
8482
8478
 
8483
- _this.getmapURL = WMJScheckURL(layer.getmapURL);
8484
- _this.getfeatureinfoURL = WMJScheckURL(layer.getfeatureinfoURL);
8485
- _this.getlegendgraphicURL = WMJScheckURL(layer.getlegendgraphicURL);
8486
- _this.getCapabilitiesDoc = jsondata;
8479
+ _this.getmapURL = WMJScheckURL(_this.getmapURL);
8480
+ _this.getfeatureinfoURL = WMJScheckURL(_this.getfeatureinfoURL);
8481
+ _this.getlegendgraphicURL = WMJScheckURL(_this.getlegendgraphicURL);
8487
8482
  _this.title = jsonlayer.Title.value;
8488
8483
 
8489
8484
  try {
@@ -8514,7 +8509,7 @@
8514
8509
  // Fill in SRS and BBOX on basis of BoundingBox attribute
8515
8510
  var gpbbox = toArray(data.BoundingBox);
8516
8511
 
8517
- for (j = 0; j < gpbbox.length; j += 1) {
8512
+ for (var j = 0; j < gpbbox.length; j += 1) {
8518
8513
  var srs = void 0;
8519
8514
  srs = gpbbox[j].attr.SRS;
8520
8515
 
@@ -8542,8 +8537,8 @@
8542
8537
  geoProperty.srs = srs;
8543
8538
  var swapBBOX = false;
8544
8539
 
8545
- if (layer.version === WMSVersion.version130) {
8546
- if (geoProperty.srs === 'EPSG:4326' && layer.wms130bboxcompatibilitymode === false) {
8540
+ if (_this.version === WMSVersion.version130) {
8541
+ if (geoProperty.srs === 'EPSG:4326' && _this.wms130bboxcompatibilitymode === false) {
8547
8542
  swapBBOX = true;
8548
8543
  }
8549
8544
  }
@@ -8571,7 +8566,7 @@
8571
8566
  getgpbbox(jsonlayer);
8572
8567
  getgpbbox(rootLayer); // Fill in SRS on basis of SRS attribute
8573
8568
 
8574
- for (j = 0; j < gp.length; j += 1) {
8569
+ for (var j = 0; j < gp.length; j += 1) {
8575
8570
  if (tempSRS.indexOf(gp[j].value) === -1) {
8576
8571
  var geoProperty = new WMProjection();
8577
8572
  debug(exports.DebugType.Error, "Warning: BoundingBOX missing for SRS " + gp[j].value);
@@ -8580,7 +8575,8 @@
8580
8575
  geoProperty.bbox.right = 180;
8581
8576
  geoProperty.bbox.top = 90;
8582
8577
  geoProperty.srs = gp[j].value;
8583
- layer.projectionProperties.push(geoProperty);
8578
+
8579
+ _this.projectionProperties.push(geoProperty);
8584
8580
  }
8585
8581
  }
8586
8582
 
@@ -8592,13 +8588,13 @@
8592
8588
  try {
8593
8589
  if (parseInt(jsonlayer.attr.queryable, 10) === 1) _this.queryable = true;else _this.queryable = false;
8594
8590
  } catch (e) {
8595
- debug(exports.DebugType.Error, "Unable to detect whether this layer is queryable (for layer " + layer.title + ")");
8591
+ debug(exports.DebugType.Error, "Unable to detect whether this layer is queryable (for layer " + _this.title + ")");
8596
8592
  }
8597
8593
 
8598
8594
  foundLayer = 1;
8599
8595
  };
8600
8596
 
8601
- function recursivelyFindLayer(JSONLayers, path, _prevNestedLayerPath) {
8597
+ function recursivelyFindLayer(thisLayer, JSONLayers, path, _prevNestedLayerPath) {
8602
8598
  for (var k = 0; k < JSONLayers.length; k += 1) {
8603
8599
  var nestedLayerPath_1 = [];
8604
8600
 
@@ -8617,9 +8613,9 @@
8617
8613
  /* Do nothing */
8618
8614
  }
8619
8615
 
8620
- recursivelyFindLayer(toArray(JSONLayers[k].Layer), pathnew, nestedLayerPath_1);
8616
+ recursivelyFindLayer(thisLayer, toArray(JSONLayers[k].Layer), pathnew, nestedLayerPath_1);
8621
8617
  } else if (JSONLayers[k].Name) {
8622
- if (JSONLayers[k].Name.value === layer.name) {
8618
+ if (JSONLayers[k].Name.value === thisLayer.name) {
8623
8619
  foundLayerFunction(JSONLayers[k], path, nestedLayerPath_1);
8624
8620
  return;
8625
8621
  }
@@ -8631,13 +8627,13 @@
8631
8627
  var JSONLayers = toArray(rootLayer.Layer);
8632
8628
  var path = '';
8633
8629
  var nestedLayerPath = [rootLayer];
8634
- recursivelyFindLayer(JSONLayers, path, nestedLayerPath);
8630
+ recursivelyFindLayer(this, JSONLayers, path, nestedLayerPath);
8635
8631
 
8636
8632
  if (foundLayer === 0) {
8637
8633
  // Layer was not found...
8638
8634
  var message = '';
8639
8635
 
8640
- if (layer.name) {
8636
+ if (this.name) {
8641
8637
  message = "Unable to find layer '" + this.name + "' in service '" + this.service + "'";
8642
8638
  } else {
8643
8639
  message = "Unable to find layer '" + this.title + "' in service '" + this.service + "'";
@@ -8665,7 +8661,7 @@
8665
8661
  */
8666
8662
 
8667
8663
 
8668
- WMLayer.prototype.parseLayer = function (_layerDoneCallback, forceReload, xml2jsonrequest) {
8664
+ WMLayer.prototype.parseLayer = function (_layerDoneCallback, forceReload) {
8669
8665
  var _this = this;
8670
8666
 
8671
8667
  this.hasError = false;
@@ -8692,20 +8688,14 @@
8692
8688
  };
8693
8689
 
8694
8690
  var callback = function callback(data) {
8695
- _this.__parseGetCapForLayer(_this, data, layerDoneCallback, fail);
8691
+ _this.__parseGetCapForLayer(data, layerDoneCallback, fail);
8696
8692
  };
8697
8693
 
8698
8694
  var requestfail = function requestfail() {
8699
8695
  fail(_this, I18n.no_capability_element_found.text);
8700
8696
  };
8701
8697
 
8702
- var newXml2jsonrequest = xml2jsonrequest;
8703
-
8704
- if (!xml2jsonrequest) {
8705
- newXml2jsonrequest = this.parentMaps && this.parentMaps.length > 0 ? this.parentMaps[0].xml2jsonrequest : undefined;
8706
- }
8707
-
8708
- this.WMJSService = WMGetServiceFromStore(this.service, newXml2jsonrequest);
8698
+ var wmjsService = WMGetServiceFromStore(this.service);
8709
8699
  var options = {
8710
8700
  headers: {}
8711
8701
  };
@@ -8714,10 +8704,10 @@
8714
8704
  options.headers = this.headers;
8715
8705
  }
8716
8706
 
8717
- if (this.WMJSService.service !== undefined) {
8718
- this.WMJSService.getCapabilities(function (data) {
8707
+ if (wmjsService.service !== undefined) {
8708
+ wmjsService.getCapabilities(function (data) {
8719
8709
  callback(data);
8720
- }, requestfail, forceReload, xml2jsonrequest, options);
8710
+ }, requestfail, forceReload, options);
8721
8711
  }
8722
8712
  };
8723
8713
  /**
@@ -8792,7 +8782,8 @@
8792
8782
  success(layerObjects[currentLayerIndex], currentLayerIndex, layerObjects.length);
8793
8783
  };
8794
8784
 
8795
- this.WMJSService.getLayerObjectsFlat(getLayerObjectsFinished, failure, undefined);
8785
+ var wmjsService = WMGetServiceFromStore(this.service);
8786
+ wmjsService.getLayerObjectsFlat(getLayerObjectsFinished, failure, undefined);
8796
8787
  };
8797
8788
 
8798
8789
  WMLayer.prototype.autoSelectLayer = function (success, failure) {
@@ -8809,7 +8800,8 @@
8809
8800
  }
8810
8801
  };
8811
8802
 
8812
- this.WMJSService.getLayerObjectsFlat(getLayerObjectsFinished, failure, undefined);
8803
+ var wmjsService = WMGetServiceFromStore(this.service);
8804
+ wmjsService.getLayerObjectsFlat(getLayerObjectsFinished, failure, undefined);
8813
8805
  };
8814
8806
 
8815
8807
  WMLayer.prototype.getNextLayer = function (success, failure) {
@@ -8973,8 +8965,8 @@
8973
8965
  WMLayer.prototype.display = function (displayornot) {
8974
8966
  this.enabled = displayornot;
8975
8967
 
8976
- for (var j = 0; j < this.parentMaps.length; j += 1) {
8977
- this.parentMaps[j].displayLayer(this, this.enabled);
8968
+ if (this.parentMap) {
8969
+ this.parentMap.displayLayer(this, this.enabled);
8978
8970
  }
8979
8971
  };
8980
8972