Bug 133359 - WISH: Google maps support to show satellite images of the photos
Summary: WISH: Google maps support to show satellite images of the photos
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Geolocation-GoogleMaps (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-01 00:41 UTC by Antonio E.
Modified: 2017-08-18 16:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.0


Attachments
Fixed exiftools-gps script (1.50 KB, text/plain)
2006-09-14 23:31 UTC, Antonio E.
Details
More compact version of exiftools-gps (1.40 KB, text/plain)
2006-09-15 00:13 UTC, Antonio E.
Details
exiftool-gps-wrapper (1.59 KB, text/plain)
2006-09-15 21:39 UTC, Gerhard Kulzer
Details
exiftool-gps-wrapper (fixed) (1.62 KB, text/plain)
2006-09-16 14:17 UTC, Antonio E.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio E. 2006-09-01 00:41:15 UTC
Version:           0.9-svn (using KDE KDE 3.5.4)
Installed from:    Gentoo Packages
OS:                Linux

I have seen in #111560 that the support for gps is in progress, but reading the issue I understand that it will only be useful if a camera can supply the gps coordenates.

I think that it could be nice to have a manual way (for many of as that doesn't have those cameras) to enter the coordenates, and instead of showing a mark in a map, it could open a browser or an embedded window or panel (perhaps konqueror can be embedded in a little panel), showing the satellite view of google maps of the given coordenate. That way one could see all picture associated to real satellite images without needing an expensive camera with an integrated gps. I don't know what would be better, if supply the gps coordenates or the google maps link.

It could be also nice to communicate to the google earth application, with a menu saying something like "show coordenates in google earth",... But well, this is very secundary, as google maps can do mostly the same using just a browser.

It's just an idea that could be a cool plug-in.
Comment 1 Gerhard Kulzer 2006-09-01 09:16:05 UTC
Have you read the svn documentation yet?
http://docs.kde.org/development/en/extragear-graphics/digikam/using-kapp-camera.html#using-kapp-gps

A manual way to insert coordinates into images is described there.

Your second wish to open a browser is already implemented with 4 different map engines to select from. 

Communication with GoogleEarth might be an option for further development, but it is not as simple as opening a browser window pointing to the GPS data since the GoogleEarth command line options are very basic and subject to change.

Gerhard
Comment 2 Colin Guthrie 2006-09-01 11:16:27 UTC
Would it be possible to generate a KMZ file for Google Earth? I don't know what the file format contains, not how difficult it would be to create, but perhaps it is an option? With the KMZ file, you could just load GE with the file as the option?
Comment 3 Colin Guthrie 2006-09-01 11:17:58 UTC
Ahh yes. KMZ would be simple to generate - it's just XML (or KML in Googlespeak) + ZIP. May be worth looking into:
http://www.gearthblog.com/blog/archives/2005/09/google_earth_fi.html
Comment 4 caulier.gilles 2006-09-01 11:21:43 UTC
What is it a KMZ file ?

Gilles
Comment 5 Gerhard Kulzer 2006-09-01 12:17:44 UTC
GoogleEarth stores its location data in kmz files (zipped kml resp. xml files). To see how it look like just save a location from GoogleEarth to a file.

Gerhard
Comment 6 Julien Narboux 2006-09-01 12:18:52 UTC
KMZ is a xml based file format to add layers (overlays), paths, polygons to a map.

Here is the google tutorial about kml and kmz files:
http://earth.google.com/kml/kml_tut.html

KML files can be opened by google earth.

Now they can be opened using google maps as well.

Simply enter the URL of your KML file into the Google Maps search box and check out your custom map, like the Discovery channel's National Parks tour:
http://maps.google.com/maps?q=http://dsc.discovery.com/utilities/googleearth/nationalparks/nationalparks.kml

It would be nice to have an option to generate a kml file from Digikam albums.
This kml file would contain a mark for each geolocalized picture in the database.

It would be even greter to have a new "Location" tab on the left of Digikam : Albums, Dates, Tags, Location ...

This tab would contain a konqueror "window" which consist in the rendering of the kml file corresponding to the digikam database.

This way we could not only locate one picture but several.
Comment 7 Antonio E. 2006-09-04 10:01:59 UTC
#1. No Gerhard, I didn't read the documentation before your comment. I've been testing the code but not the documentation. Reading it I have understood the plan for the gps support, which looks good.

But, I still think that it's a bit difficult for normal users to add the gps coordenates as everything seems to have to be done using external apps for the image manipulation.

I like the idea of the KML files, in both ways export and import. Having google earth installed is trivial to get the a kml file with the exact coordenates, what I think is one of the easiest way for many people to associate the gps coordenates to an image. So I'm agree with Julien, that it would be really greate to have something saying "Add Location" to an image where a kml file could be imported, as that will avoid the people to even know anything about gps, just take the position from google earth and link it to an image.
Comment 8 Fabien 2006-09-05 13:35:33 UTC
I'm not sure it's digikam's job to produce a kml file, which is a specific file format from Google.
It would be better, IMHO, to produce a GPX file with waypoints using the picture location and comments.
Now, google earth can read gpx files. Maybe google map will be able to do that, or  it's very easy to convert the gpx format to kml using gpsbabel. There is even a web frontend to this tool :
http://www.gpsvisualizer.com/gpsbabel/

I think there are great opportunities with geolocation, and we are just at the beginning of a new era :)
Another feature could be to select a zone on a map and to be able to see all pictures from this area...
Comment 9 Antonio E. 2006-09-05 14:04:31 UTC
And reading? Because that would make really easy to import the gps into an
image using digikam.
And reading? Because that would make really easy to import the gps into an image using digikam.<br>
Comment 10 Antonio E. 2006-09-05 14:09:17 UTC
I mean reading kml. I understand your point of writing kml, but reading support could be added, in adition to gpx.

But, yes, a new amazing gps era is coming ;-). 
Comment 11 caulier.gilles 2006-09-05 14:13:11 UTC
Fabien,

> Another feature could be to select a zone on a map and to be able to see all pictures from this area... 

We can do it only when GPS info will be stored into Database. Actually, digiKam only use the metadata from file.

For performance reasons, dupplicate some importants metadata to database is mandatory. There is already a file in B.K.O about this subject.

When i said dupplicate metadata to DB, i want mean only the _most_ important for photographer like apperture, exposure time, camera model, camera maker, etc. and of course GPS.

This job is planed later than 0.9.0 issue, because we won't touch the datatbase structure for this release to preserve compatibilty with 0.8.0. Also, there are already a lot of changes in digiKAm with 0.9.0. Cumulate to many changes is dangerous.

But, i love the GPS camera stuff (:=)))

Gilles Caulier
Comment 12 caulier.gilles 2006-09-05 14:18:54 UTC
Antonio, 

My viewpoint to store the GPS info into pictures, is to create a new kipi-plugin for that. It's easy to do using Exiv2 like this tool work do :

http://freefoote.dview.net/linux/corrdoc/concepts.html

Gilles Caulier
Comment 13 Arnd Baecker 2006-09-05 14:49:15 UTC
On Tue, 5 Sep 2006, Fabien wrote:

[bugs.kde.org quoted mail]

Yes that would be nice (+ combine with the conventional search methods).

Some related points:

A) Display a map with symbols and thumbnail on mouse-over:

When on a map which has symbols for the places where photos
have been taken, the corresponding thumbnail could be displayed
(and on-click be selected ...)
See http://jrhicks.net/67 for an on-line example...

B) Local storage of maps:

I would also like to see support for maps which a user can store
locally: not always one has a internet connnection and
there are many cases, where publically available maps
are not detailed enough and one has to use scanned maps (etc.).

However, I think that the original question is not yet answered:

How does one most conveniently supply images with GPS information
(if one does not have a GPS device)?
No problem for just one image or a bunch of images
at the same place. But for many?

Somehow something like a list of images to the left and

  ...                 [                    ]
  image_thumb_11      [                    ]
  image_thumb_12      [    MAP             ]
  image_thumb_13      [                    ]
  ....                [                    ]
                      [ Zoom In/Out| Move  ]

Clicking on some position in the MAP associates the corresponding
GPS coordinates to all selected images.

((Thinking of a hike in the mountains very detailed maps
might be needed, hence B) above))

Best, Arnd

P.S.: I just came across:
http://www.carto.net/projects/photoTools/gpsPhoto/
which is a GPL commandline tool to synchronize a gps (gpx)
tracklog with the date/time stamps of the image exif-data.
This even does support RAW (cr2 and nef) in addition to jpeg.
Comment 14 caulier.gilles 2006-09-09 09:18:52 UTC
Just a link to a win32 app named 'itags' witch can export GPS data to google earth :

http://www.itagsoftware.awswa.com/screenshots.php

Gilles Caulier
Comment 15 Antonio E. 2006-09-14 23:29:17 UTC
I've made a little fix in the script described in the svn documentation that uses exiftools to set the gps data using the google maps coordenates. The original script only works with folders; it fails with single files. And it doesn't check if the file exists. The new script is:

#!/bin/sh
# exiftool wrapper script for easy commandline use. It treats regex files or whole directories.
#
#                        FMT                  Output
#                "%d deg %d' %.2f"\"    54 deg 59' 22.80"
#                "%d deg %.4f min"      54 deg 59.3800 min
#                "%.6f degrees"         54.989667 degrees

if [ -z $1 ]; then
   echo "Usage: exiftool-gps lat long [alt] file || dir (use signed floating coordinates)"
else

   if  [ -z "$4" ]; then  foo="$3"; alt=0
   else                   foo="$4"; alt=$3
   fi

   echo $foo
   if [ -e "$foo" ] ; then
        lat=$(echo "$1" | awk '{if ($1 < 0) print "S"; else print "N"}')
        lon=$(echo "$2" | awk '{if ($1 < 0) print "W"; else print "E"}')
        # use the following syntax for easy googlian paste of ll=-1.23456,53.345345
        #lon=$(echo "$2" | awk '{if ($2 < 0) print "W"; else print "E"}')
        echo $1, $lat, $2, $lon, $3, $4, $foo

        if [ -d "$foo" ] ; then

            for i in "$foo" ; do    # the selection of files treated depend on the passed regex
                echo "i= "$i
                exiftool -c "%.6f" -GPSMapDatum="WGS-84" -GPSAltitude=$alt \
                -GPSLongitudeRef=$lon -GPSLongitude=$2 -GPSLatitudeRef=$lat -GPSLatitude=$1 "$i"
                exiftool -GPS:ALL "$i"  # read back
            done
        else

            exiftool -c "%.6f" -GPSMapDatum="WGS-84" -GPSAltitude=$alt \
            -GPSLongitudeRef=$lon -GPSLongitude=$2 -GPSLatitudeRef=$lat -GPSLatitude=$1 "$foo"
            exiftool -GPS:ALL "$foo"  # read back
        fi
   else echo "file or folder is wrong"
   fi
fi
Comment 16 Antonio E. 2006-09-14 23:31:09 UTC
Created attachment 17774 [details]
Fixed exiftools-gps script

Probably it's better if I attach the script.
Comment 17 Gerhard Kulzer 2006-09-15 00:06:36 UTC
I'm surprised, the script worked well with files and folders for me (-d tests both)
Comment 18 Antonio E. 2006-09-15 00:13:18 UTC
Created attachment 17776 [details]
More compact version of exiftools-gps

I've uploaded a new version a bit more compact
Comment 19 Antonio E. 2006-09-15 00:19:21 UTC
To me it didn't work with files, at least with a file in a subfolder.

Imagine that I was in:
/home/user/pictures/

There was a folder called gps containing a file named 100000.jpg

I tried something like: exiftools-gps number number gps/100000.jpg

I was getting all the time: file or folder is wrong

The only way that I could make it to work was using the folder:

exiftools-gps number number gps


After making the change it works fine to me with both, folders and files.
Comment 20 Antonio E. 2006-09-15 00:39:16 UTC
I found another error which affects all script versions (included the latest one that I uploaded).

The problem comes with negatives values. I tried to use values from google maps and the longitude is a negative value, which makes the script to throw:

Must be a positive number for GPS:GPSLongitude

And it doesn't set the longitude in the exif. But the rest (altitude, latitude,...) are set.
Comment 21 Gerhard Kulzer 2006-09-15 21:39:17 UTC
Created attachment 17784 [details]
exiftool-gps-wrapper
Comment 22 Antonio E. 2006-09-16 01:15:22 UTC
I have tried it. Now it works with negative values. But it's not yet working fine, because it doesn't manage the longitude correctly.

For example:
I get the coordenates from:
http://maps.google.com/maps?f=q&hl=es&q=c%C3%A1diz+spain&ie=UTF8&z=17&ll=36.527536,-6.315207&spn=0.005837,0.009763&om=1&iwloc=A

So I consider that the values are: 36.527536,-6.315207

