Bug 135451 - Improve the gui of the Geolocation tool
Summary: Improve the gui of the Geolocation tool
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-GeolocationEdit (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-11 14:09 UTC by Julien Narboux
Modified: 2018-03-23 11:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.2.0
Sentry Crash Report:


Attachments
A screenshot of flickr. (714.32 KB, image/png)
2006-10-11 14:11 UTC, Julien Narboux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Narboux 2006-10-11 14:09:21 UTC
Version:            (using KDE KDE 3.5.1)

I think it would be great if the google maps geolocalization gui is improved.

Here are my suggestions:

1- Sometimes it is quicker to type an address than zoom and pan using the map.
It would be great to add a text area to "Find a location" as in google maps. This feature is limited to 50000 queries by day by google, but I think it is ok for the time being ;-)

2- It would be great to have a list of currently selected pictures with thumbnails.

To be clearer: the windows is composed by the google map above and a widget under.
This widget consists in a list a pictures with thumbnails. 
When you open the plugin the list is the list of currently selected pictures in the host application. You have the possibility to change that using a menu which contains the list of albums. This widget could be reused by other kipi plugins (I think of galleryexport for instance because it does not take into account the current selection)

3- It would be great to assign coordinates to pictures by drag and drop. If the user has selected several pictures in the list then they all get the new coordinates. 

4- I think the google map window should be the first window which is opened by the plugin.
The currently selected pictures from host which are geolocalized are displayed on the map.
Maybe compute the zoom factor to include on the map all the selected picture. 
The gps track sync feature is a more advance feature which could be accessed by a button:
"Automatically localize using a gps track" or something like that.

I am willing to help on that but I first need to install a more recent distribution to have a konqueror compatible with googlemaps ;-)

Julien
Comment 1 Julien Narboux 2006-10-11 14:11:52 UTC
Created attachment 18091 [details]
A screenshot of flickr.

This screenshots shows the flickr interface which is well designed imho.
Comment 2 caulier.gilles 2006-10-11 14:37:25 UTC
*** Bug 135452 has been marked as a duplicate of this bug. ***
Comment 3 caulier.gilles 2006-10-24 10:04:55 UTC
SVN commit 598625 by cgilles:

kipiplugins from trunk : GPSSync plugin: 

plugin now provides 3 sub-menu entries (instead just one) :

- Start GPS device correlator using current pictures selection.
- Start Geographical Coordinates editor to tag current pictures selection.
- Remove Geographical Coordinates from current pictures selection

CCBUGS: 135451
CCMAIL: kde-imaging@kde.org, digikam-devel@kde.org


 M  +6 -3      gpseditdialog.cpp  
 M  +140 -14   plugin_gpssync.cpp  
 M  +5 -3      plugin_gpssync.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #598624:598625
@@ -196,21 +196,24 @@
     d->altitudeInput->text().toDouble(&ok);
     if (!ok)
     {
-        KMessageBox::error(this, i18n("Altitude value is not correct!"), i18n("GPS Sync"));    
+        KMessageBox::error(this, i18n("Altitude value is not correct!"), 
+                           i18n("Edit Geographical Coordinates"));    
         return;
     }        
 
     d->latitudeInput->text().toDouble(&ok);
     if (!ok)
     {
-        KMessageBox::error(this, i18n("Latitude value is not correct!"), i18n("GPS Sync"));    
+        KMessageBox::error(this, i18n("Latitude value is not correct!"), 
+                           i18n("Edit Geographical Coordinates"));    
         return;
     }        
 
     d->longitudeInput->text().toDouble(&ok);
     if (!ok)
     {
-        KMessageBox::error(this, i18n("Longitude value is not correct!"), i18n("GPS Sync"));    
+        KMessageBox::error(this, i18n("Longitude value is not correct!"), 
+                           i18n("Edit Geographical Coordinates"));    
         return;
     }        
 
--- trunk/extragear/libs/kipi-plugins/gpssync/plugin_gpssync.cpp #598624:598625
@@ -19,6 +19,10 @@
  *
  * ============================================================ */
 
+// Qt includes.
+
+#include <qfileinfo.h>
+
 // KDE includes.
 
 #include <klocale.h>
@@ -36,7 +40,10 @@
 
 // Local includes.
 
+#include "exiv2iface.h"
 #include "gpsbabelbinary.h"
