Opened 8 years ago
Closed 8 years ago
#13815 closed enhancement (needinfo)
[patch] Open geotagged image in external viewer
Reported by: | Adrian | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core image mapping | Version: | |
Keywords: | Cc: |
Description
Please consider adding a button to the image viewer window. This button would open the currently displayed image in an external viewer. I would use it to view panoramas in a panorama viewer. There would need to be an option somewhere to select the external application to be used.
A possible further enhancement would be to add an option on the geotagged images layer, so that when you click on the camera icon or thumbnail, the image is opened immediately in the external viewer.
Attachments (4)
Change History (15)
by , 8 years ago
comment:1 by , 8 years ago
comment:2 by , 8 years ago
With r10966, my code always invoked the non-native file chooser, unaffected by the preference setting. With the changes made to the native file chooser in r11223, my code now invokes the native or non-native file chooser, according to the preference. There is a difference in the behaviour of the native and non-native file choosers in Mac OS X. To choose a .app, the non-native file chooser requires "files only" but the native file chooser requires "directories only". This requires a change to the added file SetExternalViewerAction.java. I have attached the new version of this file.
comment:3 by , 8 years ago
Summary: | Open geotagged image in external viewer → [patch] Open geotagged image in external viewer |
---|
Please see DevelopersGuide/PatchGuide. I would strongly recommend you check out the code with subversion and use svn diff
to create the patch.
by , 8 years ago
Attachment: | 13815.patch added |
---|
comment:4 by , 8 years ago
I have attached a patch as requested. I had already used svn co
to obtain the source code. When I first tried svn diff
, the patch did not include the new files and it took me some time to find out that I needed to use svn add
before using svn diff
.
comment:5 by , 8 years ago
Thanks, I've tested your patch. There is still considerable work needed, before this can be merged. For starters, it only works on Mac OS. We would also need implementations for Windows and Linux. There should also be a different icon as the current one suggests opening a (image-)file, not an application.
Idea: What would be nice here, is a split button (see SideButton.createArrow
) where a list of possible applications is shown in a popup. (+ one entry other application ...)
follow-up: 7 comment:6 by , 8 years ago
Thank you for looking at my patch.
From the documentation which I found, my code should work on Windows. I am disappointed to learn that it doesn't.
Unfortunately there is a significant snag - I prefer to spend my time mapping rather than coding. I have already spent much longer than I had planned to spend on this patch. I thought I would share what I have done, rather than keeping it to myself. With regret, I do not wish to spend any more time on this patch. I was already building my own custom version of JOSM because of some other changes which the development team did not wish to incorporate into JOSM. I will simply include this patch in my custom version.
Shall I leave this ticket open or close it with wontfix?
comment:7 by , 8 years ago
Replying to ar2988-os@…:
Thank you for looking at my patch.
From the documentation which I found, my code should work on Windows. I am disappointed to learn that it doesn't.
I just tested on Linux. Your patch seemed tailored for Mac OS, but I only had a quick look.
Unfortunately there is a significant snag - I prefer to spend my time mapping rather than coding. I have already spent much longer than I had planned to spend on this patch. I thought I would share what I have done, rather than keeping it to myself. With regret, I do not wish to spend any more time on this patch. I was already building my own custom version of JOSM because of some other changes which the development team did not wish to incorporate into JOSM. I will simply include this patch in my custom version.
Fair enough. Btw., there is usually less scrutiny if you contribute to plugins or create your own plugin.
Shall I leave this ticket open or close it with wontfix?
Can be closed.
follow-up: 10 comment:8 by , 8 years ago
Thank you.
Perhaps I should have provided some instructions, as follows: Open the context menu of the Geotagged Images layer. Click on "Set external viewer" to choose the app to be used as the external image viewer. (The other item I have added to that menu, allows you to launch the external viewer by clicking on the camera icon or thumbnail.)
I have now had the opportunity to try my patch on Windows, on a friend's computer. It works, if you first follow the instructions above (Windows 10, Java 8u111.) It doesn't work for me on Mac OS (now on 10.11.6 and Java 8u112) without following the instructions above.
I have just discovered a subtle bug in the native Mac file chooser, which has an effect on my patch. I will investigate further and report back.
comment:9 by , 8 years ago
The bug was not in the native Mac file chooser but in my code, and I have now fixed it. The attached 13815_v2.patch has been modified in three respects.
- Bugfix.
- Some missing tr() have been added.
- Updated to apply cleanly to r11427.
by , 8 years ago
Attachment: | 13815_v2.patch added |
---|
comment:10 by , 8 years ago
Thanks for the update, still the patch is not ready to be applied. The major problem is the GUI design. For any button, either it is disabled or something must happen, if clicked.
Replying to ar2988-os@…:
Perhaps I should have provided some instructions, as follows: Open the context menu of the Geotagged Images layer. Click on "Set external viewer" to choose the app to be used as the external image viewer. (The other item I have added to that menu, allows you to launch the external viewer by clicking on the camera icon or thumbnail.)
This is not very intuitive. If it is a global (rather than per-layer) setting, it should be in the preferences dialog. (Or accessed by clicking the launcher button.)
I have now had the opportunity to try my patch on Windows, on a friend's computer. It works, if you first follow the instructions above (Windows 10, Java 8u111.) It doesn't work for me on Mac OS (now on 10.11.6 and Java 8u112) without following the instructions above.
What would be really nice is to figure out the list of applications that are registered to open an image (as would be presented by right clicking an image file in a file browser). Of course this is platform dependent and may be tricky.
Please let me know, if you are planning to work on this, otherwise the ticket can be closed.
comment:11 by , 8 years ago
Resolution: | → needinfo |
---|---|
Status: | new → closed |
(I tried to register but my registration was rejected as spam, even though I entered two captchas correctly.)
I have developed a patch to do what I requested above. I have little experience of Java programming, so I make no claims about the quality of my code. As you will see, I have not set up a full development environment. I have used the version of diff that was already installed on my computer, with option --normal, and the files to be differenced as arguments. I don't know whether this produces a standard-format diff. I have tested on Mac OS X with Java 8. All the source files I refer to are in folder src/org/openstreetmap/josm/gui/layer/geoimage. In the attached 13815.zip, 13815_diff1 is to be applied to GeoImageLayer.java, 13815_diff2 is to be applied to ImageViewerDialog.java, and SetExternalViewerAction.java and UseExternalViewerAction.java are to be added to the folder.
Adrian