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

iTowns / itowns / 25443227005

06 May 2026 02:58PM UTC coverage: 88.308% (+0.03%) from 88.28%
25443227005

Pull #2691

github

web-flow
Merge eb51204ec into 29cddd232
Pull Request #2691: Shadows

2839 of 3663 branches covered (77.5%)

Branch coverage included in aggregate %.

184 of 255 new or added lines in 10 files covered. (72.16%)

183 existing lines in 7 files now uncovered.

28980 of 32369 relevant lines covered (89.53%)

1888.84 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';
2✔
2
import ObjectRemovalHelper from 'Process/ObjectRemovalHelper';
2✔
3
import handlingError from 'Process/handlerNodeError';
2✔
4
import { Coordinates } from '@itowns/geographic';
2✔
5
import { geoidLayerIsVisible } from 'Layer/GeoidLayer';
2✔
6
import { applyStyle } from 'Converter/Feature2Mesh';
2✔
7

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

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

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

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

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

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

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

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

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

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

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