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