Then I execute:
exiftool-gps-wrapper 36.527536 -6.315207 picture.jpg

The output is:

    1 image files updated
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Latitude                    : 36 deg 29' 44.95"
GPS Longitude Ref               : West
GPS Longitude                   : 4 deg 0' 0.00"
GPS Altitude                    : 0 metres
GPS Map Datum                   : WGS-84

To me is really strange that the GPS Longitude has 0 for the minutes and seconds. And it happens always (I tried different locations).

When now in digikam, I click in more info selecting the Google Map or the Map Quest I get a different location.
For example, for the previous example, I get:

http://maps.google.com/?q=36.49582000,-4.00000000&spn=0.05,0.05&t=h&om=1&hl=en

As you see in the pictures, both locations are different.
Comment 23 Gerhard Kulzer 2006-09-16 10:11:50 UTC
. exiftool-gps-wrapper 36.527536 -6.315207 _MG_1145.CR2
_MG_1145.CR2
36.527536, N, 6.31521, W, _MG_1145.CR2, , _MG_1145.CR2
    1 image files updated
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Latitude                    : 36 deg 31' 39.13"
GPS Longitude Ref               : West
GPS Longitude                   : 6 deg 18' 54.76"
GPS Altitude                    : 0 metres
GPS Map Datum                   : WGS-84

And this is what I get back when invoking maps.google from digiKam:
http://maps.google.com/?q=36.52753600,-6.31521000&spn=0.05,0.05&t=h&om=1&hl=en (beach near some fort San Sebastian in Cadiz). A very little error is introduced (truncation of 6.315207 to 6.31521)
I don't know what's going on, are you sure we use the same script? Or is it a question of awk? Can't believe that. Maybe exiftool version? This is mine: 
$ exiftool -ver
ExifTool version 6.34
Comment 24 Antonio E. 2006-09-16 10:33:55 UTC
Sadly yes, I'm using the right one (I've just downloaded it again to make sure). This is really annoying.

exiftool-gps-wrapper 36.527536 -6.315207 test.jpg
test.jpg
36.527536, N, 6, W, test.jpg, , test.jpg
    1 image files updated
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Latitude                    : 36 deg 31' 39.13"
GPS Longitude Ref               : West
GPS Longitude                   : 6 deg 0' 0.00"
GPS Altitude                    : 0 metres
GPS Map Datum                   : WGS-84

I'm using a newer version of exiftool:

$ exiftool -ver
ExifTool version 6.40

I'm going to try to downgrade, just to see if it a problem in the new version.
Comment 25 Antonio E. 2006-09-16 10:40:08 UTC
I've downgraded exiftool and the problem persist.

exiftool -ver
ExifTool version 6.36

GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Latitude                    : 36 deg 31' 39.13"
GPS Longitude Ref               : West
GPS Longitude                   : 6 deg 0' 0.00"
GPS Altitude                    : 0 metres
GPS Map Datum                   : WGS-84

I'm really confused about what's the problem.

My awk version:

$ awk --version
GNU Awk 3.1.5
Comment 26 Antonio E. 2006-09-16 10:43:58 UTC
I've tried also the version 6.17, so I doubt that it's related with the exiftool version.
Comment 27 Gerhard Kulzer 2006-09-16 10:45:59 UTC
My awk version is the same 3.1.5
I also tried it on a jpg file just to be sure, and I get the same correct results.
Comment 28 Gerhard Kulzer 2006-09-16 10:52:26 UTC
I just saw that the problem must be in the awk part since your echo line gives already wrong coordinates: 36.527536, N, 6, W, test.jpg, , test.jpg
Comment 29 Antonio E. 2006-09-16 14:15:27 UTC
You gave me the hint to fix it.

I found that (for a reason that I don't understand) $1*-1.0 returns an integer instead of a float.

I have done a workaround that works perfectly. Instead of multiply by -1.0 just replace the '-' char with nothing if it has a negative value.

So, the lines:
lat=$(echo "$1" | awk '{if ($1 < 0) print $1*-1; else print $1}') #
lon=$(echo "$2" | awk '{if ($1 < 0) print $1*-1; else print $1}') #

are replaced with:
lat=$(echo "$1" | awk '{val = $1; if ($1 < 0) sub(/-/, "", val); print val}')
lon=$(echo "$2" | awk '{val = $1; if ($1 < 0) sub(/-/, "", val); print val}')

After doing it the coordinates are well taken for me.

exiftool-gps-wrapper 36.527924 -6.315497 100_3445.JPG
100_3445.JPG
36.527924, N, 6.315497, W, 100_3445.JPG, , 100_3445.JPG
    1 image files updated
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Latitude                    : 36 deg 31' 40.53"
GPS Longitude Ref               : West
GPS Longitude                   : 6 deg 18' 55.79"
GPS Altitude                    : 0 metres
GPS Map Datum                   : WGS-84

And now the maps have an acceptable accuracy.
Comment 30 Antonio E. 2006-09-16 14:17:02 UTC
Created attachment 17792 [details]
exiftool-gps-wrapper (fixed)

I've uploaded a new version of the script with the fix applied.
Comment 31 Gerhard Kulzer 2006-09-16 15:33:18 UTC
Ok it works for me as well - I put it into the documentation. 

My suspicion is that the field separators for awk might be different for you and me (and others). Can have to do with the language setting? Because it looks as if awk had taken the -6 of the -6.315207 on your machine.

Anyway, your solution seems the foolprove one.
Thanx a lot
Comment 32 caulier.gilles 2006-09-21 14:52:08 UTC
SVN commit 587073 by cgilles:

kipi-plugins from trunk : new plugin to synchronize pictures metadata with a GPS data file.

First beta version of GPSSync kipi-plugin is now available for testing.

To use it, you need a GPX xml file generated by your GPS device. The GPX file must be generated to render a wayspoints or trackpoints list.

If your GPS device do not support GPX, you can generate it using GPSBabel program like this :

# gpsbabel -w -i mapsource -f Driveback.mps -o gpx -F Driveback.gpx   

The plugin use the Exif time-stamp to correlate GPS data. Accuracy of 30s is used to diff camera and GPS time-stamp. Of course, the date of your GPS device and your camera must be set properly (:=))).

Some links:

GPSBalbel: http://www.gpsbabel.org
GPX file format: http://www.topografix.com/gpx.asp
Plugin in action: http://digikam3rdparty.free.fr/Screenshots/newkipigpssyncplugin.png

CCMAIL: kde-imaging@kde.org, digikam-devel@kde.org, digikam-users@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

BUG: 111560
CCBUGS: 133359

 M  +125 -34   gpsdataparser.cpp  
 M  +37 -6     gpsdataparser.h  
 M  +23 -5     gpslistviewitem.cpp  
 M  +3 -2      gpslistviewitem.h  
 M  +72 -45    gpssyncdialog.cpp  
 M  +9 -11     gpssyncdialog.h  
 M  +2 -1      plugin_gpssync.cpp  
Comment 33 caulier.gilles 2006-09-22 10:47:53 UTC
SVN commit 587310 by cgilles:

kipi-plugins from trunk : GPSSync tool : added new option to set the max gap time in seconds to synchronize pictures with GPS data. default value is 30s.

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +54 -11    gpssyncdialog.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #587309:587310
@@ -26,9 +26,8 @@
 #include <qvgroupbox.h>
 #include <qgrid.h>
 #include <qpushbutton.h>
-#include <qframe.h>
-#include <qimage.h>
 #include <qfileinfo.h>
+#include <qwhatsthis.h>
 
 // KDE includes.
 
@@ -37,6 +36,7 @@
 #include <kapplication.h>
 #include <kaboutdata.h>
 #include <khelpmenu.h>
+#include <ksqueezedtextlabel.h>
 #include <kiconloader.h>
 #include <kpopupmenu.h>
 #include <kstandarddirs.h>
@@ -45,6 +45,8 @@
 #include <kconfig.h>
 #include <kmessagebox.h>
 #include <kglobalsettings.h>
+#include <knuminput.h>
+#include <kseparator.h>
 
 // Local includes.
 
@@ -62,15 +64,24 @@
 
     GPSSyncDialogPriv()
     {
-        listView  = 0;
-        interface = 0;
+        listView       = 0;
+        interface      = 0;
+        maxGapInput    = 0;
+        gpxFileName    = 0;
+        gpxPointsLabel = 0;
     }
 
-    KListView       *listView;
+    QLabel             *gpxPointsLabel;
 
-    KIPI::Interface *interface;
+    KListView          *listView;
 
-    GPSDataParser    gpxParser;
+    KIntSpinBox        *maxGapInput;
+
+    KSqueezedTextLabel *gpxFileName;
+
+    KIPI::Interface    *interface;
+
+    GPSDataParser       gpxParser;
 };
 
 GPSSyncDialog::GPSSyncDialog( KIPI::Interface* interface, QWidget* parent)
@@ -96,7 +107,8 @@
     QLabel *pixmapLabelLeft = new QLabel( headerFrame, "pixmapLabelLeft" );
     pixmapLabelLeft->setScaledContents( false );
     layout->addWidget( pixmapLabelLeft );
-    QLabel *labelTitle = new QLabel( i18n("Syncronize Picture Metadata with a GPS Device"), headerFrame, "labelTitle" );
+    QLabel *labelTitle = new QLabel( i18n("Syncronize Picture Metadata with a GPS Device"),
+                                     headerFrame, "labelTitle" );
     layout->addWidget( labelTitle );
     layout->setStretchFactor( labelTitle, 1 );
 
@@ -125,9 +137,36 @@
     d->listView->setSelectionMode(QListView::Single);
     d->listView->setMinimumWidth(450);
 
-    mainLayout->addMultiCellWidget(headerFrame, 0, 0, 0, 1);
+    // ---------------------------------------------------------------
+
+    QWidget *settingsBox = new QGroupBox(0, Qt::Vertical, i18n("Settings"), plainPage());
+    QGridLayout* settingsBoxLayout = new QGridLayout(settingsBox->layout(), 5, 1,
+                                                     KDialog::spacingHint());
+
+    QLabel *gpxFileLabel = new QLabel(i18n("Current GPX file:"), settingsBox);
+    d->gpxFileName       = new KSqueezedTextLabel(i18n("No GPX file"), settingsBox);
+    d->gpxPointsLabel    = new QLabel(settingsBox);
+    KSeparator *line     = new KSeparator(Horizontal, settingsBox);
+
+    QLabel *maxGapLabel = new QLabel(i18n("Max gap time:"), settingsBox);
+    d->maxGapInput      = new KIntSpinBox(0, 2000, 1, 30, 10, settingsBox);
+    QWhatsThis::add(d->maxGapInput, i18n("<p>Set here the maximum distance in "
+                    "seconds from a GPS point that a photo will be matched."));
+
+    settingsBoxLayout->addMultiCellWidget(gpxFileLabel, 0, 0, 0, 1);     
+    settingsBoxLayout->addMultiCellWidget(d->gpxFileName, 1, 1, 0, 1);     
+    settingsBoxLayout->addMultiCellWidget(d->gpxPointsLabel, 2, 2, 0, 1);     
+    settingsBoxLayout->addMultiCellWidget(line, 3, 3, 0, 1);     
+    settingsBoxLayout->addMultiCellWidget(maxGapLabel, 4, 4, 0, 0); 
+    settingsBoxLayout->addMultiCellWidget(d->maxGapInput, 4, 4, 1, 1); 
+
+    // ---------------------------------------------------------------
+
+    mainLayout->addMultiCellWidget(headerFrame, 0, 0, 0, 2);
     mainLayout->addMultiCellWidget(d->listView, 1, 3, 0, 1);
-    mainLayout->setRowStretch(1, 10);
+    mainLayout->addMultiCellWidget(settingsBox, 1, 1, 2, 2);
+    mainLayout->setColStretch(1, 10);
+    mainLayout->setRowStretch(3, 10);
 
     // ---------------------------------------------------------------
     // About data and help button.
@@ -202,6 +241,8 @@
         return;
     }
 
+    d->gpxFileName->setText(loadGPXFile.fileName());
+    d->gpxPointsLabel->setText(i18n("Points parsed: %1").arg(d->gpxParser.numPoints()));
     enableButton(Apply, true);
     matchGPSAndPhoto();
 }
@@ -228,6 +269,7 @@
 {
     KConfig config("kipirc");
     config.setGroup("GPS Sync Settings");
+    d->maxGapInput->setValue(config.readNumEntry("Max Gap Time", 30));
 
     resize(configDialogSize(config, QString("GPS Sync Dialog")));
 }
@@ -236,6 +278,7 @@
 {
     KConfig config("kipirc");
     config.setGroup("GPS Sync Settings");
+    config.writeEntry("Max Gap Time", d->maxGapInput->value() );
 
     saveDialogSize(config, QString("GPS Sync Dialog"));
     config.sync();
@@ -250,7 +293,7 @@
     {
         GPSListViewItem *item = (GPSListViewItem*) it.current();
         double alt =0.0, lat=0.0, lng = 0.0;
-        if (d->gpxParser.parseDates(item->getDateTime(), 30, alt, lat, lng))
+        if (d->gpxParser.parseDates(item->getDateTime(), d->maxGapInput->value(), alt, lat, lng))
         {
             item->setGPSInfo(alt, lat, lng);
             itemsUpdated++;
Comment 34 caulier.gilles 2006-09-22 12:42:13 UTC
SVN commit 587322 by cgilles:

kipi-plugins from trunk : GPSSync tool : added new option to set camera time-zone in hours to match properly all pictures with GPS data using GMT time.

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +13 -3     gpsdataparser.cpp  
 M  +2 -1      gpsdataparser.h  
 M  +45 -2     gpssyncdialog.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpsdataparser.cpp #587321:587322
@@ -58,13 +58,23 @@
     return m_GPSDataMap.count();
 }
 
-bool GPSDataParser::parseDates(QDateTime dateTime, int averageSecs, double& alt, double& lat, double& lon)
+bool GPSDataParser::parseDates(QDateTime photoDateTime, int accuracySecs, int timeZone,
+                               double& alt, double& lat, double& lon)
 {
+    // GPS device are sync in time by satelite using GMT time.
+    // If the camera time is different than GMT time, we need to convert it to GMT time
+    // Using the time zone.
+    QDateTime cameraGMTDateTime = photoDateTime.addSecs(timeZone*3600*(-1));
+
     for (GPSDataMap::Iterator it = m_GPSDataMap.begin();
          it != m_GPSDataMap.end(); ++it )
     {
-        int nbSecs = abs(dateTime.secsTo( it.key() ));
-        if( nbSecs < averageSecs )
+        // Here we check a possible accuracy in seconds between the 
+        // Camera GMT time and the GPS device GMT time.
+        
+        int nbSecs = abs(cameraGMTDateTime.secsTo( it.key() ));
+        
+        if( nbSecs < accuracySecs )
         {
             GPSDataContainer data = m_GPSDataMap[it.key()];
             alt = data.altitude();
--- trunk/extragear/libs/kipi-plugins/gpssync/gpsdataparser.h #587321:587322
@@ -50,7 +50,8 @@
 
     void clear();
     int  numPoints();
-    bool parseDates(QDateTime dateTime, int averageSecs, double& alt, double& lat, double& lon);
+    bool parseDates(QDateTime photoDateTime, int accuracySecs, int timeZone, 
+                    double& alt, double& lat, double& lon);
 
 private:
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #587321:587322
@@ -21,6 +21,7 @@
 
 // Qt includes.
 
+#include <qcombobox.h>
 #include <qlayout.h>
 #include <qlabel.h>
 #include <qvgroupbox.h>
@@ -69,10 +70,13 @@
         maxGapInput    = 0;
         gpxFileName    = 0;
         gpxPointsLabel = 0;
+        timeZoneCB     = 0;
     }
 
     QLabel             *gpxPointsLabel;
 
+    QComboBox          *timeZoneCB;
+
     KListView          *listView;
 
     KIntSpinBox        *maxGapInput;
@@ -129,7 +133,7 @@
     d->listView->addColumn( i18n("Latitude") );
     d->listView->addColumn( i18n("Longitude") );
     d->listView->addColumn( i18n("Date") );
-    d->listView->addColumn( i18n("Extrapoled") );
+    d->listView->addColumn( i18n("Status") );
     d->listView->setResizeMode(QListView::AllColumns);
     d->listView->setAllColumnsShowFocus(true);
     d->listView->setSorting(-1);
@@ -153,12 +157,45 @@
     QWhatsThis::add(d->maxGapInput, i18n("<p>Set here the maximum distance in "
                     "seconds from a GPS point that a photo will be matched."));
 
+    QLabel *timeZoneLabel = new QLabel(i18n("Time zone:"), settingsBox);
+    d->timeZoneCB         = new QComboBox( false, settingsBox );
+    d->timeZoneCB->insertItem(i18n("-12"), 0);
+    d->timeZoneCB->insertItem(i18n("-11"), 1);
+    d->timeZoneCB->insertItem(i18n("-10"), 2);
+    d->timeZoneCB->insertItem(i18n("-9"),  3);
+    d->timeZoneCB->insertItem(i18n("-8"),  4);
+    d->timeZoneCB->insertItem(i18n("-7"),  5);
+    d->timeZoneCB->insertItem(i18n("-6"),  6);
+    d->timeZoneCB->insertItem(i18n("-5"),  7);
+    d->timeZoneCB->insertItem(i18n("-4"),  8);
+    d->timeZoneCB->insertItem(i18n("-3"),  9);
+    d->timeZoneCB->insertItem(i18n("-2"),  10);
+    d->timeZoneCB->insertItem(i18n("-1"),  11);
+    d->timeZoneCB->insertItem(i18n("GMT"), 12);
+    d->timeZoneCB->insertItem(i18n("+1"),  13);
+    d->timeZoneCB->insertItem(i18n("+2"),  14);
+    d->timeZoneCB->insertItem(i18n("+3"),  15);
+    d->timeZoneCB->insertItem(i18n("+4"),  16);
+    d->timeZoneCB->insertItem(i18n("+5"),  17);
+    d->timeZoneCB->insertItem(i18n("+6"),  18);
+    d->timeZoneCB->insertItem(i18n("+7"),  19);
+    d->timeZoneCB->insertItem(i18n("+8"),  20);
+    d->timeZoneCB->insertItem(i18n("+9"),  21);
+    d->timeZoneCB->insertItem(i18n("+10"), 22);
+    d->timeZoneCB->insertItem(i18n("+11"), 23);
+    d->timeZoneCB->insertItem(i18n("+12"), 24);
+    QWhatsThis::add(d->timeZoneCB, i18n("<p>Set here the time zone where the "
+                    "pictures were taken in, so that the times of the pictures "
+                    "can be adjusted to match the GPS data"));
+
     settingsBoxLayout->addMultiCellWidget(gpxFileLabel, 0, 0, 0, 1);     
     settingsBoxLayout->addMultiCellWidget(d->gpxFileName, 1, 1, 0, 1);     
     settingsBoxLayout->addMultiCellWidget(d->gpxPointsLabel, 2, 2, 0, 1);     
     settingsBoxLayout->addMultiCellWidget(line, 3, 3, 0, 1);     
     settingsBoxLayout->addMultiCellWidget(maxGapLabel, 4, 4, 0, 0); 
     settingsBoxLayout->addMultiCellWidget(d->maxGapInput, 4, 4, 1, 1); 
+    settingsBoxLayout->addMultiCellWidget(timeZoneLabel, 5, 5, 0, 0); 
+    settingsBoxLayout->addMultiCellWidget(d->timeZoneCB, 5, 5, 1, 1); 
 
     // ---------------------------------------------------------------
 
@@ -270,6 +307,7 @@
     KConfig config("kipirc");
     config.setGroup("GPS Sync Settings");
     d->maxGapInput->setValue(config.readNumEntry("Max Gap Time", 30));
+    d->timeZoneCB->setCurrentItem(config.readNumEntry("Time Zone", 12));
 
     resize(configDialogSize(config, QString("GPS Sync Dialog")));
 }
@@ -279,6 +317,7 @@
     KConfig config("kipirc");
     config.setGroup("GPS Sync Settings");
     config.writeEntry("Max Gap Time", d->maxGapInput->value() );
+    config.writeEntry("Time Zone", d->timeZoneCB->currentItem() );
 
     saveDialogSize(config, QString("GPS Sync Dialog"));
     config.sync();
@@ -293,7 +332,11 @@
     {
         GPSListViewItem *item = (GPSListViewItem*) it.current();
         double alt =0.0, lat=0.0, lng = 0.0;
-        if (d->gpxParser.parseDates(item->getDateTime(), d->maxGapInput->value(), alt, lat, lng))
+
+        if (d->gpxParser.parseDates(item->getDateTime(), 
+                                    d->maxGapInput->value(),
+                                    d->timeZoneCB->currentItem()-12,
+                                    alt, lat, lng))
         {
             item->setGPSInfo(alt, lat, lng);
             itemsUpdated++;
Comment 35 Antonio E. 2006-09-22 12:53:59 UTC
I've just installed it. It's going to be really useful for people with gps devices. But for people without it, it would be also good to have an option (probably in the same dialog) to just enter the manually the latitude, longitude and altitude (not associated to any time) for the selected pictures, without needing to load a gpx file for each picture. I think that it will not overload the interface. But, anyways, great progress!
Comment 36 Gerhard Kulzer 2006-09-22 14:12:56 UTC
Am Freitag, 22. September 2006 12:54 schrieb Antonio E.:
[bugs.kde.org quoted mail]
Well for this you still can use the exiftool-gps-wrapper script from the 
documentation. But you need to have exiftool installed!
Gerhard
Comment 37 caulier.gilles 2006-09-22 14:18:04 UTC
Antonio,

I'm not sure if the GPSSync plugin is the right place to a manual GPS position editing.

This plugin is dedicaced to synchronize only pictures metadata with a GPX file.

I think it can be confuse to have a manual GPS position editing in the plugin. We can do it directly in digiKam, to select a picture and use the Metadata/GPS sidebar tab. We must add a new button in this area to set the GPS position value.

Your viewpoints please...

Gilles Caulier
Comment 38 Julien Narboux 2006-09-22 14:23:02 UTC
I agree with you Gilles.

My 2 cents

Julien
Comment 39 caulier.gilles 2006-09-22 15:11:38 UTC
SVN commit 587348 by cgilles:

kipi-plugins from trunk : GPSSync tool : added new option to interpolate GPS positions.

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +93 -99    gpsdataparser.cpp  
 M  +6 -4      gpsdataparser.h  
 M  +31 -11    gpslistviewitem.cpp  
 M  +3 -1      gpslistviewitem.h  
 M  +46 -23    gpssyncdialog.cpp  
 M  +1 -1      gpssyncdialog.h  
Comment 40 caulier.gilles 2006-09-22 15:17:12 UTC
Hey guy !

I don't have a GPS device to test. Interpolation method is just implemented, not tested indeep.

Gerhard, i have used your algorithm to compute interpolated GPS positions. Take a look into  GPSDataParser::matchDate() method from gpsdataparser.cpp :

http://websvn.kde.org/trunk/extragear/libs/kipi-plugins/gpssync/gpsdataparser.cpp?rev=587348&view=auto

Please give me a feedback. Thanks in advance

Gilles

Comment 41 caulier.gilles 2006-09-22 15:25:30 UTC
A fresh screenshot of the plugin :

http://digikam3rdparty.free.fr/Screenshots/newkipigpssyncplugin.png

Gilles
Comment 42 Julien Narboux 2006-09-22 15:43:38 UTC
I did not test, I just read the code. 
Why not use the same interpolation formula for the altitude ?

Julien
Comment 43 caulier.gilles 2006-09-22 15:50:16 UTC
This is have a sence to interpolate altitude value ? 

If yes, well why not (:=))). it just  3 source code lines to add...

Gilles
Comment 44 Julien Narboux 2006-09-22 16:02:00 UTC
The same meaning as interpolating longitiude and latitude I guess. It is just a third dimension in a special coordinate system.

We assume that I you are at sea level at 12 oclock and your are at 1000m high at 12:30 then you may be at 500 at 12:15...  Of course it may be false, but the same applies to latitude and longitude.

In the future the interpolation could be improved by taking into account more than two points. But it is more complicated and imho not needed.
What I mean by taking into account more that two points is to compute a nice curve going through the points (a spline for instance) and then interpolate on this spline. 

Julien
Comment 45 caulier.gilles 2006-09-22 16:39:14 UTC
SVN commit 587368 by cgilles:

kipi-plugins from trunk : GPSSync tool : interpolate altitude value like latitude and longitude.

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +3 -1      gpsdataparser.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpsdataparser.cpp #587367:587368
@@ -104,9 +104,11 @@
             GPSDataContainer prevGPSPoint = m_GPSDataMap[prevDateTime];
             GPSDataContainer nextGPSPoint = m_GPSDataMap[nextDateTime];
 
+            double alt1 = prevGPSPoint.altitude();
             double lon1 = prevGPSPoint.longitude();
             double lat1 = prevGPSPoint.latitude();
             uint   t1   = prevDateTime.toTime_t();
+            double alt2 = nextGPSPoint.altitude();
             double lon2 = nextGPSPoint.longitude();
             double lat2 = nextGPSPoint.latitude();
             uint   t2   = nextDateTime.toTime_t();
@@ -114,7 +116,7 @@
 
             if (t3-t1 != 0)  
             {
-                alt = 0.0;    // We cannot interpolate altitude.
+                alt = alt1 + (alt2-alt1) * (t2-t1)/(t3-t1);
                 lat = lat1 + (lat2-lat1) * (t2-t1)/(t3-t1);
                 lon = lon1 + (lon2-lon1) * (t2-t1)/(t3-t1);
                 isInterpolated = true;    
Comment 46 caulier.gilles 2006-09-25 08:44:58 UTC
SVN commit 588154 by cgilles:

kipi-plugins from trunk : GPSSync tool : new option to set the maximum distance time in minutes to get matched points from GPX file around a GPS point to interpolate.

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +27 -2     gpssyncdialog.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #588153:588154
@@ -73,9 +73,12 @@
         gpxPointsLabel = 0;
         timeZoneCB     = 0;
         interpolateBox = 0;
+        maxTimeInput   = 0;
+        maxTimeLabel   = 0;
     }
 
     QLabel             *gpxPointsLabel;
+    QLabel             *maxTimeLabel;
 
     QComboBox          *timeZoneCB;
 
@@ -84,6 +87,7 @@
     KListView          *listView;
 
     KIntSpinBox        *maxGapInput;
+    KIntSpinBox        *maxTimeInput;
 
     KSqueezedTextLabel *gpxFileName;
 
@@ -149,7 +153,7 @@
     // ---------------------------------------------------------------
 
     QWidget *settingsBox = new QGroupBox(0, Qt::Vertical, i18n("Settings"), plainPage());
-    QGridLayout* settingsBoxLayout = new QGridLayout(settingsBox->layout(), 7, 1,
+    QGridLayout* settingsBoxLayout = new QGridLayout(settingsBox->layout(), 8, 1,
                                                      KDialog::spacingHint());
 
     QPushButton *loadGPXButton = new QPushButton(i18n("Load GPX File..."), settingsBox);
@@ -202,6 +206,11 @@
     QWhatsThis::add(d->interpolateBox, i18n("<p>Set on this option to interpolate GPS points "
                     "witch are not matches properly with the GPX data file."));
 
+    d->maxTimeLabel = new QLabel(i18n("Max. distance time:"), settingsBox);
+    d->maxTimeInput = new KIntSpinBox(0, 240, 1, 15, 10, settingsBox);
+    QWhatsThis::add(d->maxTimeInput, i18n("<p>Set here the maximum distance time in minutes "
+                    "to get matched points from GPX file around a GPS point to interpolate."));
+
     settingsBoxLayout->addMultiCellWidget(loadGPXButton, 0, 0, 0, 1);     
     settingsBoxLayout->addMultiCellWidget(gpxFileLabel, 1, 1, 0, 1);     
     settingsBoxLayout->addMultiCellWidget(d->gpxFileName, 2, 2, 0, 1);     
@@ -212,6 +221,8 @@
     settingsBoxLayout->addMultiCellWidget(timeZoneLabel, 6, 6, 0, 0); 
     settingsBoxLayout->addMultiCellWidget(d->timeZoneCB, 6, 6, 1, 1); 
     settingsBoxLayout->addMultiCellWidget(d->interpolateBox, 7, 7, 0, 1); 
+    settingsBoxLayout->addMultiCellWidget(d->maxTimeLabel, 8, 8, 0, 0); 
+    settingsBoxLayout->addMultiCellWidget(d->maxTimeInput, 8, 8, 1, 1); 
 
     // ---------------------------------------------------------------
 
@@ -242,6 +253,14 @@
                                  this, SLOT(slotHelp()), 0, -1, 0);
     actionButton(Help)->setPopup( helpMenu->menu() );
 
+    // ---------------------------------------------------------------
+
+    connect(d->interpolateBox, SIGNAL(toggled(bool)),
+            d->maxTimeLabel, SLOT(setEnabled(bool)));
+
+    connect(d->interpolateBox, SIGNAL(toggled(bool)),
+            d->maxTimeInput, SLOT(setEnabled(bool)));
+
     readSettings();
 }
 
@@ -326,6 +345,10 @@
     d->maxGapInput->setValue(config.readNumEntry("Max Gap Time", 30));
     d->timeZoneCB->setCurrentItem(config.readNumEntry("Time Zone", 12));
     d->interpolateBox->setChecked(config.readBoolEntry("Interpolate", false));
+    d->maxTimeInput->setValue(config.readNumEntry("Max Inter Dist Time", 15));
+    
+    d->maxTimeLabel->setEnabled(d->interpolateBox->isChecked());
+    d->maxTimeInput->setEnabled(d->interpolateBox->isChecked());
     resize(configDialogSize(config, QString("GPS Sync Dialog")));
 }
 
@@ -336,6 +359,7 @@
     config.writeEntry("Max Gap Time", d->maxGapInput->value() );
     config.writeEntry("Time Zone", d->timeZoneCB->currentItem() );
     config.writeEntry("Interpolate", d->interpolateBox->isChecked() );
+    config.writeEntry("Max Inter Dist Time", d->maxTimeInput->value() );
     saveDialogSize(config, QString("GPS Sync Dialog"));
     config.sync();
 }
