#12255 closed enhancement (fixed)
[patch] GeoImageLayer: ImageEntry enhancements for image property dialog
Reported by: | holgermappt | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 16.01 |
Component: | Core image mapping | Version: | |
Keywords: | regression | Cc: |
Description
This patch adds functionality needed for an image property dialog (in the PhotoAdjust plugin).
List of changes:
ImageEntry
was changed from a data container into a real Class. E.g. constructors added,extractExif()
added.- Method
extractExif()
was moved from classGeoImageLayer
to classImageEntry
. - Consider temporary variable in method
ImageEntry.getExifImgDir()
. - Method
ImageEntry.getThumbnail()
added. ImageEntry.setPos()
: Allow to clear the position (by setting it to null).ImageEntry.setExifImgDir()
changed type of argumentexifDir
fromdouble
toDouble
to be able to clear the image direction (by setting it to null). This requires a re-compilation of other code that calls this method. The originalsetExifImgDir(double exifDir)
is commented out in case the re-compilation is a problem. Otherwise it can be removed from the code. The only code with that issue that I found is the PhotoAdjust plugin.ImageEntry
: Added methodsgetTmp()
anddiscardTmp()
. This allows to access the temporary variable from plugins.ImageViewerDialog
: Added the possibility to disable the center view button withsetCentreEnabled()
.- Please check the
synchronized
section. The idea is that the instance that disables the button also enables it. In case two threads try to disable the button simultaneously the one that actually disables it gets the return valuetrue
, the other thread gets afalse
because it didn't disable the button.
- Please check the
ImageViewerDialog
: Round the elevation.
Attachments (4)
Change History (31)
by , 9 years ago
Attachment: | GeoImageLayer_ImageDialog.patch added |
---|
comment:1 by , 9 years ago
Milestone: | → 16.01 |
---|
follow-up: 3 comment:2 by , 9 years ago
by , 9 years ago
Attachment: | 12255-v2.patch added |
---|
follow-ups: 4 5 comment:3 by , 9 years ago
Replying to simon04:
Replying to holgermappt:
Alright. No need to modifyGeoImageSessionImporter
.
I changed the type in GeoImageSessionImporter
to be consistent with the other Double
fields like speed and elevation.
Can
getTmp()
be implemented usingcleanTmp()
?
getTmp()
returns the current tmp and creates a new one if it doesn't exist. cleanTmp()
always creates a new tmp and sets the tmp position. I don't see how one method can use the other or be replaced with the other one.
ImageViewerDialog
: Added the possibility to disable the center view button withsetCentreEnabled()
.
- Please check the
synchronized
section.I think this function can be simplified to:
Looks good.
The documentation of ImageEntry.getPos()
starts with /*
instead of /**
in 12255-v2.patch.
The other modifications are fine.
The Returns the cached temporary ...
from [9243#file47] is not right. It uses the temporary version only if it exists and the regular one otherwise.
comment:4 by , 9 years ago
Replying to holgermappt:
The
Returns the cached temporary ...
from [9243#file47] is not right. It uses the temporary version only if it exists and the regular one otherwise.
Feel free to fix documentation also, you have a better knowledge than me of these parts of code :)
follow-up: 6 comment:5 by , 9 years ago
Replying to holgermappt:
Can
getTmp()
be implemented usingcleanTmp()
?
getTmp()
returns the current tmp and creates a new one if it doesn't exist.cleanTmp()
always creates a new tmp and sets the tmp position. I don't see how one method can use the other or be replaced with the other one.
I meant:
public ImageEntry getTmp() { if (tmp == null) { cleanTmp(); } return tmp; }
by , 9 years ago
Attachment: | 12255-v3.patch added |
---|
comment:6 by , 9 years ago
Replying to simon04:
Can
getTmp()
be implemented usingcleanTmp()
?
I meant:
public ImageEntry getTmp() { if (tmp == null) { cleanTmp(); } return tmp; }
No, that doesn't work because it clears the position. I replaced cleanTmp()
with createTmp()
and modified CorrelateGpxWithImages.StatusBarUpdater.statusText()
accordingly. It should make more sense now.
Other changes in v4 compared to v3:
- Use
ImageEntry.discardTmp()
inCorrelateGpxWithImages
. - Update of the
Returns the cached temporary ...
documentation strings. - Added
ImageEntry.loadThumbnail()
. This was something I wanted before, but did not know how to implement it.- Extended class
ThumbsLoader
to have a version that operates on a single image entry.
- Extended class
- Fixed the "Do not load thumbnails that were loaded before" condition in class
ThumbsLoader
. - Added and updated documentation strings.
by , 9 years ago
Attachment: | 12255-v4.patch added |
---|
follow-up: 9 comment:7 by , 9 years ago
The problem I see w/ ImageEntry#loadThumbnail
is that it fetches the thumbnail synchronously, i.e., it blocks. Maybe we can move/generalize GeoImageLayer#startLoadThumbs
somehow. Or call the ThumbsLoader
from the plugin?
I'll commit the other parts of this patch for now since the patch is already complex enough. :)
comment:9 by , 9 years ago
Replying to simon04:
The problem I see w/
ImageEntry#loadThumbnail
is that it fetches the thumbnail synchronously, i.e., it blocks. Maybe we can move/generalizeGeoImageLayer#startLoadThumbs
somehow. Or call theThumbsLoader
from the plugin?
I think on the image entry level it should be blocking. I load the thumbnail because I want to use it. Same like extractExif()
. If I don't want it to block, then something has to be done on a higher level. In my case I need a single thumbnail for a dialog where some of the ImageEntry
properties can be modified. It would take too long to load all thumbnails with GeoImageLayer#startLoadThumbs
. It's too much overhead to build a temporary GeoImageLayer
with just that one ImageEntry
and then call GeoImageLayer#startLoadThumbs
on that layer. I can move ImageEntry#loadThumbnail
into my plugin, but then I need the ThumbsLoader
constructor that operates on a single image entry.
In my opinion ThumbsLoader.loadThumb()
should be part of ImageEntry
to keep all knowledge about an image at one place. At least the part that calculates the thumbnail. But so far I didn't understand the role of MediaTracker
and whether it is a good idea to create a new tracker for each image. Same for the cache code.
I'll commit the other parts of this patch for now since the patch is already complex enough. :)
Thank you for your time to review my changes.
comment:11 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I generalized your patch for ImageEntry#loadThumbnail
a bit …
comment:12 by , 9 years ago
I think this change broke reading of exif timestamps for me. I was trying to correlate images to gpx today and current josm couldn't do it, it didn't see gps timestamps at all. When I downgraded to 9229, everything works again. This change seems to be the only relevant one between 9229 and 9327. Can someone please check if they can reproduce this? If not, I'll be happy to provide a .jpg that josm fails to read. Thanks.
follow-up: 15 comment:13 by , 9 years ago
thanks for feedback. Can you please post a jpg and a gpx file?
follow-up: 20 comment:14 by , 9 years ago
Since I updated to photoadjust plugin to Version 31953, I sometimes find myself with the "Center view" button disabled (greyed) in the Geotagged Images pane. It happened a few times, while I worke with the image postitioning. I still haven't find a way to reproduce the problem. Restarting JOSM gets the button enabled again.
comment:15 by , 9 years ago
Replying to Don-vip:
thanks for feedback. Can you please post a jpg and a gpx file?
comment:16 by , 9 years ago
Keywords: | regression added |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
comment:20 by , 9 years ago
Replying to bartosomail@…:
Since I updated to photoadjust plugin to Version 31953, I sometimes find myself with the "Center view" button disabled (greyed) in the Geotagged Images pane. It happened a few times, while I worke with the image postitioning. I still haven't find a way to reproduce the problem. Restarting JOSM gets the button enabled again.
this ticket is for core features, please create a new one for issues with plugins.
comment:21 by , 9 years ago
Replying to tomi@…:
Wow, that was quick, thanks. :-)
new tested on the way. Thanks for quick feedback!
comment:22 by , 9 years ago
Replying to Don-vip:
Bug found, fix in progress.
The fix is to move setExifTime(ExifReader.readTime(file));
a few lines up? Can you give a hint what caused the problem?
comment:23 by , 9 years ago
I think the problem was that it was below this:
477 if (dirGps == null) { 478 setExifCoor(null); 479 setPos(null); 480 return; 481 }
comment:24 by , 9 years ago
dirGps
is null
with this image. Previously this case was handled by setExifTime(ExifReader.readTime(file))
being duplicated before the call to extractExif()
.
follow-up: 26 comment:25 by , 9 years ago
I see. In that case setExifTime()
should be moved further up right after:
if (file == null) { return; }
in case catch (CompoundException | IOException p)
is triggered and the function returns.
The original code called setExifTime()
before extractExif()
was called. It was not duplicated before, there was no setExifTime()
in the original extractExif()
. I moved it into extractExif()
but didn't consider all cases that let the function return.
Replying to holgermappt:
I would use the constants in
SystemOfMeasurement
for converting to km/h.I would also add
setThumbnail
and make the field private.Alright. No need to modify
GeoImageSessionImporter
.Can
getTmp()
be implemented usingcleanTmp()
?I think this function can be simplified to: