-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix(track): ensure places node list will update when track name changes #1116
Draft
bradh
wants to merge
1
commit into
ngageoint:master
Choose a base branch
from
bradh:placesupdate_2020-12-13
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
At a glance, the
updatePlacemark
call is creating aplugin.file.kml.ui.KMLNode
which is already listening internally to this event inplugin.file.kml.ui.KMLNode.prototype.setFeature
. That feature change handler seems like the place where you would want to listen for updates to the name property.One point of potential confusion here: we have out own
PROPERTYCHANGE
events that we handle independently from the Openlayers events that fire whenever a property on anol.Object
is changed.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.
Thanks. I was thinking of the
feature
inplugin.file.kml.ui.KMLNode.prototype.setFeature
as being the underlying linestring, rather than conceptually being the track. Will take another look.On the second point, is there any guidance / conventions on which events get used where? Failing that, for a name or other track-level attribute, which should I use?
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.
The feature in a KML node is sort of a data wrapper around a geometry, style, and a bunch of other metadata and utility for drawing the geometry to the map and interacting with it. Generally speaking, features and geometries have a 1 to 1 mapping, though through the use of styles, you can have multiple geometries on a single feature. I don't think tracks ever do this, but they do use a special feature class called
DynamicFeature
which is how they update their geometries with changes in the timeline.We generally have a convention of not using Openlayers' internal events whenever possible. They fire a lot of them, they add listeners for everything, and are generally unoptimized as a result. By default, Openlayers fires an event on every change to a property, which is a behavior we disable via mixin because it's just unnecessary overhead that we don't care about 99% of the time. In lieu of that, we'll fire our own property change events for things we know we care about.
In this case:
Feature
instance.feature.dispatchEvent(new os.events.PropertyChangeEvent('label')
.'label'
property change inKMLNode
that sets the new label value on the node from the feature.PropertyChangeEvent
onward from theKMLNode
. This bubbles up the tree to the root, where the tree itself listens and should re-render itself on label change.