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

geosolutions-it / MapStore2 / 19935919825

04 Dec 2025 04:19PM UTC coverage: 76.703% (+0.04%) from 76.661%
19935919825

Pull #11648

github

web-flow
Merge f9ef0e5ca into a0da62e93
Pull Request #11648: #11644: Implement dynamic request configurations

32405 of 50408 branches covered (64.29%)

220 of 244 new or added lines in 42 files covered. (90.16%)

3 existing lines in 3 files now uncovered.

40299 of 52539 relevant lines covered (76.7%)

40.18 hits per line

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

6.25
/web/client/components/map/openlayers/plugins/COGLayer.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

9
import Layers from '../../../../utils/openlayers/Layers';
10
import isEqual from 'lodash/isEqual';
11
import get from 'lodash/get';
12

13
import GeoTIFF from 'ol/source/GeoTIFF.js';
14
import TileLayer from 'ol/layer/WebGLTile.js';
15
import { isProjectionAvailable } from '../../../../utils/ProjectionUtils';
16
import { getRequestConfigurationByUrl } from '../../../../utils/SecurityUtils';
17

18
function create(options) {
NEW
19
    let sourceOptions = {};
×
NEW
20
    if (options.security && options.sources && options.sources.length > 0) {
×
NEW
21
        const firstSource = options.sources[0];
×
NEW
22
        const requestConfig = getRequestConfigurationByUrl(firstSource.url, null, options.security?.sourceId);
×
NEW
23
        if (requestConfig.headers) {
×
NEW
24
            sourceOptions.headers = requestConfig.headers;
×
25
        }
26
    }
27
    return new TileLayer({
×
28
        msId: options.id,
29
        style: get(options, 'style.body'),
30
        opacity: options.opacity !== undefined ? options.opacity : 1,
×
31
        visible: options.visibility,
32
        source: new GeoTIFF({
33
            convertToRGB: 'auto', // CMYK, YCbCr, CIELab, and ICCLab images will automatically be converted to RGB
34
            sources: options.sources,
35
            wrapX: true,
36
            sourceOptions
37
        }),
38
        zIndex: options.zIndex,
39
        minResolution: options.minResolution,
40
        maxResolution: options.maxResolution
41
    });
42
}
43

44
Layers.registerType('cog', {
1✔
45
    create,
46
    update(layer, newOptions, oldOptions, map) {
47
        if (newOptions.srs !== oldOptions.srs
×
48
            || !isEqual(newOptions.style, oldOptions.style)
49
            || !isEqual(newOptions.security, oldOptions.security)
50
            || !isEqual(newOptions.sources, oldOptions.sources) // min/max source data value can change
51
            || !isEqual(oldOptions.requestRuleRefreshHash, newOptions.requestRuleRefreshHash)
52
        ) {
53
            return create(newOptions, map);
×
54
        }
55
        if (oldOptions.minResolution !== newOptions.minResolution) {
×
56
            layer.setMinResolution(newOptions.minResolution === undefined ? 0 : newOptions.minResolution);
×
57
        }
58
        if (oldOptions.maxResolution !== newOptions.maxResolution) {
×
59
            layer.setMaxResolution(newOptions.maxResolution === undefined ? Infinity : newOptions.maxResolution);
×
60
        }
61
        return null;
×
62
    },
63
    isCompatible: (layer) => {
64
        return isProjectionAvailable(layer?.sourceMetadata?.crs);
×
65
    }
66
});
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