Bug 111560 - Be able to locate photos on a map
Summary: Be able to locate photos on a map
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Geolocation-Workflow (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-26 15:26 UTC by Bruno
Modified: 2017-08-12 16:34 UTC (History)
2 users (show)

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


Attachments
geo-data1.png (215.89 KB, image/png)
2006-09-25 22:45 UTC, Mark Purcell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno 2005-08-26 15:26:10 UTC
Version:            (using KDE KDE 3.4.2)
Installed from:    Gentoo Packages

Summary:
I would like to be able to locate photos on a scanned map with some flags.

Details:
1. Scan a map
2. Drag&drop photos on the map: it adds a flag to the selected location.
3. When you click on the flag, you get a popup with the photo thumbnail (maybe Google-like)

What for ?
When you make a trip, you take photos at different places and you don't remember some time later where you have taken this photo. This Wishlist could solve this.

Note: I don't know any Digikam-like software (Picasa, Irfanview ...) including this feature. It could be a killer-feature, no ? ;-)

Feel free to ask for further details of my idea if I'm not clear enough.
Comment 1 caulier.gilles 2006-03-03 09:31:31 UTC
This is my vision about GPS info in digiKam :

I'm agree with you. GPS info can be important for pro-photographs.

But how many digital camera support GPS extension ? How many photograph use this feature ?

I'm sure that GPS will become a standard tool in the future. GPS is generalized tool.

If digiKam users vote for this entry, we can plan any jobs for the future :

To 0.9.0, a new metadata side bar tab will be avaialble instead the simple Exif dialog.

Exif, Marker note, and IPTC info will be availalble (in read only on the first time).

I would to add a GPS tab in this metadata sidebar to display GPS info position and a simple world map to locate the position in the world (There is a widget to do it in Xglobe app). If you want more informations about world position a button can be used to send GPS info to www.mapguest.com service, like this :

http://www.mapquest.com/maps/map.adp?searchtype=address&formtype=address&latlongtype=decimal&latitude=43.2724&longitude=3.51848

Any comments welcome....

Gilles Caulier

Comment 2 caulier.gilles 2006-03-03 10:59:41 UTC
SVN commit 515268 by cgilles:

digikam from trunk : Metadata support using Exiv2 :

- New image properties sidebar tab named "Metadata" instead old "Exif". This area include :

* Standard Exif tags viewer.
* MarkerNote Exif tags viewer.
* IPTC records viewer.

- New capability to copy metadata in clipboard like text.
- New capability to print metadata.
- Tags name use the "user Friendly" conversion from Exiv2 instead the internal name provided by old Exif viewer based on libkexif.
- Capability to read metadata from CRW files (Canon RAW files)
- New class DMetadata to load/save metadata without loading image data. Actually JPEG, CRW, and PNG files are supported. About PNG (Exif and IPTC raw profiles generated by ImageMagick are supported.

To support new file formats (like NEF, MRW, TIFF, DNG, etc), new image file parsers must be added to Exiv2 library.

IMPORTANT: 

- Exiv2 do not support yet gettext for i18n rules. All informations in metadata viewers aren't yet i18n (tags name, tags values, and tags descriptions)
- Any tag names use internal Exiv2 name, not the user friendly text transformations. This point must be fixed in Exiv2 libs.

To 0.9.0, these tools are just metadata readers. Writting capabilities (metadata editors) will added later 0.9.0. The files in B.K.O directly or indirectly relevant of this commits are listed below :

*Pending:

103255
106103
115764
111560

*Partially fixed:

91812
96459
109253
110598
118501         

* To check before closing:

122264

* Fixed (can be closed):

103489
121371
105670
109319

CCMAIL: digikam-devel@kde.org,  Andreas Huggel <ahuggel@gmx.net>

CCBUGS: 103255, 106103, 115764, 111560, 91812, 96459, 109253, 110598, 118501, 122264, 103489, 121371, 105670, 109319


 M  +2 -1      libs/Makefile.am  
 M  +5 -4      libs/dimg/Makefile.am  
 M  +1 -1      libs/dimg/dimg.cpp  
 M  +1 -1      libs/dimg/dimg.h  
 M  +19 -1     libs/dimg/dimgloader.cpp  
 M  +4 -2      libs/dimg/dimgloader.h  
 M  +4 -61     libs/dimg/loaders/jpegloader.cpp  
 M  +5 -29     libs/dimg/loaders/pngloader.cpp  
 M  +2 -1      libs/dimg/loaders/rawloader.cpp  
 A             libs/dmetadata (directory)  
 A             libs/dmetadata/Makefile.am  
 A             libs/dmetadata/dmetadata.cpp   [License: GPL]
 A             libs/dmetadata/dmetadata.h   [License: GPL]
 A             libs/dmetadata/loaders (directory)  
 A             libs/dmetadata/loaders/Makefile.am  
 A             libs/dmetadata/loaders/dmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/dmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/jpegmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/jpegmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/pngmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/pngmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/rawmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/rawmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/tiffmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/tiffmetaloader.h   [License: GPL]
 M  +3 -2      libs/imageproperties/Makefile.am  
 M  +82 -323   libs/imageproperties/imagepropertiesexiftab.cpp  
 M  +12 -25    libs/imageproperties/imagepropertiesexiftab.h  
 M  +19 -18    libs/imageproperties/imagepropertiessidebar.cpp  
 M  +10 -9     libs/imageproperties/imagepropertiessidebar.h  
 M  +27 -26    libs/imageproperties/imagepropertiessidebarcamgui.cpp  
 M  +2 -1      libs/imageproperties/imagepropertiessidebarcamgui.h  
 M  +16 -15    libs/imageproperties/imagepropertiessidebardb.cpp  
 M  +3 -1      libs/widgets/Makefile.am  
 A             libs/widgets/metadata (directory)  
 A             libs/widgets/metadata/Makefile.am  
 A             libs/widgets/metadata/exifwidget.cpp   [License: GPL]
 A             libs/widgets/metadata/exifwidget.h   [License: GPL]
 A             libs/widgets/metadata/iptcwidget.cpp   [License: GPL]
 A             libs/widgets/metadata/iptcwidget.h   [License: GPL]
 A             libs/widgets/metadata/makernotewidget.cpp   [License: GPL]
 A             libs/widgets/metadata/makernotewidget.h   [License: GPL]
 A             libs/widgets/metadata/mdkeylistviewitem.cpp   [License: GPL]
 A             libs/widgets/metadata/mdkeylistviewitem.h   [License: GPL]
 A             libs/widgets/metadata/metadatalistview.cpp   [License: GPL]
 A             libs/widgets/metadata/metadatalistview.h   [License: GPL]
 A             libs/widgets/metadata/metadatalistviewitem.cpp   [License: GPL]
 A             libs/widgets/metadata/metadatalistviewitem.h   [License: GPL]
 A             libs/widgets/metadata/metadatawidget.cpp   [License: GPL]
 A             libs/widgets/metadata/metadatawidget.h   [License: GPL]
 M  +24 -1     utilities/cameragui/cameraui.cpp  
Comment 3 Mikolaj Machowski 2006-03-03 12:55:36 UTC
That would be great toy :)

Some KDE apps have simple world map - for example KMail to display
position of contact.

Another great app to display position on globe map is
http://xplanet.sf.net .

Also nice feature would be writing position to photo info by pointing on
map, just writing name of location (and translating it to coordinates
- KStars has looong list of cities with coordinates). That wouldn't be
so precise as real GPS but "good enough" replacement for people without
that feature.
Comment 4 caulier.gilles 2006-03-03 13:09:55 UTC
Oh, right kmail have a great world map widget. thanks for the info.

Anybody have any pictures (JPEG preferred) with GPS info to test ?

Nota : TIFF/EP file format have also the capabilities to embeded GPS info, there is no way yet to extract these metadata in digiKam (using exiv2)

Gilles Caulier
Comment 5 Mikolaj Machowski 2006-03-03 16:46:35 UTC
*** This bug has been confirmed by popular vote. ***
Comment 6 Marc Cramdal 2006-03-03 19:13:02 UTC
Gilles, it would be not only for pro-photographs. I have a camera without GPS-infos but I'd like to locate the photos on a map after having taken them; even on a tourism map scanned for this purpose (but coordinates are maybe a better idea)

Thanks for taking care of this, great job !
Comment 7 Mikolaj Machowski 2006-03-03 23:34:35 UTC
Coordinates are the only idea :) That is probably the only data to store
it into Exif tag. Problem is displaying that info. KAddressBook widget
is tiny. It is some foundation but you could barely distinguish if photo
was taken in London or Paris (looking only in map :)).
Comment 8 Marcel Wiesweg 2006-03-04 14:37:32 UTC
If we want Satellite images, NASA provides great imagery called Blue Marble Next Generation for free, the August picture for example
http://visibleearth.nasa.gov/view_detail.php?id=7131

