Skip to content

Commit 9338fc1

Browse files
feat (olHelpers.js): add wrapX support for sources that support it
1 parent 0beb753 commit 9338fc1

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

src/services/olHelpers.js

+32-16
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
212212
oSource = new ol.source.XYZ({
213213
url: url,
214214
attributions: createAttribution(source),
215-
tilePixelRatio: pixelRatio > 1 ? 2 : 1
215+
tilePixelRatio: pixelRatio > 1 ? 2 : 1,
216+
wrapX: source.wrapX || true
216217
});
217218
break;
218219
case 'MapBoxStudio':
@@ -228,7 +229,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
228229
oSource = new ol.source.XYZ({
229230
url: url,
230231
attributions: createAttribution(source),
231-
tileSize: source.tileSize || [512, 512]
232+
tileSize: source.tileSize || [512, 512],
233+
wrapX: source.wrapX || true
232234
});
233235
break;
234236
case 'ImageWMS':
@@ -254,7 +256,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
254256
var wmsConfiguration = {
255257
crossOrigin: (typeof source.crossOrigin === 'undefined') ? 'anonymous' : source.crossOrigin,
256258
params: deepCopy(source.params),
257-
attributions: createAttribution(source)
259+
attributions: createAttribution(source),
260+
wrapX: source.wrapX || true
258261
};
259262

260263
if (source.serverType) {
@@ -291,7 +294,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
291294
resolutions: source.tileGrid.resolutions,
292295
matrixIds: source.tileGrid.matrixIds
293296
}),
294-
style: (source.style === 'undefined') ? 'normal' : source.style
297+
style: (source.style === 'undefined') ? 'normal' : source.style,
298+
wrapX: source.wrapX || true
295299
};
296300

297301
if (isDefined(source.url)) {
@@ -307,7 +311,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
307311

308312
case 'OSM':
309313
oSource = new ol.source.OSM({
310-
attributions: createAttribution(source)
314+
attributions: createAttribution(source),
315+
wrapX: source.wrapX || true
311316
});
312317

313318
if (source.url) {
@@ -325,7 +330,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
325330
key: source.key,
326331
attributions: createAttribution(source),
327332
imagerySet: source.imagerySet ? source.imagerySet : bingImagerySets[0],
328-
culture: source.culture
333+
culture: source.culture,
334+
wrapX: source.wrapX || true
329335
};
330336

331337
if (source.maxZoom) {
@@ -343,7 +349,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
343349

344350
oSource = new ol.source.MapQuest({
345351
attributions: createAttribution(source),
346-
layer: source.layer
352+
layer: source.layer,
353+
wrapX: source.wrapX || true
347354
});
348355

349356
break;
@@ -359,7 +366,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
359366

360367
oSource = new ol.source.XYZ({
361368
attributions: createAttribution(source),
362-
url: _url
369+
url: _url,
370+
wrapX: source.wrapX || true
363371
});
364372

365373
break;
@@ -371,7 +379,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
371379

372380
oSource = new ol.source.TileArcGISRest({
373381
attributions: createAttribution(source),
374-
url: source.url
382+
url: source.url,
383+
wrapX: source.wrapX || true
375384
});
376385

377386
break;
@@ -481,7 +490,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
481490
oSource = new ol.source.TileJSON({
482491
url: source.url,
483492
attributions: createAttribution(source),
484-
crossOrigin: 'anonymous'
493+
crossOrigin: 'anonymous',
494+
wrapX: source.wrapX || true
485495
});
486496
break;
487497

@@ -496,7 +506,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
496506
format: source.format,
497507
tileGrid: new ol.tilegrid.createXYZ({
498508
maxZoom: source.maxZoom || 19
499-
})
509+
}),
510+
wrapX: source.wrapX || true
500511
});
501512
break;
502513

@@ -525,7 +536,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
525536
var url = source.url + z + '/' + x + '/' + y + '.png';
526537

527538
return url;
528-
}
539+
},
540+
wrapX: source.wrapX || true
529541
});
530542
break;
531543
case 'TileImage':
@@ -545,7 +557,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
545557
.replace('{x}', x.toString())
546558
.replace('{y}', y.toString());
547559
return url;
548-
}
560+
},
561+
wrapX: source.wrapX || true
549562
});
550563
break;
551564
case 'KML':
@@ -563,7 +576,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
563576
return;
564577
}
565578
oSource = new ol.source.Stamen({
566-
layer: source.layer
579+
layer: source.layer,
580+
wrapX: source.wrapX || true
567581
});
568582
break;
569583
case 'ImageStatic':
@@ -591,7 +605,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
591605
minZoom: source.minZoom,
592606
maxZoom: source.maxZoom,
593607
projection: source.projection,
594-
tileUrlFunction: source.tileUrlFunction
608+
tileUrlFunction: source.tileUrlFunction,
609+
wrapX: source.wrapX || true
595610
});
596611
break;
597612
case 'Zoomify':
@@ -600,7 +615,8 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
600615
}
601616
oSource = new ol.source.Zoomify({
602617
url: source.url,
603-
size: source.imageSize
618+
size: source.imageSize,
619+
wrapX: source.wrapX || true
604620
});
605621
break;
606622
}

0 commit comments

Comments
 (0)