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

iTowns / itowns / 15994794586

01 Jul 2025 09:02AM UTC coverage: 87.031%. First build
15994794586

Pull #2557

github

web-flow
Merge ddf98ecce into 651c88ad2
Pull Request #2557: Migrate TileMesh-related modules to typescript

2783 of 3726 branches covered (74.69%)

Branch coverage included in aggregate %.

426 of 433 new or added lines in 15 files covered. (98.38%)

26086 of 29445 relevant lines covered (88.59%)

1099.1 hits per line

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

65.42
/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

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

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

10✔
20
        if (node.layerUpdateState[layer.id] === undefined) {
10✔
21
            node.layerUpdateState[layer.id] = new LayerUpdateState();
10✔
22
        } else if (!node.layerUpdateState[layer.id].canTryUpdate()) {
10!
23
            // toggle visibility features
×
24
            node.link[layer.id]?.forEach((f) => {
×
25
                f.layer.object3d.add(f);
×
26
                f.meshes.position.z = geoidLayerIsVisible(layer.parent) ? node.geoidHeight : 0;
×
27
                f.meshes.updateMatrixWorld();
×
28
            });
×
29
            return;
×
30
        }
×
31

10✔
32
        let extentsDestination = node.getExtentsByProjection(layer.source.crs);
10✔
33
        let zoomDest;
10✔
34
        if (!extentsDestination) {
10!
NEW
35
            extentsDestination = [node.extent]; // of type Extent
×
NEW
36
            zoomDest = node.level;
×
37
        } else {
10✔
38
            zoomDest = extentsDestination[0].zoom;
10✔
39
        }
10✔
40

10✔
41
        // check if it's tile level is equal to display level layer.
10✔
42
        // TO DO updata at all level asked
10✔
43
        // if ((zoomDest < layer.zoom.min && zoomDest > layer.zoom.max) ||
10✔
44
        if (zoomDest != layer.zoom.min ||
10✔
45
        // check if there's data in extent tile.
10✔
46
            !this.source.extentInsideLimit(node.extent, zoomDest) ||
10✔
47
        // In FileSource case, check if the feature center is in extent tile.
10✔
48
            (layer.source.isFileSource && !node.extent.isPointInside(layer.source.extent.center(coord)))) {
10!
49
        // if not, there's not data to add at this tile.
×
50
            node.layerUpdateState[layer.id].noMoreUpdatePossible();
×
51
            return;
×
52
        }
×
53

10✔
54
        node.layerUpdateState[layer.id].newTry();
10✔
55

10✔
56
        const command = {
10✔
57
            layer,
10✔
58
            extentsSource: extentsDestination,
10✔
59
            view: context.view,
10✔
60
            requester: node,
10✔
61
        };
10✔
62

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

8✔
66
            featureMeshes.forEach((featureMesh) => {
8✔
67
                if (featureMesh) {
8✔
68
                    node.link[layer.id] = node.link[layer.id] || [];
8✔
69
                    featureMesh.as(context.view.referenceCrs);
8✔
70
                    featureMesh.meshes.position.z = geoidLayerIsVisible(layer.parent) ? node.geoidHeight : 0;
8!
71
                    featureMesh.updateMatrixWorld();
8✔
72

8✔
73
                    if (layer.onMeshCreated) {
8!
74
                        layer.onMeshCreated(featureMesh, context);
×
75
                    }
×
76

8✔
77
                    if (!node.parent) {
8!
78
                        // TODO: Clean cache needs a refactory, because it isn't really efficient and used
×
79
                        ObjectRemovalHelper.removeChildrenAndCleanupRecursively(layer, featureMesh);
×
80
                    } else {
8✔
81
                        layer.object3d.add(featureMesh);
8✔
82
                        node.link[layer.id].push(featureMesh);
8✔
83
                    }
8✔
84
                    featureMesh.layer = layer;
8✔
85
                } else {
8!
86
                    // TODO: verify if it's possible the featureMesh is undefined.
×
87
                    node.layerUpdateState[layer.id].failure(1, true);
×
88
                }
×
89
            });
8✔
90
        },
10✔
91
        err => handlingError(err, node, layer, node.level, context.view));
10✔
92
    },
10✔
93
};
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

© 2025 Coveralls, Inc