The readme.pdf provides all information necessary.
The projection is good for writing easy locating code, http://en.wikipedia.org/wiki/Plate_carree

But the data is huge - not to speak of the 500m resolution which is 2.2GB, the 8km resolution is 8.3MB.

I did not find comparable political maps, but there is plenty of links at
http://en.wikipedia.org/wiki/Maps#External_links
Comment 9 Mikolaj Machowski 2006-03-04 19:40:47 UTC
> But the data is huge - not to speak of the 500m resolution which is
> 2.2GB, the 8km resolution is 8.3MB.


These are tiffs dimensions. 8km version in jpg is 2M (I have this one
- beautiful) 500m is definitely an overkill for wide public. 8km
resolution is IMO good enough for most people. Processing it as the
whole could be time consuming but it may be solved as tiles  - similarly to
Google. Or maybe screw internal solution. For quick view use something
similar to KAddressbook widget and for more detailed call
maps.google.com? IMO it is not the best solution as long Google doesn't
play nice with Konqueror but puts less strain on developers. Another
solution would be some use of Google API (licenses?).

> I did not find comparable political maps, but there is plenty of links
> at http://en.wikipedia.org/wiki/Maps#External_links


Xplanet has scripts which are defining borders by coordinates.
Comment 10 caulier.gilles 2006-03-05 22:36:44 UTC
ok look this screenshot :

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