+#include "gpsdatacontainer.h"
+#include "gpseditdialog.h"
 #include "gpssyncdialog.h"
 #include "plugin_gpssync.h"
 #include "plugin_gpssync.moc"
@@ -55,18 +62,37 @@
 {
     KIPI::Plugin::setup( widget );
 
-    // this is our action shown in the menubar/toolbar of the mainwindow
+    m_action_geolocalization = new KActionMenu(i18n("Geolocalization"),
+                               0,
+                               actionCollection(),
+                               "geolocalization");
 
-    m_actionGPSSync = new KAction (i18n("Geolocalization..."),
-                                   "gpsimagetag",
-                                   0,     
-                                   this,
-                                   SLOT(slotActivate()),
-                                   actionCollection(),
-                                   "gpssync");
+    m_action_geolocalization->insert(new KAction (i18n("Correlator..."),
+                                     "gpsimagetag",
+                                     0,     
+                                     this,
+                                     SLOT(slotGPSSync()),
+                                     actionCollection(),
+                                     "gpssync"));
 
-    addAction( m_actionGPSSync );
+    m_action_geolocalization->insert(new KAction (i18n("Edit coordinates..."),
+                                     0,
+                                     0,     
+                                     this,
+                                     SLOT(slotGPSEdit()),
+                                     actionCollection(),
+                                     "gpsedit"));
 
+    m_action_geolocalization->insert(new KAction (i18n("Remove coordinates..."),
+                                     0,
+                                     0,     
+                                     this,
+                                     SLOT(slotGPSRemove()),
+                                     actionCollection(),
+                                     "gpsremove"));
+
+    addAction( m_action_geolocalization );
+
     m_interface = dynamic_cast< KIPI::Interface* >( parent() );
 
     if ( !m_interface )
@@ -76,10 +102,10 @@
     }
 
     KIPI::ImageCollection selection = m_interface->currentSelection();
-    m_actionGPSSync->setEnabled( selection.isValid() && !selection.images().isEmpty() );
+    m_action_geolocalization->setEnabled( selection.isValid() && !selection.images().isEmpty() );
 
     connect( m_interface, SIGNAL(selectionChanged(bool)),
-             m_actionGPSSync, SLOT(setEnabled(bool)));
+             m_action_geolocalization, SLOT(setEnabled(bool)));
 }
 
 bool Plugin_GPSSync::checkBinaries(QString &gpsBabelVersion)
@@ -127,9 +153,8 @@
     return true;
 }
 
-void Plugin_GPSSync::slotActivate()
+void Plugin_GPSSync::slotGPSSync()
 {
-    // Get the current/selected album from host
     KIPI::ImageCollection images = m_interface->currentSelection();
 
     if ( !images.isValid() || images.images().isEmpty() )
@@ -147,9 +172,110 @@
     dialog->show();
 }
 
