[Digikam-devel] [Bug 111560] Be able to locate photos on a map

Gilles Caulier caulier.gilles at free.fr
Thu Sep 28 11:52:08 BST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=111560         




------- Additional Comments From caulier.gilles free fr  2006-09-28 12:52 -------
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:



More information about the Digikam-devel mailing list