This is a first implementation of GPS sidebar tab on my computer. 
It's based on Kontact GPS map widget. It's simple and i have planed to use a more detailled map, displayed using a Scroolview.

Like i'm not familiarized with GPS, i have the little problem :

The lat/long data from Exif are in deg/min/sec. I need to convert it to UTM decimal value to use an external global map service. In my code the web service  www.mapquest.com is used to display a detailled map via konqueror when you use the "More Info" button.

I need an algorithm to convert it. The any source code that i have found are listed below :

http://www.gpsy.com/gpsinfo/geotoutm/
http://www.data.scec.org/ftp/LARSE/ll2UTM.c

The second link seen to be the most easy to use, but i'm not sure. And i need to have any info about how to use properly the algorithm, especially with "zone" and "ll2utm_flag", and "ispher" parameters used by this method :

sub_ll2utm(xin,yin,direction_flag,zone,spher,xout,yout)

If anybody can guide me. Thanks in advance.

Gilles Caulier
Comment 11 caulier.gilles 2006-03-06 07:58:15 UTC
My first approach is to make in a first time an GPS info viewer embedded to image files. This is want mean that this tool will works in read only to 0.9.0 because it's not very difficult to do.

In a second time, a GPS editor can be done, but a need to study how to do properlly. I aneed more time for that. I will plan this job later than 0.9.0 issue.

Gilles Caulier
Comment 12 caulier.gilles 2006-04-10 07:35:05 UTC
SVN commit 528096 by cgilles:

digikam from trunk : GPS locator tool :

- Code polishing.
- Remember last web GPS locator service used.

Nota: the implementation is ready to use new GPS maps service from the web. If you have some url witch accept world latitude and longitude GPS coordinates, let's me hear...

CCMAIL: digikam-devel@kde.org
CCBUGS: 111560

 M  +6 -2      imageproperties/imagepropertiesmetadatatab.cpp  
 M  +40 -19    widgets/metadata/gpswidget.cpp  
 M  +12 -0     widgets/metadata/gpswidget.h  
 M  +32 -27    widgets/metadata/metadatawidget.cpp  
Comment 13 caulier.gilles 2006-04-10 15:41:24 UTC
*** Bug 106103 has been marked as a duplicate of this bug. ***
Comment 14 x9wvxlcz 2006-09-14 01:08:23 UTC
Geotagging can be very simple these days - simply carry a GPS receiver to track your route while taking photos, MAKE SURE the camera's clock is accurate (personally I just keep my camera's clock on UTC), then download the route from the GPS to your computer and match the time stamps from the images to the points on the route - viola!

I'm pretty sure there is already some open source software to help achieve that. I can't find it right now but a search through googlemapsmania or Google Earth Blog or other geography-related web sites should come up with pointers. It also should be easy to implement once you get your hands on code to parse the GPS track file.
Comment 15 Gerhard Kulzer 2006-09-14 07:53:54 UTC
The software you are lookig for is here: http://freefoote.dview.net/linux_gpscorr.html

Otherwise read the manual of digikam 0.9 which covers the subject:
http://docs.kde.org/development/en/extragear-graphics/digikam/index.html
Comment 16 Arnd Baecker 2006-09-14 13:24:53 UTC
Another one:
http://www.carto.net/projects/photoTools/gpsPhoto/
which even supports RAW (cr2, crw, and nef) in addition to jpeg.
Comment 17 caulier.gilles 2006-09-21 14:52:09 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 18 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 19 caulier.gilles 2006-09-22 12:42:14 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 20 caulier.gilles 2006-09-22 15:11:33 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 21 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 22 Bruno 2006-09-24 19:57:30 UTC
For those who have not the chance to have a gps receiver with their camera, is there a way to manually add the coordinates ?
Comment 23 caulier.gilles 2006-09-24 20:18:15 UTC
not yet. I have a partial digikam core implementation in my computer to do it. I will trying to provide a patch for that next week.

I'm not sure to provide this implementation for 0.9.0 release because it's a new feature and we are in beta 2 now.

I wil publish the patch in this room, and would to have users feedback before to decide if the code will be add to 0.9.0 or not

Marcel it's right for you ?

Gilles
Comment 24 caulier.gilles 2006-09-25 08:44:57 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 25 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 26 caulier.gilles 2006-09-25 14:59:58 UTC
Hey guys,

The plugin has a new option to set GPS coordinate manually.

If you have an idea how to get GPS coordinates using an external tool (web, program) witch use advanced and detailled maps, let's me hear. I can add a link/button to start this external tool...

Gilles Caulier
Comment 27 Petter Reinholdtsen 2006-09-25 15:05:58 UTC
The gpscorrelate program, <URL:http://freefoote.dview.net/linux_gpscorr.html>,
can be used to add GPS tags based on GPS data in GPX format.
Comment 28 caulier.gilles 2006-09-25 15:10:42 UTC
Petter,

Are you following really this thread ? (:=)))

the new kipi-plugin that i have done into svn trunk do exactly this job, _and_ can edit manually the GPS coordinate for each picture !

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

Gilles Caulier
Comment 29 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 30 caulier.gilles 2006-09-25 16:29:27 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 31 Mark Purcell 2006-09-25 22:45:28 UTC
On Monday 25 September 2006 14:00, Gilles Caulier wrote:
> If you have an idea how to get GPS coordinates using an external tool (web,
> program) witch use advanced and detailled maps, let's me hear. I can add a
> link/button to start this external tool...


Gilles,

kaddressbook does have a gps tool:

Mark


