feat(pointcloud): use 'changeSource' mechanism to avoid useless work#719
feat(pointcloud): use 'changeSource' mechanism to avoid useless work#719
Conversation
7ef054e to
9643de9
Compare
src/Process/PointCloudProcessing.js
Outdated
| } | ||
| } | ||
| } | ||
| if (commonAncestorName && commonAncestorName.length > 0) { |
There was a problem hiding this comment.
(neat) I guess the second test (after &&) is useless, so this could be simplified to if (commonAncestorName).
| preUpdate(context, layer) { | ||
| // TODO: use changeSource | ||
| layer.counters = { | ||
| pointCount: 0, |
There was a problem hiding this comment.
I see that the pointcloud.js and pointcloud_globe.js examples refer to pointcloud.counters.pointCount. Wouldn't that be a problem if you removed that count?
There was a problem hiding this comment.
Also, if you just keep displayedCount you may want to go with layer.displayCount instead of having an intermediary layer.counters object.
|
Just a quick unrelated note: I note that iTowns often dynamically adds properties to objects. For example, function Layer(options) {
this.name = options.name;
this.projection = options.projection;
…
this.displayedCount = 0;
}It also makes the code more readable, and easier to document. Just my 2 cents, and sorry for the unrelated comment here :) |
There was a problem hiding this comment.
LGTM, great improvement.
A question though (that have nothing to do with this PR): why is the node name is stored as a string ? Wouldn't be more efficient to store it with something as an octal ? I think it would simplify operation on it, and it could be simply converted to a string when needed. Nevermind, tried it up, not efficient.
|
@elemoine I agree completely on this, there could be improvement made here. |
| // some invisible tiles may now be visible | ||
| return [layer.root]; | ||
| } | ||
| if (source.obj === undefined) { |
There was a problem hiding this comment.
I don't remember where this obj came from?
it's an Object3D?
There was a problem hiding this comment.
| if (source.obj === undefined) { | ||
| continue; | ||
| } | ||
| if (source.obj.isPoints && source.obj.layer == layer.id) { |
There was a problem hiding this comment.
you could add comment to explain this part with commonAncestorName
| // eslint-disable-next-line no-console | ||
| console.log('LAYER metadata:', root); | ||
| layer.root = root; | ||
| root.findChildrenByName = findChildrenByName.bind(root, root); |
There was a problem hiding this comment.
To do currying and pre-set the first argument to root.
Implements a simple logic to avoid updating the full layer if we already know that the result won't change. This feature is already implemented for tile based layers (see 3f340b9).
32f104c to
38e7c11
Compare
This commit fixes a left-over from #719
This commit fixes a left-over from #719
Implements a simple logic to avoid updating the full layer if we
already know that the result won't change.
This feature is already implemented for tile based layers
(see 3f340b9).