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

geosolutions-it / MapStore2 / 19710972030

26 Nov 2025 03:38PM UTC coverage: 76.665% (-0.3%) from 76.929%
19710972030

Pull #11119

github

web-flow
Fix maven publish (#11739)
Pull Request #11119: Layer Selection Plugin on ArcGIS, WFS & WMS layers

32272 of 50209 branches covered (64.28%)

3 of 3 new or added lines in 2 files covered. (100.0%)

3018 existing lines in 249 files now uncovered.

40157 of 52380 relevant lines covered (76.66%)

37.9 hits per line

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

88.0
/web/client/components/map/cesium/plugins/ArcGISLayer.js
1
/*
2
 * Copyright 2024, 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/cesium/Layers';
10
import * as Cesium from 'cesium';
11
import { isImageServerUrl } from '../../../../utils/ArcGISUtils';
12
import { getProxiedUrl } from '../../../../utils/ConfigUtils';
13

14

15
// this override is needed to apply the selected format
16
// and to detect an ImageServer and to apply the correct exportImage path
17
function buildImageResource(imageryProvider, x, y, level, request) {
18
    const nativeRectangle = imageryProvider._tilingScheme.tileXYToNativeRectangle(
2✔
19
        x,
20
        y,
21
        level
22
    );
23
    const bbox = `${nativeRectangle.west},${nativeRectangle.south},${nativeRectangle.east},${nativeRectangle.north}`;
2✔
24

25
    const query = {
2✔
26
        bbox: bbox,
27
        size: `${imageryProvider._tileWidth},${imageryProvider._tileHeight}`,
28
        format: imageryProvider._format || 'png32',
4✔
29
        transparent: true,
30
        f: 'image'
31
    };
32

33
    if (
2!
34
        imageryProvider._tilingScheme.projection instanceof Cesium.GeographicProjection
35
    ) {
36
        query.bboxSR = 4326;
2✔
37
        query.imageSR = 4326;
2✔
38
    } else {
39
        query.bboxSR = 3857;
×
UNCOV
40
        query.imageSR = 3857;
×
41
    }
42
    if (imageryProvider.layers) {
2!
43
        query.layers = `show:${imageryProvider.layers}`;
2✔
44
    }
45
    const resource = imageryProvider._resource.getDerivedResource({
2✔
46
        url: isImageServerUrl(imageryProvider._resource.url) ? 'exportImage' : 'export',
2!
47
        request: request,
48
        queryParameters: query
49
    });
50
    return resource;
2✔
51
}
52

53
class ArcGisMapAndImageServerImageryProvider extends Cesium.ArcGisMapServerImageryProvider {
54
    constructor(options) {
55
        super(options);
2✔
56
        this._format = options.format;
2✔
57
        this._resource = new Cesium.Resource({
2✔
58
            url: options.url
59
        });
60
        this._resource.appendForwardSlash();
2✔
61
    }
62
    requestImage = function(
2✔
63
        x,
64
        y,
65
        level,
66
        request
67
    ) {
68
        return Cesium.ImageryProvider.loadImage(
2✔
69
            this,
70
            buildImageResource(this, x, y, level, request)
71
        );
72
    }
73
}
74

75
const create = (options) => {
1✔
76
    return new ArcGisMapAndImageServerImageryProvider({
2✔
77
        url: options?.forceProxy ? getProxiedUrl() + encodeURIComponent(options.url) : options.url,
2!
78
        ...(options.name !== undefined && { layers: `${options.name}` }),
4✔
79
        format: options.format,
80
        // we need to disable this when using layers ids
81
        // the usage of tiles will add an additional request to metadata
82
        // and render the map tiles representing all the layers available in the MapServer
83
        usePreCachedTilesIfAvailable: false
84
    });
85
};
86

87
const update = (layer, newOptions, oldOptions) => {
1✔
88
    if (newOptions.forceProxy !== oldOptions.forceProxy) {
1!
89
        return create(newOptions);
1✔
90
    }
UNCOV
91
    return null;
×
92
};
93

94
Layers.registerType('arcgis', {
1✔
95
    create,
96
    update: update
97
});
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

© 2025 Coveralls, Inc