Created an attachment (id=17914)
geo-data1.png
Comment 32 Mikolaj Machowski 2006-09-26 01:16:34 UTC
Kaddressbook GPS tool is rather primitive comparing to what Digikam
already have (in .9-svn version).
Comment 33 caulier.gilles 2006-09-26 10:54:44 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 34 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 35 caulier.gilles 2006-09-26 13:37:57 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 36 caulier.gilles 2006-09-27 10:52:57 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 37 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 38 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 39 caulier.gilles 2006-09-28 08:48:38 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 40 caulier.gilles 2006-09-28 12:52:04 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 41 caulier.gilles 2006-09-29 12:04:36 UTC
SVN commit 590109 by cgilles:

kipi-plugins from trunk : GPSSync tool : The GPS location editor dialog now display the Google Maps view like a real widget, without margin and depending of the dialog size. If you reduce or increase dialog size, the world map size will be updated in live.

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

BUG: 133359
CCBUGS: 111560

 M  +24 -6     getlonlat.php  
 M  +13 -0     gpseditdialog.cpp  
 M  +2 -0      gpseditdialog.h  
 M  +24 -11    gpsmapwidget.cpp  
 M  +9 -0      gpsmapwidget.h  


--- trunk/extragear/libs/kipi-plugins/gpssync/getlonlat.php #590108:590109
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
 
-<!--
+<?php
 /* ============================================================
  * Authors: Caulier Gilles <caulier dot gilles at kdemail dot net>
  * Date   : 2006-09-22
@@ -10,9 +10,17 @@
  * 
  * Copyright 2006 by Gilles Caulier
  * 
- * Note : this script use Google Map api:
- *        http://www.google.com/apis/maps/documentation
+ * Notes : This script use Google Map api:
+ *         http://www.google.com/apis/maps/documentation
+ *         This script must be copied to host kipi-plugins
+ *         web project page.
+ *         This script accept some values from url:
+ *           - 'alt' : picture altitude.
+ *           - 'lon' : picture longitude. 
+ *           - 'wth' : width of map.
+ *           - 'hgt' : height of map.
  *
+ *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
  * Public License as published by the Free Software Foundation;
@@ -25,7 +33,7 @@
  * GNU General Public License for more details.
  * 
  * ============================================================ */
--->
+?>
 
 <head>
 <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAy_Vv5rc03ctmYvwfsuTH6RSK29CRGKrdb78LNYpP1_riKtR3zRRxy4unyuWAi2vp7m1isLwuHObXDg" 
@@ -82,7 +90,17 @@
 </script>
 </head>
 
-<body onLoad="loadMap()">
-<div id="map" style="width: 640px; height: 480px"></div>
+<body onLoad="loadMap()" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+
+<?php
+    echo "<div id=\"map\" ";
+    echo "style=\"width: ";
+    echo $_GET['wth'];
+    echo "px; height: ";
+    echo $_GET['hgt'];
+    echo "px\">";
+?>
+
+</div>
 </body>
 </html>
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #590108:590109
@@ -20,6 +20,7 @@
 
 // Qt includes.
 
+#include <qtimer.h>
 #include <qlabel.h>
 #include <qlayout.h>
 #include <qpushbutton.h>
@@ -131,6 +132,7 @@
             this, SLOT(slotNewGPSLocationFromMap(const QString&, const QString&)));
 
     readSettings();
+    QTimer::singleShot(0, this, SLOT(slotUpdateWorldMap()));
 }
 
 GPSEditDialog::~GPSEditDialog()
@@ -145,6 +147,17 @@
     e->accept();
 }
 
