-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(neat) I guess the second test (after &&
) is useless, so this could be simplified to if (commonAncestorName)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed: fixed.
preUpdate(context, layer) { | ||
// TODO: use changeSource | ||
layer.counters = { | ||
pointCount: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if you just keep displayedCount
you may want to go with layer.displayCount
instead of having an intermediary layer.counters
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember where this obj
came from?
it's an Object3D?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Process/PointCloudProcessing.js
Outdated
if (source.obj === undefined) { | ||
continue; | ||
} | ||
if (source.obj.isPoints && source.obj.layer == layer.id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could add comment to explain this part with commonAncestorName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -206,6 +219,8 @@ export default { | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you use bind
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).