@@ -355,7 +379,8 @@
                                    d->maxGapInput->value(),
                                    d->timeZoneCB->currentItem()-12,
                                    d->interpolateBox->isChecked(),
-                                   600, gpsData))
+                                   d->maxTimeInput->value(), 
+                                   gpsData))
         {
             item->setGPSInfo(gpsData);
             itemsUpdated++;
Comment 47 caulier.gilles 2006-09-25 14:54:48 UTC
SVN commit 588251 by cgilles:

kipi-plugins from trunk : GPSSync tool : 

- New options :
   * to set GPS coordinates manually.
   * to remove all GPS info from file.

- Bug fix (relevant of EXIV2 library ?) : we need to clean up all GPS info from file before to rewrite it. 
Andreas, i have seen that if a picture has already GPS infos, if i don't process a clean up of all Exif.GPSInfo tags, 
the lattitude and altitude values are set to 0.

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net, ahuggel@gmx.net

CCBUGS: 133359, 111560

 M  +1 -1      Makefile.am  
 A             gpseditdialog.cpp   [License: GPL]
 A             gpseditdialog.h   [License: GPL]
 M  +39 -8     gpslistviewitem.cpp  
 M  +3 -1      gpslistviewitem.h  
 M  +31 -10    gpssyncdialog.cpp  
 M  +7 -0      gpssyncdialog.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/Makefile.am #588250:588251
@@ -10,7 +10,7 @@
 
 # Srcs for the plugin
 kipiplugin_gpssync_la_SOURCES = plugin_gpssync.cpp gpssyncdialog.cpp gpslistviewitem.cpp \
-	                            gpsbabelbinary.cpp gpsdataparser.cpp 
+	                            gpsbabelbinary.cpp gpsdataparser.cpp gpseditdialog.cpp 
 
 # Libs needed by the plugin
 kipiplugin_gpssync_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \
--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.cpp #588250:588251
@@ -44,12 +44,14 @@
 
     GPSListViewItemPriv()
     {
-        enabled        = false;
-        dirty          = false;
+        enabled = false;
+        dirty   = false;
+        erase   = false;
     }
 
     bool             enabled;
     bool             dirty;
+    bool             erase;
 
     QDateTime        date;
 
@@ -86,7 +88,7 @@
     delete d;
 }
 
-void GPSListViewItem::setGPSInfo(GPSDataContainer gpsData, bool dirty)
+void GPSListViewItem::setGPSInfo(GPSDataContainer gpsData, bool dirty, bool addedManually)
 {
     d->dirty   = dirty;
     d->gpsData = gpsData;
@@ -100,7 +102,12 @@
         if (d->gpsData.isInterpolated())
             status = i18n("Interpolated");
         else
-            status = i18n("Found");
+        {
+            if (addedManually)
+                status = i18n("Added");
+            else
+                status = i18n("Found");
+        }
     }
     setText(6, status);
 
@@ -147,10 +154,13 @@
     {
         setPixmap(1, SmallIcon("run"));
         KIPIPlugins::Exiv2Iface exiv2Iface;
-        exiv2Iface.load(d->url.path());
-        bool ret = exiv2Iface.setGPSInfo(d->gpsData.altitude(), 
-                                         d->gpsData.latitude(), 
+        bool ret = exiv2Iface.load(d->url.path());
+        ret &= exiv2Iface.removeGPSInfo();
+        if (!d->erase)
+        {
+            ret &= exiv2Iface.setGPSInfo(d->gpsData.altitude(), d->gpsData.latitude(), 
                                          d->gpsData.longitude());
+        }
         ret &= exiv2Iface.save(d->url.path());
         if (ret)
             setPixmap(1, SmallIcon("ok"));
@@ -175,11 +185,24 @@
     return d->dirty;
 }
 
+void GPSListViewItem::eraseGPSInfo(bool e)
+{
+    d->erase = e;
+    d->dirty = true;
+
+    if (e)
+        setText(6, i18n("Deleted!"));
+    else 
+        setText(6, "");
+
+    repaint();
+}
+
 void GPSListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
 {
     if (d->enabled)
     {
-        if ( isDirty() && column >=2  && column <=4 )
+        if ( isDirty() && !d->erase && column >= 2  && column <= 4 )
         {
             QColorGroup _cg( cg );
             QColor c = _cg.text();
@@ -187,6 +210,14 @@
             KListViewItem::paintCell( p, _cg, column, width, alignment );
             _cg.setColor( QColorGroup::Text, c );
         }
+        else if ( isDirty() && d->erase && column == 6)
+        {
+            QColorGroup _cg( cg );
+            QColor c = _cg.text();
+            _cg.setColor( QColorGroup::Text, Qt::red );
+            KListViewItem::paintCell( p, _cg, column, width, alignment );
+            _cg.setColor( QColorGroup::Text, c );
+        }
         else
             KListViewItem::paintCell(p, cg, column, width, alignment);
     }
--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.h #588250:588251
@@ -55,9 +55,11 @@
     GPSListViewItem(KListView *view, QListViewItem *after, const KURL& url);
     ~GPSListViewItem();
 
-    void setGPSInfo(GPSDataContainer gpsData, bool dirty=true);
+    void setGPSInfo(GPSDataContainer gpsData, bool dirty=true, bool addedManually=false);
     GPSDataContainer getGPSInfo();
+    void eraseGPSInfo(bool e);
 
+
     void setDateTime(QDateTime date);
     QDateTime getDateTime();
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #588250:588251
@@ -54,6 +54,7 @@
 
 #include "gpslistviewitem.h"
 #include "pluginsversion.h"
+#include "gpseditdialog.h"
 #include "gpssyncdialog.h"
 #include "gpssyncdialog.moc"
 
@@ -98,15 +99,16 @@
 
 GPSSyncDialog::GPSSyncDialog( KIPI::Interface* interface, QWidget* parent)
              : KDialogBase(Plain, i18n("GPS Sync"), 
-                           Help|User1|Apply|Close, Close, 
+                           Help|User1|User2|Apply|Close, Close, 
                            parent, 0, true, true )
 {
     d = new GPSSyncDialogPriv;
     d->interface = interface;
 
     setButtonText(User1, i18n("Correlate"));
-    enableButton(Apply, false);
+    setButtonText(User2, i18n("Edit Coordinates..."));
     enableButton(User1, false);
+    enableButton(User2, true);
 
     QGridLayout *mainLayout = new QGridLayout(plainPage(), 3, 1, 0, marginHint());
 
@@ -158,9 +160,6 @@
 
     QPushButton *loadGPXButton = new QPushButton(i18n("Load GPX File..."), settingsBox);
 
-    connect(loadGPXButton, SIGNAL(pressed()),
-            this, SLOT(slotLoadGPXFile()));
-
     QLabel *gpxFileLabel = new QLabel(i18n("Current GPX file:"), settingsBox);
     d->gpxFileName       = new KSqueezedTextLabel(i18n("No GPX file"), settingsBox);
     d->gpxPointsLabel    = new QLabel(settingsBox);
@@ -255,6 +254,9 @@
 
     // ---------------------------------------------------------------
 
+    connect(loadGPXButton, SIGNAL(pressed()),
+            this, SLOT(slotLoadGPXFile()));
+
     connect(d->interpolateBox, SIGNAL(toggled(bool)),
             d->maxTimeLabel, SLOT(setEnabled(bool)));
 
@@ -299,7 +301,6 @@
     {
         KMessageBox::error(this, i18n("Cannot parse %1 GPX file!")
                            .arg(loadGPXFile.fileName()), i18n("GPS Sync"));    
-        enableButton(Apply, false);
         enableButton(User1, false);
         return;
     }
@@ -308,14 +309,12 @@
     {
         KMessageBox::sorry(this, i18n("The %1 GPX file do not have a date-time track to use!")
                            .arg(loadGPXFile.fileName()), i18n("GPS Sync"));    
-        enableButton(Apply, false);
         enableButton(User1, false);
         return;
     }
 
     d->gpxFileName->setText(loadGPXFile.fileName());
     d->gpxPointsLabel->setText(i18n("Points parsed: %1").arg(d->gpxParser.numPoints()));
-    enableButton(Apply, true);
     enableButton(User1, true);
     slotUser1();
 }
@@ -392,7 +391,6 @@
     {
         KMessageBox::sorry(this, i18n("Cannot find pictures to correlate with GPX file data."),
                            i18n("GPS Sync"));    
-        enableButton(Apply, false);
         return;
     }
 
@@ -400,9 +398,32 @@
                              "the list using the GPX data file.\n"
                              "Press Apply button to update picture(s) metadata.")
                              .arg(itemsUpdated), i18n("GPS Sync"));    
