• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 14534587011

18 Apr 2025 11:41AM UTC coverage: 76.977% (-0.02%) from 76.993%
14534587011

Pull #11037

github

web-flow
Merge f22d700f6 into 48d6a1a15
Pull Request #11037: Remove object assign pollyfills

30792 of 47937 branches covered (64.23%)

446 of 556 new or added lines in 94 files covered. (80.22%)

8 existing lines in 4 files now uncovered.

38277 of 49725 relevant lines covered (76.98%)

36.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

6.67
/web/client/components/map/openlayers/plugins/TileProviderLayer.js
1
/**
2
 * Copyright 2015, GeoSolutions Sas.
3
 * All rights reserved.
4
 *
5
 * This source code is licensed under the BSD-style license found in the
6
 * LICENSE file in the root directory of this source tree.
7
 */
8
import Layers from '../../../../utils/openlayers/Layers';
9
import TileProvider from '../../../../utils/TileConfigProvider';
10
import CoordinatesUtils from '../../../../utils/CoordinatesUtils';
11
import { getUrls, template } from '../../../../utils/TileProviderUtils';
12
import XYZ from 'ol/source/XYZ';
13
import TileLayer from 'ol/layer/Tile';
14

15
function lBoundsToOlExtent(bounds, destPrj) {
16
    var [ [ miny, minx], [ maxy, maxx ] ] = bounds;
×
17
    return CoordinatesUtils.reprojectBbox([minx, miny, maxx, maxy], 'EPSG:4326', CoordinatesUtils.normalizeSRS(destPrj));
×
18
}
19
function tileXYZToOpenlayersOptions(options) {
20
    let urls = options.url.match(/(\{s\})/) ? getUrls(options) : [template(options.url, options)];
×
NEW
21
    let sourceOpt = Object.assign({}, {
×
22
        urls: urls,
23
        attributions: options.attribution ? [options.attribution] : [],
×
24
        maxZoom: options.maxZoom ? options.maxZoom : 18,
×
25
        minZoom: options.minZoom ? options.minZoom : 0 // dosen't affect ol layer rendering UNSUPPORTED
×
26
    });
27
    let source = new XYZ(sourceOpt);
×
NEW
28
    let olOpt = Object.assign({}, {
×
29
        msId: options.id,
30
        opacity: options.opacity !== undefined ? options.opacity : 1,
×
31
        visible: options.visibility !== false,
32
        zIndex: options.zIndex,
33
        source: source,
34
        minResolution: options.minResolution,
35
        maxResolution: options.maxResolution
36
    }, options.bounds ? {extent: lBoundsToOlExtent(options.bounds, options.srs ? options.srs : 'EPSG:3857')} : {} );
×
37
    return olOpt;
×
38
}
39

40
Layers.registerType('tileprovider', {
1✔
41
    create: (options) => {
42
        let [url, opt] = TileProvider.getLayerConfig(options.provider, options);
×
43
        opt.url = url;
×
44
        return new TileLayer(tileXYZToOpenlayersOptions(opt));
×
45
    },
46
    update: (layer, newOptions, oldOptions) => {
47
        if (oldOptions.minResolution !== newOptions.minResolution) {
×
48
            layer.setMinResolution(newOptions.minResolution === undefined ? 0 : newOptions.minResolution);
×
49
        }
50
        if (oldOptions.maxResolution !== newOptions.maxResolution) {
×
51
            layer.setMaxResolution(newOptions.maxResolution === undefined ? Infinity : newOptions.maxResolution);
×
52
        }
53
    }
54
});
55

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc