-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Panoramax: Adopt "copy id" feature from mapillary #10856
base: develop
Are you sure you want to change the base?
Panoramax: Adopt "copy id" feature from mapillary #10856
Conversation
From reading the code I don't see how this PR could resolve the requirements described in the issue, specifically #10611 (comment) and #10611 (comment) |
@tordans, Do you mean that I haven't used the |
@tordans, after reading the related modules to this feature, I have found another solution to solving this problem using hash (search hash params class, or using context). Is this suitable? |
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.
Ok, But I will use the copy icon instead of the plus |
ddfda67
to
366dc0a
Compare
Hi @tyrasd, I suggest the following style: |
please use the same icon as used in the mapillary viewer. otherwise this would be very confusing. |
@tyrasd I think the main thing we need to agree on first is, what solution does resolve the linked issue. I outlined my proposal in the links above. The core idea of that is, to use what we have for Mapillary and abstract it to reuse of other image providers. This is not what is being proposed here as far as I understand the code but instead a copy button that would require to manually add the key and paste the value. As a result we would have two features doing something very similar – one better then the other. My recommendation would be to clarify what we are looking for so this PR might be adjusted … or otherwise closed as it is not what we should merge IMO. |
I agree, that's basically what I meant with it should work like the corresponding button on mapillary photos above. 🤷 A copy-to-clipboard button is definitely not going to cut it here. |
I've rephrased the original issue I had opened to make it clearer that the "agreed" solution is copying the mapillary-functionality |
366dc0a
to
3e705dd
Compare
I am so sorry, for the misunderstanding. The first is the plus icon, which provides a bad experience and I suggest replacing it with the following icon (such as @tordans has been suggested before at mapillary implementation). The second is the position of the zoom icons in the panormax photo as in the following image and I suggest moving them down a bit. If one of my suggestions or both isn't right tell me to change them. |
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 for the update!
.every(value => value === activeImage?.id)) { | ||
const entitiesWithTag = entities.map(entity => entity.tags[tagName] ? entity.tags[tagName] : undefined).filter(e => e); | ||
const isPhotoUsed = entitiesWithTag | ||
.some(value => value === activeImage?.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.
This part checks if the "looked at" image id is already present in the tags value, right?
We should make this something like value.includes(activeImage?.id)
to account for the edge case that multiple image ids are used separated by ;
, eg. "<id1>;<id2>
". (We talked about that practice while reviewing openstreetmap/id-tagging-schema#1344)
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.
Interesting to see the change from every
to some
. That was a bug in the previous implementation, right?
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.
Interesting to see the change from
every
tosome
. That was a bug in the previous implementation, right?
This is right, I have found this bug and I have rewritten this line to refactor the function.
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.
This part checks if the "looked at" image id is already present in the tags value, right? We should make this something like
value.includes(activeImage?.id)
to account for the edge case that multiple image ids are used separated by;
, eg. "<id1>;<id2>
". (We talked about that practice while reviewing openstreetmap/id-tagging-schema#1344)
Okay, this is more effective, I will apply it.
Thanks, a lot.
if (services.mapillary.isViewerOpen()) { | ||
if (context.mode().id !== 'select' || !(layerStatus('mapillary') && getServiceId() === 'mapillary')) { | ||
const service = getServiceId(); | ||
const isActiveService = ['mapillary', 'panoramax'].includes(service) && services[service].isViewerOpen(); |
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.
Lets extract this array into something like a const PHOTO_SERVICES_WITH_TAG_BUTTON = []
to give it a bit more visibility that this is the place where we configure the services. Please check the code conventions on such const (naming in placement in file); I don't know how that is done elsewhere in the codebase.
We are also making the assumption here that the service name and tag key will be the same. That is true for those two but might be different for others. We could account for this now… but it feels like premature optimization so I would do it in a refactoring later when the need comes up.
if (context.mode().id !== 'select' || !(layerStatus('mapillary') && getServiceId() === 'mapillary')) { | ||
const service = getServiceId(); | ||
const isActiveService = ['mapillary', 'panoramax'].includes(service) && services[service].isViewerOpen(); | ||
const mapillaryOrPanoramax = (layerStatus(service) && ['mapillary', 'panoramax'].includes(service)); |
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.
- Lets use a more generic name for the const
- Lets reuse the same array defined once above
Can you double check the conditions, I think that isActiveService already accounts for the second condition in this check, right?
const mapillaryOrPanoramax = (layerStatus(service) && ['mapillary', 'panoramax'].includes(service)); | ||
|
||
if (isActiveService) { | ||
if (context.mode().id !== 'select' || !(mapillaryOrPanoramax)) { |
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.
if (context.mode().id !== 'select' || !(mapillaryOrPanoramax)) { | |
if (context.mode().id !== 'select' || !mapillaryOrPanoramax) { |
function setMapillaryPhotoId() { | ||
const service = services.mapillary; | ||
const image = service.getActiveImage(); | ||
function setMapillaryOrPanoramaxPhotoId() { |
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.
Like above, lets look for a name that is more generic.
What would be a good name to describe the general feature? "addPhotoServiceTag", "applyTagOfPhotoService",…
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.
Yeah, I think addPhotoServiceTag
is more expressional to its implementation.
|
||
const graph = context.graph(); | ||
const entities = context.selectedIDs() | ||
.map(id => graph.entity(id)); | ||
|
||
if (entities.map(entity => entity.tags.mapillary) | ||
.every(value => value === activeImage?.id)) { | ||
const entitiesWithTag = entities.map(entity => entity.tags[tagName] ? entity.tags[tagName] : undefined).filter(e => e); |
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.
That should be the same but shorter, right?
const entitiesWithTag = entities.map(entity => entity.tags[tagName] ? entity.tags[tagName] : undefined).filter(e => e); | |
const entitiesWithTag = entities.map(entity => entity.tags[tagName]).filter(Boolean); |
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.
nice, thanks
Given the research you did in #10611 (comment) I only see on other service that has a dedicated wiki page about a dedicated tag which is https://wiki.openstreetmap.org/wiki/Key:kartaview I don't think Kartaview is especially active / used in OSM and the tag has low usage with ~600 https://taginfo.openstreetmap.org/keys/kartaview but we could look into adding this as well. The Kartaview UI might require extra work though, in which case I would rather skip it for later due to the low usage. |
Choosing the icon Personally, I agree that the plus is a no go given the +/- for Zooming and that from the list we #10046 (comment) researched last time the one you chose is the best choice. Martin might see it differently but I suggest to go with that for now. Position of button
|
Yeah, this is right. |
Hi there,
This is my code to add the
copy id
button at the Panoramax imageChanges
Issue
Closes #10611