-    enableButton(Apply, true);
 }
 
+// Launch the GPS coordinates editor.
+void GPSSyncDialog::slotUser2()
+{
+    if (!d->listView->currentItem())
+    {
+        KMessageBox::information(this, i18n("Please, select a picture from "
+                     "the list to edit GPS coordinate manually."), i18n("GPS Sync"));    
+        return;
+    }
+
+    GPSListViewItem* item = (GPSListViewItem*)d->listView->currentItem();
+
+    GPSEditDialog dlg(this, item->getGPSInfo(), item->getUrl().fileName());
+    switch (dlg.exec())
+    {
+        case KDialogBase::Accepted:
+            item->setGPSInfo(dlg.getGPSInfo(), true, true);
+        break;
+        case(-1):   // Erase all GPS tags
+            item->eraseGPSInfo(true);
+        break;
+    }
+}
+
 void GPSSyncDialog::slotApply()
 {
     QListViewItemIterator it( d->listView );
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.h #588250:588251
@@ -35,8 +35,11 @@
 
 #include "gpsdataparser.h"
 
+class QListViewItem;
+
 namespace KIPIGPSSyncPlugin
 {
+
 class GPSSyncDialogPriv;
 
 class GPSSyncDialog :public KDialogBase 
@@ -60,6 +63,10 @@
     void slotHelp();
     void slotClose();
     void slotUser1();
+    void slotUser2();
+
+private slots:
+
     void slotLoadGPXFile(); 
 
 private:
Comment 48 caulier.gilles 2006-09-25 16:28:09 UTC
SVN commit 588294 by cgilles:

kipi-plugins from trunk : GPSSync tool : add links to external web tools to get GPS coordinate. First one is CapeLinks web site...

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +45 -3     gpseditdialog.cpp  
 M  +1 -0      gpseditdialog.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #588293:588294
@@ -22,6 +22,8 @@
 
 #include <qlabel.h>
 #include <qlayout.h>
+#include <qcombobox.h>
+#include <qpushbutton.h>
 
 // KDE includes.
 
@@ -44,13 +46,25 @@
 
 public:
 
+    enum WebGPSLocator
+    {
+        CapeLinks = 0
+        // TODO : Added here others web GPS coordinates locator
+    };
+
     GPSEditDialogDialogPrivate()
     {
         altitudeInput  = 0;
         latitudeInput  = 0;
         longitudeInput = 0;
+        gpsButton      = 0;
+        gpsCombo       = 0;
     }
 
+    QPushButton    *gpsButton;
+
+    QComboBox      *gpsCombo;
+
     KDoubleSpinBox *altitudeInput;
     KDoubleSpinBox *latitudeInput;
     KDoubleSpinBox *longitudeInput;
@@ -67,7 +81,7 @@
     setHelp("gpssync", "kipi-plugins");
     setButtonText(User1, i18n("Delete"));
 
-    QGridLayout* grid = new QGridLayout(plainPage(), 2, 1, 0, spacingHint());
+    QGridLayout* grid = new QGridLayout(plainPage(), 3, 1, 0, spacingHint());
 
     QLabel *altitudeLabel  = new QLabel(i18n("Altitude:"), plainPage());
     QLabel *latitudeLabel  = new QLabel(i18n("Latitude:"), plainPage());
@@ -76,19 +90,29 @@
     d->latitudeInput       = new KDoubleSpinBox(plainPage());
     d->longitudeInput      = new KDoubleSpinBox(plainPage());
     d->altitudeInput->setRange(-20000.0, 20000.0, 1.0, 1);
-    d->latitudeInput->setRange(-90.0, 90.0, 1E-6, 8);
-    d->longitudeInput->setRange(-180.0, 180.0, 1E-6, 8);
+    d->latitudeInput->setRange(-90.0, 90.0, 1E-6, 6);
+    d->longitudeInput->setRange(-180.0, 180.0, 1E-6, 6);
     d->altitudeInput->setValue(gpsData.altitude());
     d->latitudeInput->setValue(gpsData.latitude());
     d->longitudeInput->setValue(gpsData.longitude());
 
+    d->gpsCombo  = new QComboBox( false, plainPage() );
+    d->gpsButton = new QPushButton(i18n("Get GPS Coordinates..."), plainPage());
+    d->gpsCombo->insertItem(QString("Capelinks"), GPSEditDialogDialogPrivate::CapeLinks);
+    // TODO : Added here others web GPS coordinates locator
+    
     grid->addMultiCellWidget(altitudeLabel, 0, 0, 0, 0);
     grid->addMultiCellWidget(latitudeLabel, 1, 1, 0, 0);
     grid->addMultiCellWidget(longitudeLabel, 2, 2, 0, 0);
     grid->addMultiCellWidget(d->altitudeInput, 0, 0, 1, 1);
     grid->addMultiCellWidget(d->latitudeInput, 1, 1, 1, 1);
     grid->addMultiCellWidget(d->longitudeInput, 2, 2, 1, 1);
+    grid->addMultiCellWidget(d->gpsCombo, 3, 3, 0, 0 );
+    grid->addMultiCellWidget(d->gpsButton, 3, 3, 1, 1 );
 
+    connect(d->gpsButton, SIGNAL(clicked()),
+            this, SLOT(slotGPSLocator()));
+
     adjustSize();
 }
 
@@ -110,4 +134,22 @@
     done(-1);
 }
 
+void GPSEditDialog::slotGPSLocator()
+{
+    QString val, url;
+
+    switch( d->gpsCombo->currentItem() )
+    {
+        case GPSEditDialogDialogPrivate::CapeLinks:
+        {
+            url.append("http://www.capelinks.com/cape-cod/maps/gps");
+            break;
+        }
+
+        // TODO : Added here others web GPS coordinates locator
+    }
+    
+    KApplication::kApplication()->invokeBrowser(url);
+}
+
 }  // namespace KIPIGPSSyncPlugin
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #588293:588294
@@ -49,6 +49,7 @@
 protected slots:
 
     void slotUser1();
+    void slotGPSLocator();
 
 private:
 
Comment 49 caulier.gilles 2006-09-25 16:30:43 UTC
Fresh screenshot of GPSSync kipi-plugin updated : 
 
 http://digikam3rdparty.free.fr/Screenshots/newkipigpssyncplugin.png 
 
 I'm waiting new GPS coordinates locator urls... 
 
 Gilles Caulier 
Comment 50 Antonio E. 2006-09-25 20:01:52 UTC
The screenshot is really nice. It's getting a really cool feature.

I can't compile the lastest trunk from today at 19:00. I get this:

if /bin/sh ../../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../libkipi/libkipi -I../../kipi-plugins/common/include -I../../kipi-plugins/common/exiv2iface -I../../libkipi -I../../libkipi -I/usr/kde/3.5/include -I/usr/qt/3/include -I.   -DQT_THREAD_SUPPORT  -D_REENTRANT  -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -O2 -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -MT plugin_gpssync.lo -MD -MP -MF ".deps/plugin_gpssync.Tpo" -c -o plugin_gpssync.lo plugin_gpssync.cpp; \
then mv -f ".deps/plugin_gpssync.Tpo" ".deps/plugin_gpssync.Plo"; else rm -f ".deps/plugin_gpssync.Tpo"; exit 1; fi
gpsdatacontainer.h:43: error: extra qualification 'KIPIGPSSyncPlugin::GPSDataContainer::' on member 'operator='
make: *** [plugin_gpssync.lo] Error 1
Comment 51 caulier.gilles 2006-09-25 20:24:00 UTC
Antonio,

Broken compilation with gcc 4.1 is now fixed on svn. Please try again

Gilles
Comment 52 Antonio E. 2006-09-26 00:34:17 UTC
Thanks Gilles. I've tried it and now it compiles fine.

I found a problem entering manually the coordinates:

The format that seems to use the spinners is 0,######, which means only 6 decimal digits. In the capelinks web we can get more accurated coordinates, like for example: Latitude: 41.95949009892464, Longitude: -70.3619384765625.

Now if I try to enter a value with that amount of decimal numbers the spinner doesn't work, as it just go back to the previous valid value (of 6 decimal digits) when I press enter. It doesn't even round the value. Probably the editor should use a smaller step size: 0.0000000000001

I don't know if can be done, but it could be good if when the get gps coordinates button is hit, the map could be opened in the coordinates that are edited if they exist, and if the doesn't just opened in the last validated coordinates. It's just an idea.

It's getting really nice Gilles. Thank you ;-).
Comment 53 caulier.gilles 2006-09-26 07:32:58 UTC
Yes, Antonio, i have already this problem in my minds. The plugin need to be polished again (:=))

About the Capelinks (google map in fact) links, this is what i would to do : i not satisfied by the way to copy and paste the coordinate between konqueror and the plugin. A better way is to run the google map script into the plugin and capture automaticly the values returned by google.

I'm not sure if we can do it using google maps api. Normally, the script need to be hosted in a web site, not an application. 

The only thing that i can do (i think) is to embbed the konqueror session in the dialog with start an external window)

If somebody have a better idea, let's me hear.

Gilles
Comment 54 caulier.gilles 2006-09-26 10:54:48 UTC
SVN commit 588502 by cgilles:

kipi-plugins from trunk : GPSSync tool : to be able to set GPS info in pictures if time stamp is not available and if user set GPS coordinate manually

CCMAIL: kde-imaging@kde.org, alexios.beveratos@gmail.com, gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +4 -4      gpslistviewitem.cpp  
 M  +0 -1      gpslistviewitem.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.cpp #588501:588502
@@ -74,8 +74,8 @@
     exiv2Iface.load(d->url.path());
     setDateTime(exiv2Iface.getImageDateTime());
     double alt, lat, lng;
-    exiv2Iface.getGPSInfo(alt, lat, lng);
-    setGPSInfo(GPSDataContainer(alt, lat, lng, false), false);
+    if (exiv2Iface.getGPSInfo(alt, lat, lng))
+        setGPSInfo(GPSDataContainer(alt, lat, lng, false), false);
 
     KIO::PreviewJob* thumbnailJob = KIO::filePreview(url, 64);
 
