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

iTowns / itowns / 25423267947

06 May 2026 07:55AM UTC coverage: 88.395% (+0.1%) from 88.28%
25423267947

Pull #2763

github

web-flow
Merge fc01f8270 into bcd9ce15f
Pull Request #2763: fix(examples): fix duplicating panel bug, sessionStorage bugs and responsive design

2833 of 3654 branches covered (77.53%)

Branch coverage included in aggregate %.

28853 of 32192 relevant lines covered (89.63%)

949.01 hits per line

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

75.18
/packages/Main/src/Process/FeatureProcessing.js
1
import LayerUpdateState from 'Layer/LayerUpdateState';
1✔
2
import ObjectRemovalHelper from 'Process/ObjectRemovalHelper';
1✔
3
import handlingError from 'Process/handlerNodeError';
1✔
4
import { Coordinates } from '@itowns/geographic';
1✔
5
import { geoidLayerIsVisible } from 'Layer/GeoidLayer';
1✔
6
import { applyStyle } from 'Converter/Feature2Mesh';
1✔
7

1✔
8
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
1✔
9

1✔
10
export default {
1✔
11
    update(context, layer, node) {
1✔
12
        if (!node.parent && node.children.length) {
11!
13
            // if node has been removed dispose three.js resource
×
14
            ObjectRemovalHelper.removeChildrenAndCleanupRecursively(layer, node);
×
15
            return;
×
16
        }
×
17
        if (!node.visible) {
11!
18
            return;
×
19
        }
×
20

11✔
21
        if (node.layerUpdateState[layer.id] === undefined) {
11✔
22
            node.layerUpdateState[layer.id] = new LayerUpdateState();
10✔
23
        } else if (!node.layerUpdateState[layer.id].canTryUpdate()) {
11✔
24
            // toggle visibility features
1✔
25
            node.link[layer.id]?.forEach((f) => {
1✔
26
                f.layer.object3d.add(f);
1✔
27
                f.meshes.position.z = geoidLayerIsVisible(layer.parent) ? node.geoidHeight : 0;
1!
28
                f.meshes.updateMatrixWorld();
1✔
29
                const updateColor = f.styleColorVersion !== (layer._styleColorVersion ?? 0);
1!
30
                const updatePosition = f.stylePositionVersion !== (layer._stylePositionVersion ?? 0);
1!
31
                if (updateColor || updatePosition) {
1!
32
                    const buffersToUpdate = [];
1✔
33
                    if (updateColor) { buffersToUpdate.push('color'); }
1✔
34
                    if (updatePosition) { buffersToUpdate.push('position'); }
1✔
35
                    for (const mesh of f.meshes.children) {
1✔
36
                        applyStyle(
1✔
37
                            mesh,
1✔
38
                            f.collection,
1✔
39
                            layer.style,
1✔
40
                            buffersToUpdate,
1✔
41
                        );
1✔
42
                    }
1✔
43
                    f.styleColorVersion = layer._styleColorVersion ?? 0;
1!
44
                    f.stylePositionVersion = layer._stylePositionVersion ?? 0;
1!
45
                }
1✔
46
            });
1✔
47
            return;
1✔
48
        }
1✔
49

10✔
50
        let extentsDestination = node.getExtentsByProjection(layer.source.crs);
10✔
51
        let zoomDest;
10✔
52
        if (!extentsDestination) {
11!
53
            extentsDestination = [node.extent]; // of type Extent
×
54
            zoomDest = node.level;
×
55
        } else {
11✔
56
            zoomDest = extentsDestination[0].zoom;
10✔
57
        }
10✔
58

10✔
59
        // check if it's tile level is equal to display level layer.
10✔
60
        // TO DO updata at all level asked
10✔
61
        // if ((zoomDest < layer.zoom.min && zoomDest > layer.zoom.max) ||
10✔
62
        if (zoomDest != layer.zoom.min ||
10✔
63
        // check if there's data in extent tile.
10✔
64
            !this.source.extentInsideLimit(node.extent, zoomDest) ||
11✔
65
        // In FileSource case, check if the feature center is in extent tile.
10✔
66
            (layer.source.isFileSource && !node.extent.isPointInside(layer.source.extent.center(coord)))) {
11!
67
        // if not, there's not data to add at this tile.
×
68
            node.layerUpdateState[layer.id].noMoreUpdatePossible();
×
69
            return;
×
70
        }
✔
71

10✔
72
        node.layerUpdateState[layer.id].newTry();
10✔
73

10✔
74
        const command = {
10✔
75
            layer,
10✔
76
            extentsSource: extentsDestination,
10✔
77
            view: context.view,
10✔
78
            requester: node,
10✔
79
        };
10✔
80

10✔
81
        return context.scheduler.execute(command).then((featureMeshes) => {
10✔
82
            node.layerUpdateState[layer.id].noMoreUpdatePossible();
8✔
83

8✔
84
            featureMeshes.forEach((featureMesh) => {
8✔
85
                if (featureMesh) {
8✔
86
                    node.link[layer.id] = node.link[layer.id] || [];
8✔
87
                    featureMesh.as(context.view.referenceCrs);
8✔
88
                    featureMesh.meshes.position.z = geoidLayerIsVisible(layer.parent) ? node.geoidHeight : 0;
8!
89
                    featureMesh.updateMatrixWorld();
8✔
90

8✔
91
                    if (layer.onMeshCreated) {
8!
92
                        layer.onMeshCreated(featureMesh, context);
×
93
                    }
×
94

8✔
95
                    if (!node.parent) {
8!
96
                        // TODO: Clean cache needs a refactory, because it isn't really efficient and used
×
97
                        ObjectRemovalHelper.removeChildrenAndCleanupRecursively(layer, featureMesh);
×
98
                    } else {
8✔
99
                        layer.object3d.add(featureMesh);
8✔
100
                        node.link[layer.id].push(featureMesh);
8✔
101
                    }
8✔
102
                    featureMesh.layer = layer;
8✔
103
                } else {
8!
104
                    // TODO: verify if it's possible the featureMesh is undefined.
×
105
                    node.layerUpdateState[layer.id].failure(1, true);
×
106
                }
×
107
            });
8✔
108
        },
10✔
109
        err => handlingError(err, node, layer, node.level, context.view));
10✔
110
    },
10✔
111
};
1✔
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