mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
@@ -66,26 +66,35 @@ export function coreTree(head) {
|
||||
tree.intersects = function(extent, graph) {
|
||||
if (graph !== head) {
|
||||
var diff = coreDifference(head, graph);
|
||||
var insertions = {};
|
||||
var changed = diff.didChange;
|
||||
|
||||
head = graph;
|
||||
if (changed.addition || changed.deletion || changed.geometry) {
|
||||
var insertions = {};
|
||||
head = graph;
|
||||
|
||||
diff.deleted().forEach(function(entity) {
|
||||
rtree.remove(bboxes[entity.id]);
|
||||
delete bboxes[entity.id];
|
||||
});
|
||||
if (changed.deletion) {
|
||||
diff.deleted().forEach(function(entity) {
|
||||
rtree.remove(bboxes[entity.id]);
|
||||
delete bboxes[entity.id];
|
||||
});
|
||||
}
|
||||
|
||||
diff.modified().forEach(function(entity) {
|
||||
rtree.remove(bboxes[entity.id]);
|
||||
insertions[entity.id] = entity;
|
||||
updateParents(entity, insertions, {});
|
||||
});
|
||||
if (changed.geometry) {
|
||||
diff.modified().forEach(function(entity) {
|
||||
rtree.remove(bboxes[entity.id]);
|
||||
insertions[entity.id] = entity;
|
||||
updateParents(entity, insertions, {});
|
||||
});
|
||||
}
|
||||
|
||||
diff.created().forEach(function(entity) {
|
||||
insertions[entity.id] = entity;
|
||||
});
|
||||
if (changed.addition) {
|
||||
diff.created().forEach(function(entity) {
|
||||
insertions[entity.id] = entity;
|
||||
});
|
||||
}
|
||||
|
||||
rtree.load(Object.values(insertions).map(entityBBox));
|
||||
rtree.load(Object.values(insertions).map(entityBBox));
|
||||
}
|
||||
}
|
||||
|
||||
return rtree.search(extent.bbox())
|
||||
|
||||
Reference in New Issue
Block a user