@@ -90,6 +90,7 @@
 
 void GPSListViewItem::setGPSInfo(GPSDataContainer gpsData, bool dirty, bool addedManually)
 {
+    setEnabled(true);
     d->dirty   = dirty;
     d->gpsData = gpsData;
     setText(2, QString::number(d->gpsData.altitude()));
@@ -123,7 +124,6 @@
 {
     if (date.isValid())
     {
-        setEnabled(true);
         d->date = date;
         setText(5, date.toString(Qt::ISODate));
     }
@@ -202,7 +202,7 @@
 
 void GPSListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
 {
-    if (d->enabled)
+    if (isEnabled())
     {
         if ( isDirty() && !d->erase && column >= 2  && column <= 4 )
         {
--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.h #588501:588502
@@ -59,7 +59,6 @@
     GPSDataContainer getGPSInfo();
     void eraseGPSInfo(bool e);
 
-
     void setDateTime(QDateTime date);
     QDateTime getDateTime();
 
Comment 55 caulier.gilles 2006-09-26 11:15:50 UTC
SVN commit 588511 by cgilles:

kipi-plugins from trunk : GPSSync tool : added mapki link
CCMAIL: gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +10 -1     gpseditdialog.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #588510:588511
@@ -48,7 +48,8 @@
 
     enum WebGPSLocator
     {
-        CapeLinks = 0
+        CapeLinks = 0,
+        MapKi
         // TODO : Added here others web GPS coordinates locator
     };
 
@@ -99,6 +100,8 @@
     d->gpsCombo  = new QComboBox( false, plainPage() );
     d->gpsButton = new QPushButton(i18n("Get GPS Coordinates..."), plainPage());
     d->gpsCombo->insertItem(QString("Capelinks"), GPSEditDialogDialogPrivate::CapeLinks);
+    d->gpsCombo->insertItem(QString("MapKi"), GPSEditDialogDialogPrivate::MapKi);
+
     // TODO : Added here others web GPS coordinates locator
     
     grid->addMultiCellWidget(altitudeLabel, 0, 0, 0, 0);
@@ -146,6 +149,12 @@
             break;
         }
 
+        case GPSEditDialogDialogPrivate::MapKi:
+        {
+            url.append("http://mapki.com/getLonLat.php");
+            break;
+        }
+
         // TODO : Added here others web GPS coordinates locator
     }
     
Comment 56 caulier.gilles 2006-09-26 13:38:00 UTC
SVN commit 588569 by cgilles:

kipi-plugins from trunk : GPSSync tool : improve GPS position editor dialog with a better precision. Don't use a KDoubleNumInput widget but a KLineEdit instead to be able to cut and paste easily position coordinate from konqueror. Added buttons to clear GPS position entries.

CCMAIL: gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +70 -21    gpseditdialog.cpp  
 M  +1 -0      gpseditdialog.h  
 M  +3 -3      gpslistviewitem.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #588568:588569
@@ -24,6 +24,7 @@
 #include <qlayout.h>
 #include <qcombobox.h>
 #include <qpushbutton.h>
+#include <qvalidator.h>
 
 // KDE includes.
 
@@ -31,7 +32,8 @@
 #include <kdebug.h>
 #include <kiconloader.h>
 #include <kapplication.h>
-#include <knuminput.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
 
 // Local includes.
 
@@ -62,13 +64,13 @@
         gpsCombo       = 0;
     }
 
-    QPushButton    *gpsButton;
+    QPushButton *gpsButton;
 
-    QComboBox      *gpsCombo;
+    QComboBox   *gpsCombo;
 
-    KDoubleSpinBox *altitudeInput;
-    KDoubleSpinBox *latitudeInput;
-    KDoubleSpinBox *longitudeInput;
+    KLineEdit   *altitudeInput;
+    KLineEdit   *latitudeInput;
+    KLineEdit   *longitudeInput;
 };
 
 GPSEditDialog::GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, 
@@ -82,21 +84,28 @@
     setHelp("gpssync", "kipi-plugins");
     setButtonText(User1, i18n("Delete"));
 
-    QGridLayout* grid = new QGridLayout(plainPage(), 3, 1, 0, spacingHint());
+    QGridLayout* grid = new QGridLayout(plainPage(), 3, 2, 0, spacingHint());
 
     QLabel *altitudeLabel  = new QLabel(i18n("Altitude:"), plainPage());
     QLabel *latitudeLabel  = new QLabel(i18n("Latitude:"), plainPage());
     QLabel *longitudeLabel = new QLabel(i18n("Longitude:"), plainPage());
-    d->altitudeInput       = new KDoubleSpinBox(plainPage());
-    d->latitudeInput       = new KDoubleSpinBox(plainPage());
-    d->longitudeInput      = new KDoubleSpinBox(plainPage());
-    d->altitudeInput->setRange(-20000.0, 20000.0, 1.0, 1);
-    d->latitudeInput->setRange(-90.0, 90.0, 1E-6, 6);
-    d->longitudeInput->setRange(-180.0, 180.0, 1E-6, 6);
-    d->altitudeInput->setValue(gpsData.altitude());
-    d->latitudeInput->setValue(gpsData.latitude());
-    d->longitudeInput->setValue(gpsData.longitude());
 
+    d->altitudeInput       = new KLineEdit(plainPage());
+    d->latitudeInput       = new KLineEdit(plainPage());
+    d->longitudeInput      = new KLineEdit(plainPage());
+
+    QPushButton *altResetButton = new QPushButton(SmallIcon("clear_left"), QString::null, plainPage());
+    QPushButton *latResetButton = new QPushButton(SmallIcon("clear_left"), QString::null, plainPage());
+    QPushButton *lonResetButton = new QPushButton(SmallIcon("clear_left"), QString::null, plainPage());
+
+    d->altitudeInput->setValidator(new QDoubleValidator(-20000.0, 20000.0, 1, this));
+    d->latitudeInput->setValidator(new QDoubleValidator(-90.0, 90.0, 8, this));
+    d->longitudeInput->setValidator(new QDoubleValidator(-180.0, 180.0, 8, this));
+
+    d->altitudeInput->setText(QString::number(gpsData.altitude(),   'g', 12));
+    d->latitudeInput->setText(QString::number(gpsData.latitude(),   'g', 12));
+    d->longitudeInput->setText(QString::number(gpsData.longitude(), 'g', 12));
+
     d->gpsCombo  = new QComboBox( false, plainPage() );
     d->gpsButton = new QPushButton(i18n("Get GPS Coordinates..."), plainPage());
     d->gpsCombo->insertItem(QString("Capelinks"), GPSEditDialogDialogPrivate::CapeLinks);
@@ -110,12 +119,24 @@
     grid->addMultiCellWidget(d->altitudeInput, 0, 0, 1, 1);
     grid->addMultiCellWidget(d->latitudeInput, 1, 1, 1, 1);
     grid->addMultiCellWidget(d->longitudeInput, 2, 2, 1, 1);
-    grid->addMultiCellWidget(d->gpsCombo, 3, 3, 0, 0 );
-    grid->addMultiCellWidget(d->gpsButton, 3, 3, 1, 1 );
+    grid->addMultiCellWidget(altResetButton, 0, 0, 2, 2);
+    grid->addMultiCellWidget(latResetButton, 1, 1, 2, 2);
+    grid->addMultiCellWidget(lonResetButton, 2, 2, 2, 2);
+    grid->addMultiCellWidget(d->gpsCombo, 3, 3, 0, 0);
+    grid->addMultiCellWidget(d->gpsButton, 3, 3, 1, 2);
 
     connect(d->gpsButton, SIGNAL(clicked()),
             this, SLOT(slotGPSLocator()));
 
+    connect(altResetButton, SIGNAL(clicked()),
+            d->altitudeInput, SLOT(clear()));
+
+    connect(latResetButton, SIGNAL(clicked()),
+            d->latitudeInput, SLOT(clear()));
+
+    connect(lonResetButton, SIGNAL(clicked()),
+            d->longitudeInput, SLOT(clear()));
+
     adjustSize();
 }
 
@@ -126,12 +147,40 @@
 
 GPSDataContainer GPSEditDialog::getGPSInfo()
 {
-    return GPSDataContainer(d->altitudeInput->value(), 
-                            d->latitudeInput->value(),
-                            d->longitudeInput->value(),
+    return GPSDataContainer(d->altitudeInput->text().toDouble(), 
+                            d->latitudeInput->text().toDouble(),
+                            d->longitudeInput->text().toDouble(),
                             false);
 }
 
+void GPSEditDialog::slotOk()
+{
+    bool ok;
+
+    d->altitudeInput->text().toDouble(&ok);
+    if (!ok)
+    {
+        KMessageBox::error(this, i18n("Altitude value is not correct!"), i18n("GPS Sync"));    
+        return;
+    }        
+
+    d->latitudeInput->text().toDouble(&ok);
+    if (!ok)
+    {
+        KMessageBox::error(this, i18n("Latitude value is not correct!"), i18n("GPS Sync"));    
+        return;
+    }        
+
+    d->longitudeInput->text().toDouble(&ok);
+    if (!ok)
+    {
+        KMessageBox::error(this, i18n("Longitude value is not correct!"), i18n("GPS Sync"));    
+        return;
+    }        
+
+    accept();
+}
+
 void GPSEditDialog::slotUser1()
 {
     done(-1);
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #588568:588569
@@ -48,6 +48,7 @@
 
 protected slots:
 
+    void slotOk();
     void slotUser1();
     void slotGPSLocator();
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.cpp #588568:588569
@@ -93,9 +93,9 @@
     setEnabled(true);
     d->dirty   = dirty;
     d->gpsData = gpsData;
-    setText(2, QString::number(d->gpsData.altitude()));
-    setText(3, QString::number(d->gpsData.latitude()));
-    setText(4, QString::number(d->gpsData.longitude()));
+    setText(2, QString::number(d->gpsData.altitude(),  'g', 12));
+    setText(3, QString::number(d->gpsData.latitude(),  'g', 12));
+    setText(4, QString::number(d->gpsData.longitude(), 'g', 12));
 
     QString status;
     if (isDirty())
Comment 57 caulier.gilles 2006-09-27 10:52:56 UTC
SVN commit 588865 by cgilles:

kipi-plugins from trunk : GPSSync tool : use a KHTMLPart widget to embed web locator page in GPS positions editor dialog

CCMAIL: gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +1 -1      Makefile.am  
 M  +22 -16    gpseditdialog.cpp  
 M  +1 -1      gpseditdialog.h  
 M  +5 -0      gpssyncdialog.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/Makefile.am #588864:588865
@@ -14,7 +14,7 @@
 
 # Libs needed by the plugin
 kipiplugin_gpssync_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \
-	       $(LIBKIPI_LIBS) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
+	       $(LIBKIPI_LIBS) $(LIB_KDEUI) $(LIB_KHTML) $(LIB_KDECORE) $(LIB_QT)
 
 # LD flags for the plugin
 kipiplugin_gpssync_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #588864:588865
@@ -21,6 +21,7 @@
 // Qt includes.
 
 #include <qlabel.h>
+#include <qframe.h>
 #include <qlayout.h>
 #include <qcombobox.h>
 #include <qpushbutton.h>
@@ -34,6 +35,8 @@
 #include <kapplication.h>
 #include <klineedit.h>
 #include <kmessagebox.h>
+#include <khtml_part.h>
+#include <khtmlview.h>
 
 // Local includes.
 
@@ -60,17 +63,17 @@
         altitudeInput  = 0;
         latitudeInput  = 0;
         longitudeInput = 0;
-        gpsButton      = 0;
         gpsCombo       = 0;
+        worldMap       = 0;
     }
 
-    QPushButton *gpsButton;
-
     QComboBox   *gpsCombo;
 
     KLineEdit   *altitudeInput;
     KLineEdit   *latitudeInput;
     KLineEdit   *longitudeInput;
+
+    KHTMLPart   *worldMap;
 };
 
 GPSEditDialog::GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, 
@@ -84,7 +87,7 @@
     setHelp("gpssync", "kipi-plugins");
     setButtonText(User1, i18n("Delete"));
 
-    QGridLayout* grid = new QGridLayout(plainPage(), 3, 2, 0, spacingHint());
+    QGridLayout* grid = new QGridLayout(plainPage(), 4, 3, 0, spacingHint());
 
     QLabel *altitudeLabel  = new QLabel(i18n("Altitude:"), plainPage());
     QLabel *latitudeLabel  = new QLabel(i18n("Latitude:"), plainPage());
@@ -106,8 +109,12 @@
     d->latitudeInput->setText(QString::number(gpsData.latitude(),   'g', 12));
     d->longitudeInput->setText(QString::number(gpsData.longitude(), 'g', 12));
 
+    d->worldMap = new KHTMLPart(plainPage());
+    /*d->worldMap->openURL(KURL("/home/gilles/Documents/Devel/SVN/trunk/extragear/libs/kipi-plugins/gpssync/getlonlat.html"));*/
+    d->worldMap->view()->resize(640, 480);
+    d->worldMap->show();
+
     d->gpsCombo  = new QComboBox( false, plainPage() );
-    d->gpsButton = new QPushButton(i18n("Get GPS Coordinates..."), plainPage());
     d->gpsCombo->insertItem(QString("Capelinks"), GPSEditDialogDialogPrivate::CapeLinks);
     d->gpsCombo->insertItem(QString("MapKi"), GPSEditDialogDialogPrivate::MapKi);
 
@@ -123,10 +130,12 @@
     grid->addMultiCellWidget(latResetButton, 1, 1, 2, 2);
     grid->addMultiCellWidget(lonResetButton, 2, 2, 2, 2);
     grid->addMultiCellWidget(d->gpsCombo, 3, 3, 0, 0);
-    grid->addMultiCellWidget(d->gpsButton, 3, 3, 1, 2);
+    grid->addMultiCellWidget(d->worldMap->view(), 0, 4, 3, 3);
+    grid->setColStretch(3, 10);
+    grid->setRowStretch(4, 10);
 
-    connect(d->gpsButton, SIGNAL(clicked()),
-            this, SLOT(slotGPSLocator()));
+    connect(d->gpsCombo, SIGNAL(activated(int)),
+            this, SLOT(slotGPSLocator(int)));
 
     connect(altResetButton, SIGNAL(clicked()),
             d->altitudeInput, SLOT(clear()));
@@ -138,6 +147,7 @@
             d->longitudeInput, SLOT(clear()));
 
     adjustSize();
+    slotGPSLocator(d->gpsCombo->currentItem());
 }
 
 GPSEditDialog::~GPSEditDialog()
@@ -186,28 +196,24 @@
     done(-1);
 }
 