+void GPSEditDialog::slotUpdateWorldMap()
+{
+    d->worldMap->resized();
+}
+
+void GPSEditDialog::resizeEvent(QResizeEvent *e)
+{
+    if (!e) return;
+    slotUpdateWorldMap();
+}
+
 void GPSEditDialog::slotCancel()
 {
     saveSettings();
--- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #590108:590109
@@ -50,9 +50,11 @@
     void slotOk();
     void slotCancel();
     void slotNewGPSLocationFromMap(const QString& lat, const QString& lon);
+    void slotUpdateWorldMap();
 
 protected:
 
+    void GPSEditDialog::resizeEvent(QResizeEvent *);
     void closeEvent(QCloseEvent *);
 
 private:
--- trunk/extragear/libs/kipi-plugins/gpssync/gpsmapwidget.cpp #590108:590109
@@ -35,16 +35,14 @@
 GPSMapWidget::GPSMapWidget(QWidget* parent, const QString& lat, const QString& lon)
             : KHTMLPart(parent)
 {
-    view()->resize(640, 480);
+    m_latitude  = lat;
+    m_longitude = lon;
     setJScriptEnabled(true);     
     setDNDEnabled(false);
     setEditable(false);
-    QString url("http://digikam3rdparty.free.fr/gpslocator/getlonlat.php");
-    url.append("?lat=");
-    url.append(lat);
-    url.append("&lon=");
-    url.append(lon);
-    openURL(KURL(url));
+    view()->setVScrollBarMode(QScrollView::AlwaysOff);
+    view()->setHScrollBarMode(QScrollView::AlwaysOff);
+    view()->setMinimumSize(480, 360);
 }
 
 GPSMapWidget::~GPSMapWidget()
@@ -59,11 +57,26 @@
     {
         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);
-        emit signalNewGPSLocationFromMap(lat, lon);
+        m_latitude  = status.section(",", 0, 0);
+        m_longitude = status.section(",", 1, 1);
+        m_longitude.remove(0, 5);
+        emit signalNewGPSLocationFromMap(m_latitude, m_longitude);
     }
 }
 
+void GPSMapWidget::resized()
+{
+    QString url("http://digikam3rdparty.free.fr/gpslocator/getlonlat.php");
+    url.append("?lat=");
+    url.append(m_latitude);
+    url.append("&lon=");
+    url.append(m_longitude);
+    url.append("&wth=");
+    url.append(QString::number(view()->width()));
+    url.append("&hgt=");
+    url.append(QString::number(view()->height()));
+    openURL(KURL(url));
+    kdDebug( 51001 ) << url << endl;
+}
+
 }  // namespace KIPIGPSSyncPlugin
--- trunk/extragear/libs/kipi-plugins/gpssync/gpsmapwidget.h #590108:590109
@@ -29,6 +29,8 @@
 
 #include <khtml_part.h>
 
+class QResizeEvent;
+
 namespace KIPIGPSSyncPlugin
 {
 
@@ -41,6 +43,8 @@
     GPSMapWidget(QWidget* parent, const QString& lat, const QString& lon);
     ~GPSMapWidget();
 
+    void resized();
+
 signals:
 
     void signalNewGPSLocationFromMap(const QString&, const QString&);
@@ -48,6 +52,11 @@
 protected:
 
     void khtmlMouseReleaseEvent(khtml::MouseReleaseEvent *);
+
+private:
+
+    QString m_latitude;
+    QString m_longitude;
 };
 
 }  // namespace KIPIGPSSyncPlugin
Comment 42 Mark Purcell 2006-10-01 18:44:35 UTC
On Tuesday 26 September 2006 07:16, Mikolaj Machowski wrote:
> http://bugs.kde.org/show_bug.cgi?id=111560    
>
> Kaddressbook GPS tool is rather primitive comparing to what Digikam
> already have (in .9-svn version).


It is still svn quality code, but Marble looks like another KDE tool which 
could be useful for integration with digikam for gps locations.

http://www.kdedevelopers.org/node/2412

Perhaps there should be some coordination between digikam and marble??

Mark
Comment 43 Mikolaj Machowski 2006-10-01 19:40:50 UTC
Marble looks interesting but it depends on Qt4.x.
Comment 44 caulier.gilles 2006-10-01 19:50:30 UTC
Look interressing. Sound like Marble tool use a local ressource maps. Right ?

Actually, i'm working to finalize an interface to google maps, with of course an hight precision. Take a look of the fresh screenshot at this url:

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

Gilles Caulier

Comment 45 Marc Cramdal 2006-10-01 21:41:34 UTC
> Actually, i'm working to finalize an interface to google maps, with of course an hight precision. Take a look of the fresh screenshot at this url:
>
> http://digikam3rdparty.free.fr/Screenshots/newkipigpssyncplugin.png
>

This is what I ever wanted to have !!!!

Thanks a lot :-)