+void Plugin_GPSSync::slotGPSEdit()
+{
+    KIPI::ImageCollection images = m_interface->currentSelection();
+
+    if ( !images.isValid() || images.images().isEmpty() )
+        return;
+
+    KURL img = images.images().first();
+    KIPIPlugins::Exiv2Iface exiv2Iface;
+    exiv2Iface.load(img.path());
+    double alt, lat, lng;
+    bool hasGPSInfo = exiv2Iface.getGPSInfo(alt, lat, lng);
+    KIPIGPSSyncPlugin::GPSDataContainer gpsData(alt, lat, lng, false);
+
+    KIPIGPSSyncPlugin::GPSEditDialog dlg(kapp->activeWindow(), 
+                                         gpsData, img.fileName(), hasGPSInfo);
+
+    if (dlg.exec() == KDialogBase::Accepted)
+    {
+        gpsData = dlg.getGPSInfo();
+        KURL::List imageURLs = images.images();
+        KURL::List errorURLs;
+    
+        for( KURL::List::iterator it = imageURLs.begin() ; 
+            it != imageURLs.end(); ++it)
+        {
+            KURL url = *it;
+        
+            // We only add all JPEG files as R/W because Exiv2 can't yet 
+            // update metadata on others file formats.
+        
+            QFileInfo fi(url.path());
+            QString ext = fi.extension(false).upper();
+            if (ext == QString("JPG") || ext == QString("JPEG") || ext == QString("JPE"))
+            {
+                if (exiv2Iface.load(url.path()))
+                {
+                    bool ret = exiv2Iface.setGPSInfo(gpsData.altitude(), 
+                                                     gpsData.latitude(), 
+                                                     gpsData.longitude());
+                    ret &= exiv2Iface.save(url.path());
+                
+                    if (!ret)
+                        errorURLs.append(url);
+                }
+            }
+        }
+
+        if (!errorURLs.isEmpty())
+        {
+            KMessageBox::errorList(
+                        kapp->activeWindow(),
+                        i18n("Unable to save geographical coordinates to:"),
+                        errorURLs.toStringList(),
+                        i18n("Edit Geographical Coordinates"));  
+        }
+    }
+}
+
+void Plugin_GPSSync::slotGPSRemove()
+{
+    KIPI::ImageCollection images = m_interface->currentSelection();
+
+    if ( !images.isValid() || images.images().isEmpty() )
+        return;
+
+    KURL::List imageURLs = images.images();
+    KURL::List errorURLs;
+
+    for( KURL::List::iterator it = imageURLs.begin() ; 
+         it != imageURLs.end(); ++it)
+    {
+        KURL url = *it;
+    
+        // We only add all JPEG files as R/W because Exiv2 can't yet 
+        // update metadata on others file formats.
+    
+        QFileInfo fi(url.path());
+        QString ext = fi.extension(false).upper();
+        if (ext == QString("JPG") || ext == QString("JPEG") || ext == QString("JPE"))
+        {
+            KIPIPlugins::Exiv2Iface exiv2Iface;
+            exiv2Iface.load(url.path());
+            bool ret = exiv2Iface.removeGPSInfo();
+            ret &= exiv2Iface.save(url.path());
+        
+            if (!ret)
+                errorURLs.append(url);
+        }
+    }
+
+    if (!errorURLs.isEmpty())
+    {
+        KMessageBox::errorList(
+                    kapp->activeWindow(),
+                    i18n("Unable to remove geographical coordinates from:"),
+                    errorURLs.toStringList(),
+                    i18n("Remove Geographical Coordinates"));  
+    }
+}
+
 KIPI::Category Plugin_GPSSync::category( KAction* action ) const
 {
-    if ( action == m_actionGPSSync )
+    if ( action == m_action_geolocalization )
        return KIPI::IMAGESPLUGIN;
 
     kdWarning( 51000 ) << "Unrecognized action for plugin category identification" << endl;
--- trunk/extragear/libs/kipi-plugins/gpssync/plugin_gpssync.h #598624:598625
@@ -26,7 +26,7 @@
 
 #include <libkipi/plugin.h>
 
-class KAction;
+class KActionMenu;
 
 class Plugin_GPSSync : public KIPI::Plugin
 {
@@ -41,7 +41,9 @@
 
 protected slots:
 
-    void slotActivate();
+    void slotGPSSync();
+    void slotGPSEdit();
+    void slotGPSRemove();
 
 private:
 
@@ -49,7 +51,7 @@
 
 private:
 
-    KAction         *m_actionGPSSync;
+    KActionMenu     *m_action_geolocalization;
 
     KIPI::Interface *m_interface;
 };
Comment 4 Arnd Baecker 2007-05-02 11:50:52 UTC
I just realized that adding GPS 
coordinates (using the Picture geolocalization correlator
or with edit geographical coordinates)
forces the thumbnails to be re-created.
This can take quite long and 
does not seem to be necesssary, because 
the image itself does not change.
Comment 5 caulier.gilles 2008-02-09 10:30:06 UTC
Hey guy....

I'm happy to said than all points from this report are fixed in KDE4 port of the plugin... (:=)))

...

Gilles
Comment 6 caulier.gilles 2008-02-09 10:45:40 UTC
SVN commit 772640 by cgilles:

kipi-plugins from trunk (KDE4) : digiKam has a new tool to edit a GPS track list using googlemaps ! 
More than one point can be edited over the ma at the same time...
A fresh screenshot of the tool in action is available here : http://digikam3rdparty.free.fr/Screenshots/gpstracklisteditor.png

BUG: 135451
BUG: 135386

CCMAIL: digikam-devel@kde.org
CCMAIL: kde-imaging@kde.org



 M  +7 -2      gpstracklistcontainer.h  
 M  +19 -7     gpstracklisteditdialog.cpp  
 M  +2 -0      gpstracklisteditdialog.h  
 M  +2 -10     gpstracklistviewitem.cpp  
 M  +1 -1      gpstracklistwidget.cpp  
 M  +51 -2     plugin_gpssync.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=772640