-void GPSEditDialog::slotGPSLocator()
+void GPSEditDialog::slotGPSLocator(int i)
 {
-    QString val, url;
-
-    switch( d->gpsCombo->currentItem() )
+    switch(i)
     {
         case GPSEditDialogDialogPrivate::CapeLinks:
         {
-            url.append("http://www.capelinks.com/cape-cod/maps/gps");
+            d->worldMap->openURL(KURL("http://www.capelinks.com/cape-cod/maps/gps"));
             break;
         }
 
         case GPSEditDialogDialogPrivate::MapKi:
         {
-            url.append("http://mapki.com/getLonLat.php");
+            d->worldMap->openURL(KURL("http://mapki.com/getLonLat.php"));
             break;
         }
 
         // TODO : Added here others web GPS coordinates locator
     }
-    
-    KApplication::kApplication()->invokeBrowser(url);
 }
 
 }  // namespace KIPIGPSSyncPlugin
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #588864:588865
@@ -50,7 +50,7 @@
 
     void slotOk();
     void slotUser1();
-    void slotGPSLocator();
+    void slotGPSLocator(int);
 
 private:
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #588864:588865
@@ -427,6 +427,8 @@
 
 void GPSSyncDialog::slotApply()
 {
+    KURL::List images;
+
     QListViewItemIterator it( d->listView );
     while ( it.current() ) 
     {
@@ -434,12 +436,15 @@
         d->listView->setSelected(item, true);
         d->listView->ensureItemVisible(item);
         item->writeGPSInfoToFile();
+        images.append(item->getUrl());
 
         // TODO : new libkipi method to store GPS info in host database.
 
         ++it;
         kapp->processEvents();
     }
+    
+    d->interface->refreshImages(images);
 }
 
 }  // NameSpace KIPIGPSSyncPlugin
Comment 58 caulier.gilles 2006-09-27 11:37:35 UTC
fresh screenshot : http://digikam3rdparty.free.fr/Screenshots/newkipigpssyncplugin.png

I have a solution to set the GPS positions to map at startup, but this is require to have a dedicaced web page for the plugin.

Also, i would to get automaticly the longitude and latitude values from the google javascript when user right clic with mouse. I need some help here to get the values from the script to the dialog.

Gilles
Comment 59 caulier.gilles 2006-09-27 14:27:47 UTC
SVN commit 589005 by cgilles:

kipi-plugins from trunk : GPSSync tool : added capabilty to add/remove GPS position manually to more than one pictures at the same time. Just take your pictures selection on the list using SHIFT/CTRL keys and push "Edit Coordinates" button.

CCMAIL: gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +4 -8      gpslistviewitem.cpp  
 M  +1 -1      gpslistviewitem.h  
 M  +32 -6     gpssyncdialog.cpp  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.cpp #589004:589005
@@ -93,6 +93,7 @@
     setEnabled(true);
     d->dirty   = dirty;
     d->gpsData = gpsData;
+    d->erase   = false;
     setText(2, QString::number(d->gpsData.altitude(),  'g', 12));
     setText(3, QString::number(d->gpsData.latitude(),  'g', 12));
     setText(4, QString::number(d->gpsData.longitude(), 'g', 12));
@@ -187,16 +188,11 @@
     return d->dirty;
 }
 
-void GPSListViewItem::eraseGPSInfo(bool e)
+void GPSListViewItem::eraseGPSInfo()
 {
-    d->erase = e;
+    d->erase = true;
     d->dirty = true;
-
-    if (e)
-        setText(6, i18n("Deleted!"));
-    else 
-        setText(6, "");
-
+    setText(6, i18n("Deleted!"));
     repaint();
 }
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.h #589004:589005
@@ -57,7 +57,7 @@
 
     void setGPSInfo(GPSDataContainer gpsData, bool dirty=true, bool addedManually=false);
     GPSDataContainer getGPSInfo();
-    void eraseGPSInfo(bool e);
+    void eraseGPSInfo();
 
     void setDateTime(QDateTime date);
     QDateTime getDateTime();
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #589004:589005
@@ -150,7 +150,7 @@
     d->listView->setAllColumnsShowFocus(true);
     d->listView->setSorting(-1);
     d->listView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-    d->listView->setSelectionMode(QListView::Single);
+    d->listView->setSelectionMode(QListView::Extended);
     d->listView->setMinimumWidth(450);
 
     // ---------------------------------------------------------------
@@ -401,7 +401,7 @@
                              .arg(itemsUpdated), i18n("GPS Sync"));    
 }
 
-// Launch the GPS coordinates editor.
+// Start the GPS coordinates editor dialog.
 void GPSSyncDialog::slotUser2()
 {
     if (!d->listView->currentItem())
@@ -417,11 +417,37 @@
     switch (dlg.exec())
     {
         case KDialogBase::Accepted:
-            item->setGPSInfo(dlg.getGPSInfo(), true, true);
-        break;
+        {
+            QListViewItemIterator it(d->listView);
+
+            while (it.current())
+            {
+                if (it.current()->isSelected())
+                {
+                    GPSListViewItem *selItem = (GPSListViewItem*)it.current();
+                    selItem->setGPSInfo(dlg.getGPSInfo(), true, true);
+                }
+                ++it;
+            }
+
+            break;
+        }
         case(-1):   // Erase all GPS tags
-            item->eraseGPSInfo(true);
-        break;
+        {
+            QListViewItemIterator it(d->listView);
+
+            while (it.current())
+            {
+                if (it.current()->isSelected())
+                {
+                    GPSListViewItem *selItem = (GPSListViewItem*)it.current();
+                    selItem->eraseGPSInfo();
+                }
+                ++it;
+            }
+
+            break;
+        }
     }
 }
 
Comment 60 caulier.gilles 2006-09-27 16:21:32 UTC
SVN commit 589056 by cgilles:

kipi-plugins from trunk : GPSSync tool : remember the GPS position editor dialog settings between sessions.

CCMAIL: gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +34 -2     gpseditdialog.cpp  
 M  +10 -0     gpseditdialog.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #589055:589056
@@ -30,6 +30,7 @@
 // KDE includes.
 
 #include <klocale.h>
+#include <kconfig.h>
 #include <kdebug.h>
 #include <kiconloader.h>
 #include <kapplication.h>
@@ -147,8 +148,7 @@
     connect(lonResetButton, SIGNAL(clicked()),
             d->longitudeInput, SLOT(clear()));
 
-    adjustSize();
-    slotGPSLocator(d->gpsCombo->currentItem());
+    readSettings();
 }
 
 GPSEditDialog::~GPSEditDialog()
@@ -156,6 +156,38 @@
     delete d;
 }
 
+void GPSEditDialog::closeEvent(QCloseEvent *e)
+{
+    if (!e) return;
+    saveSettings();
+    e->accept();
+}
+
+void GPSEditDialog::slotClose()
+{
+    saveSettings();
+    KDialogBase::slotClose();
+}
+
+void GPSEditDialog::readSettings()
+{
+    KConfig config("kipirc");
+    config.setGroup("GPS Sync Settings");
+    d->gpsCombo->setCurrentItem(config.readNumEntry("GPS Locator", 
+                                GPSEditDialogDialogPrivate::CapeLinks));
+    resize(configDialogSize(config, QString("GPS Edit Dialog")));
+    slotGPSLocator(d->gpsCombo->currentItem());
+}
+
+void GPSEditDialog::saveSettings()
+{
+    KConfig config("kipirc");
+    config.setGroup("GPS Sync Settings");
+    config.writeEntry("GPS Locator", d->gpsCombo->currentItem());
+    saveDialogSize(config, QString("GPS Edit Dialog"));
+    config.sync();
+}
+
 GPSDataContainer GPSEditDialog::getGPSInfo()
 {
     return GPSDataContainer(d->altitudeInput->text().toDouble(), 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #589055:589056
@@ -49,11 +49,21 @@
 protected slots:
 
     void slotOk();
+    void slotClose();
     void slotUser1();
     void slotGPSLocator(int);
 
+protected:
+
+    void closeEvent(QCloseEvent *);
+
 private:
 
+    void readSettings();
+    void saveSettings();
+
+private:
+
     GPSEditDialogDialogPrivate * d;
 };
 
Comment 61 caulier.gilles 2006-09-28 08:48:25 UTC
SVN commit 589488 by cgilles:

kipi-plugins from trunk : GPSSync tool : "Remove" button to delete GPS data from picture is now on main dialog.

CCMAIL: gerhard@kulzer.net

CCBUGS: 133359, 111560

 M  +6 -12     gpseditdialog.cpp  
 M  +0 -1      gpseditdialog.h  
 M  +41 -31    gpssyncdialog.cpp  
 M  +1 -0      gpssyncdialog.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #589487:589488
@@ -68,25 +68,24 @@
         worldMap       = 0;
     }
 
-    QComboBox   *gpsCombo;
+    QComboBox *gpsCombo;
 
-    KLineEdit   *altitudeInput;
-    KLineEdit   *latitudeInput;
-    KLineEdit   *longitudeInput;
+    KLineEdit *altitudeInput;
+    KLineEdit *latitudeInput;
+    KLineEdit *longitudeInput;
 
-    KHTMLPart   *worldMap;
+    KHTMLPart *worldMap;
 };
 
 GPSEditDialog::GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, 
                              const QString& fileName)
              : KDialogBase(Plain, i18n("%1 - Edit GPS coordinates").arg(fileName),
-                           Help|User1|Ok|Cancel, Ok,
+                           Help|Ok|Cancel, Ok,
                            parent, 0, true, true)
 {
     d = new GPSEditDialogDialogPrivate;
 
     setHelp("gpssync", "kipi-plugins");
-    setButtonText(User1, i18n("Delete Coordinates"));
 
     QGridLayout* grid = new QGridLayout(plainPage(), 4, 3, 0, spacingHint());
 
@@ -224,11 +223,6 @@
     accept();
 }
 
-void GPSEditDialog::slotUser1()
-{
-    done(-1);
-}
-
 void GPSEditDialog::slotGPSLocator(int i)
 {
     switch(i)
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #589487:589488
@@ -50,7 +50,6 @@
 
     void slotOk();
     void slotClose();
-    void slotUser1();
     void slotGPSLocator(int);
 
 protected:
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.cpp #589487:589488
@@ -100,16 +100,23 @@
 
 GPSSyncDialog::GPSSyncDialog( KIPI::Interface* interface, QWidget* parent)
              : KDialogBase(Plain, i18n("GPS Sync"), 
-                           Help|User1|User2|Apply|Close, Close, 
+                           Help|User1|User2|User3|Apply|Close, Close, 
                            parent, 0, true, true )
 {
     d = new GPSSyncDialogPriv;
     d->interface = interface;
 
     setButtonText(User1, i18n("Correlate"));
-    setButtonText(User2, i18n("Edit Coordinates..."));
+    setButtonText(User2, i18n("Edit..."));
+    setButtonText(User3, i18n("Remove"));
+
+    setButtonTip(User1, i18n("Correlate GPX file data with all pictures from the list."));
+    setButtonTip(User2, i18n("Edit manually GPS coordinates of selected pictures form the list."));
+    setButtonTip(User3, i18n("Remove GPS coordinates of selected pictures form the list."));
+
     enableButton(User1, false);
     enableButton(User2, true);
+    enableButton(User3, true);
 
     QGridLayout *mainLayout = new QGridLayout(plainPage(), 3, 1, 0, marginHint());
 
@@ -364,7 +371,7 @@
     config.sync();
 }
 
-// Start to correlate the GPS positions and Pictures
+// Correlate the GPS positions from Pictures using a GPX file data.
 void GPSSyncDialog::slotUser1()
 {
     int itemsUpdated = 0;
@@ -406,48 +413,51 @@
 {
     if (!d->listView->currentItem())
     {
-        KMessageBox::information(this, i18n("Please, select a picture from "
-                     "the list to edit GPS coordinate manually."), i18n("GPS Sync"));    
+        KMessageBox::information(this, i18n("Please, select pictures from "
+                     "the list to edit GPS coordinates manually."), i18n("GPS Sync"));    
         return;
     }
 
     GPSListViewItem* item = (GPSListViewItem*)d->listView->currentItem();
 
     GPSEditDialog dlg(this, item->getGPSInfo(), item->getUrl().fileName());
-    switch (dlg.exec())
+
+    if (dlg.exec() == KDialogBase::Accepted)
     {
-        case KDialogBase::Accepted:
+        QListViewItemIterator it(d->listView);
+
+        while (it.current())
         {
-            QListViewItemIterator it(d->listView);
-
-            while (it.current())
+            if (it.current()->isSelected())
             {
-                if (it.current()->isSelected())
-                {
-                    GPSListViewItem *selItem = (GPSListViewItem*)it.current();
-                    selItem->setGPSInfo(dlg.getGPSInfo(), true, true);
-                }
-                ++it;
+                GPSListViewItem *selItem = (GPSListViewItem*)it.current();
+                selItem->setGPSInfo(dlg.getGPSInfo(), true, true);
             }
-
-            break;
+            ++it;
         }
-        case(-1):   // Erase all GPS tags
-        {
-            QListViewItemIterator it(d->listView);
+    }
+}
 
-            while (it.current())
-            {
-                if (it.current()->isSelected())
-                {
-                    GPSListViewItem *selItem = (GPSListViewItem*)it.current();
-                    selItem->eraseGPSInfo();
-                }
-                ++it;
-            }
+// Remove GPS coordinates from pictures.
+void GPSSyncDialog::slotUser3()
+{
+    if (!d->listView->currentItem())
+    {
+        KMessageBox::information(this, i18n("Please, select pictures from "
+                     "the list to remove GPS coordinates."), i18n("GPS Sync"));    
+        return;
+    }
 
-            break;
+    QListViewItemIterator it(d->listView);
+
+    while (it.current())
+    {
+        if (it.current()->isSelected())
+        {
+            GPSListViewItem *selItem = (GPSListViewItem*)it.current();
+            selItem->eraseGPSInfo();
         }
+        ++it;
     }
 }
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpssyncdialog.h #589487:589488
@@ -60,6 +60,7 @@
     void slotClose();
     void slotUser1();
     void slotUser2();
+    void slotUser3();
 
 private slots:
 
Comment 62 caulier.gilles 2006-09-28 12:52:09 UTC
SVN commit 589554 by cgilles:

kipi-plugins from trunk : GPSSync tool : The GPS location editor dialognow use a dediced Google Maps to select the right place where have been taken the pictures.

Improvements :

- If the current picture already have GPS coordinates, the map will pan to the right place automaiticly at session startup!

- The GPS coordinates are automaticly captured by the dialog when the user right click on the map ! There is nothing to do manually to set the GPS location...

Angelo: with this plugin, i'm using a little php script to handle the google map with is interfaced with the plugin dialog ! This php script is hosted actually in a 3rd party digikam page. I would to host this page in the new kipi-plugins web project page. Can you help me ?

Noe : there is a copy of php script in svn.

CCMAIL: gerhard@kulzer.net, kde-imaging@ke.org

BUG: 133359
CCBUGS: 111560

 M  +2 -1      Makefile.am  
 A             getlonlat.php  
 M  +35 -61    gpseditdialog.cpp  
 M  +2 -3      gpseditdialog.h  
 A             gpsmapwidget.cpp   [License: GPL]
 A             gpsmapwidget.h   [License: GPL]


--- trunk/extragear/libs/kipi-plugins/gpssync/Makefile.am #589553:589554
@@ -10,7 +10,8 @@
 
 # Srcs for the plugin
 kipiplugin_gpssync_la_SOURCES = plugin_gpssync.cpp gpssyncdialog.cpp gpslistviewitem.cpp \
-	                            gpsbabelbinary.cpp gpsdataparser.cpp gpseditdialog.cpp 
+	                            gpsbabelbinary.cpp gpsdataparser.cpp gpseditdialog.cpp \
+	                            gpsmapwidget.cpp 
 
 # Libs needed by the plugin
 kipiplugin_gpssync_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #589553:589554
@@ -21,9 +21,7 @@
 // Qt includes.
 
 #include <qlabel.h>
-#include <qframe.h>
 #include <qlayout.h>
-#include <qcombobox.h>
 #include <qpushbutton.h>
 #include <qvalidator.h>
 
@@ -36,11 +34,11 @@
 #include <kapplication.h>
 #include <klineedit.h>
 #include <kmessagebox.h>
-#include <khtml_part.h>
 #include <khtmlview.h>
 
 // Local includes.
 
+#include "gpsmapwidget.h"
 #include "gpseditdialog.h"
 #include "gpseditdialog.moc"
 
@@ -52,33 +50,22 @@
 
 public:
 
-    enum WebGPSLocator
-    {
-        CapeLinks = 0,
-        MapKi
-        // TODO : Added here others web GPS coordinates locator
-    };
-
     GPSEditDialogDialogPrivate()
     {
         altitudeInput  = 0;
         latitudeInput  = 0;
         longitudeInput = 0;
-        gpsCombo       = 0;
         worldMap       = 0;
     }
 
-    QComboBox *gpsCombo;
+    KLineEdit    *altitudeInput;
+    KLineEdit    *latitudeInput;
+    KLineEdit    *longitudeInput;
 
-    KLineEdit *altitudeInput;
-    KLineEdit *latitudeInput;
-    KLineEdit *longitudeInput;
-
-    KHTMLPart *worldMap;
+    GPSMapWidget *worldMap;
 };
 
-GPSEditDialog::GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, 
-                             const QString& fileName)
+GPSEditDialog::GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, const QString& fileName)
              : KDialogBase(Plain, i18n("%1 - Edit GPS coordinates").arg(fileName),
                            Help|Ok|Cancel, Ok,
                            parent, 0, true, true)
@@ -89,6 +76,10 @@
 
     QGridLayout* grid = new QGridLayout(plainPage(), 4, 3, 0, spacingHint());
 
+    QLabel *message = new QLabel(i18n("<p>Use the map on the left to select the right place where "
+                                      "have been taken the picture. Click with right mouse button "
+                                       "on the map to get the GPS coordinates.<p>"), plainPage());
+
     QLabel *altitudeLabel  = new QLabel(i18n("Altitude:"), plainPage());
     QLabel *latitudeLabel  = new QLabel(i18n("Latitude:"), plainPage());
     QLabel *longitudeLabel = new QLabel(i18n("Longitude:"), plainPage());
@@ -109,35 +100,23 @@
     d->latitudeInput->setText(QString::number(gpsData.latitude(),   'g', 12));
     d->longitudeInput->setText(QString::number(gpsData.longitude(), 'g', 12));
 
-    d->worldMap = new KHTMLPart(plainPage());
-    /*d->worldMap->openURL(KURL("/home/gilles/Documents/Devel/SVN/trunk/extragear/libs/kipi-plugins/gpssync/getlonlat.html"));*/
-    d->worldMap->view()->resize(640, 480);
-    d->worldMap->setJScriptEnabled(true);
+    d->worldMap = new GPSMapWidget(plainPage(), d->latitudeInput->text(), d->longitudeInput->text());
     d->worldMap->show();
 
-    d->gpsCombo  = new QComboBox( false, plainPage() );
-    d->gpsCombo->insertItem(QString("Capelinks"), GPSEditDialogDialogPrivate::CapeLinks);
-    d->gpsCombo->insertItem(QString("MapKi"), GPSEditDialogDialogPrivate::MapKi);
-
-    // TODO : Added here others web GPS coordinates locator
-    
-    grid->addMultiCellWidget(altitudeLabel, 0, 0, 0, 0);
-    grid->addMultiCellWidget(latitudeLabel, 1, 1, 0, 0);
-    grid->addMultiCellWidget(longitudeLabel, 2, 2, 0, 0);
-    grid->addMultiCellWidget(d->altitudeInput, 0, 0, 1, 1);
-    grid->addMultiCellWidget(d->latitudeInput, 1, 1, 1, 1);
-    grid->addMultiCellWidget(d->longitudeInput, 2, 2, 1, 1);
-    grid->addMultiCellWidget(altResetButton, 0, 0, 2, 2);
-    grid->addMultiCellWidget(latResetButton, 1, 1, 2, 2);
-    grid->addMultiCellWidget(lonResetButton, 2, 2, 2, 2);
-    grid->addMultiCellWidget(d->gpsCombo, 3, 3, 0, 0);
+    grid->addMultiCellWidget(message, 0, 0, 0, 2);
+    grid->addMultiCellWidget(altitudeLabel, 1, 1, 0, 0);
+    grid->addMultiCellWidget(latitudeLabel, 2, 2, 0, 0);
+    grid->addMultiCellWidget(longitudeLabel, 3, 3, 0, 0);
+    grid->addMultiCellWidget(d->altitudeInput, 1, 1, 1, 1);
+    grid->addMultiCellWidget(d->latitudeInput, 2, 2, 1, 1);
+    grid->addMultiCellWidget(d->longitudeInput, 3, 3, 1, 1);
+    grid->addMultiCellWidget(altResetButton, 1, 1, 2, 2);
+    grid->addMultiCellWidget(latResetButton, 2, 2, 2, 2);
+    grid->addMultiCellWidget(lonResetButton, 3, 3, 2, 2);
     grid->addMultiCellWidget(d->worldMap->view(), 0, 4, 3, 3);
     grid->setColStretch(3, 10);
     grid->setRowStretch(4, 10);
 
-    connect(d->gpsCombo, SIGNAL(activated(int)),
-            this, SLOT(slotGPSLocator(int)));
-
     connect(altResetButton, SIGNAL(clicked()),
             d->altitudeInput, SLOT(clear()));
 
@@ -147,6 +126,9 @@
     connect(lonResetButton, SIGNAL(clicked()),
             d->longitudeInput, SLOT(clear()));
 
+    connect(d->worldMap, SIGNAL(signalMouseReleased()),
+            this, SLOT(slotGetGPSLocationFromMap()));
+
     readSettings();
 }
 
@@ -172,17 +154,13 @@
 {
     KConfig config("kipirc");
     config.setGroup("GPS Sync Settings");
-    d->gpsCombo->setCurrentItem(config.readNumEntry("GPS Locator", 
-                                GPSEditDialogDialogPrivate::CapeLinks));
     resize(configDialogSize(config, QString("GPS Edit Dialog")));
-    slotGPSLocator(d->gpsCombo->currentItem());
 }
 
 void GPSEditDialog::saveSettings()
 {
     KConfig config("kipirc");
     config.setGroup("GPS Sync Settings");
-    config.writeEntry("GPS Locator", d->gpsCombo->currentItem());
     saveDialogSize(config, QString("GPS Edit Dialog"));
     config.sync();
 }
@@ -223,23 +201,19 @@
     accept();
 }
 
-void GPSEditDialog::slotGPSLocator(int i)
+void GPSEditDialog::slotGetGPSLocationFromMap()
 {
-    switch(i)
+    QString status = d->worldMap->jsStatusBarText();
+    
+    if (status.startsWith(QString("(lat:")))
     {
-        case GPSEditDialogDialogPrivate::CapeLinks:
-        {
-            d->worldMap->openURL(KURL("http://www.capelinks.com/cape-cod/maps/gps"));
-            break;
-        }
-
-        case GPSEditDialogDialogPrivate::MapKi:
-        {
-            d->worldMap->openURL(KURL("http://mapki.com/getLonLat.php"));
-            break;
-        }
-
-        // TODO : Added here others web GPS coordinates locator
+        status.remove(0, 5);
+        status.truncate(status.length()-1);
+        QString lat = status.section(",", 0, 0);
+        QString lon = status.section(",", 1, 1);
+        lon.remove(0, 5);
+        d->latitudeInput->setText(lat);
+        d->longitudeInput->setText(lon);
     }
 }
 
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #589553:589554
@@ -40,8 +40,7 @@
 
 public:
 
-    GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, 
-                  const QString& fileName);
+    GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, const QString& fileName);
     ~GPSEditDialog();
 
     GPSDataContainer getGPSInfo();
@@ -50,7 +49,7 @@
 
     void slotOk();
     void slotClose();
-    void slotGPSLocator(int);
+    void slotGetGPSLocationFromMap();
 
 protected:
 
Comment 63 caulier.gilles 2006-09-28 13:16:56 UTC
And finally, the last version of the GPSSync kipi-plugin in action with google map :

http://digikam3rdparty.free.fr/Screenshots/newkipigpssyncplugin.png 
 
Gilles Caulier
Comment 64 Antonio E. 2006-09-28 19:05:48 UTC
Gilles, I love it, great stuff! It's really good. I just have a comment: can we make the default size of the "Edit GPS coordinates" window a bit bigger? The default size is too small and most people will have to resize it. Probably the best is a size where the map would fit completelly.

Thank you very much for this plugin ;-).
Comment 65 caulier.gilles 2006-09-28 19:12:52 UTC
Antonio,

yes, we can. Note that the dialog will remember the size between session.

Gilles

PS: Now we will continue this thread about to add a possible google maps into digiKam GPS side bar tab. What do you think about ?

I don't want to do in digiKam for 0.9.0 but later. Won't touch anymore the code in digiKam code. It's time to stabilize all (0.9.0-beta3 is planed to october, and final release just before Christmast)

Comment 66 Antonio E. 2006-10-17 00:12:16 UTC
I like the idea about the integration in the side bar, Gilles. I don't know if this is the best place to talk about it or not, as this issue is resolved as fixed. Maybe we should open a new one about it.

Totally agree about not touching 0.9.0 more. Any new feature may introduce new bugs that would require more time to fix. You have done lots of great stuff in this version, Gilles.

Antonio E.
Comment 67 caulier.gilles 2006-10-17 08:11:45 UTC
Yes Antonio. Please open a new wish in B.K.O about sidebar with GPSSync plugin.

This will more readable and clean.

Thanks in advance

Gilles