Index: MainWindow.h
===================================================================
--- MainWindow.h	(revision 10371)
+++ MainWindow.h	(working copy)
@@ -21,6 +21,10 @@
 class TrackMapLayer;
 class TrackSegment;
 
+#ifdef GEOIMAGE
+class GeoImageDock;
+#endif
+
 class MainWindow : public QMainWindow, public Ui::MainWindow
 {
 	Q_OBJECT
@@ -124,6 +128,9 @@
 		PropertiesDock* properties();
 		InfoDock* info();
 		QGPS* gps();
+		#ifdef GEOIMAGE
+		GeoImageDock* geoImage();
+		#endif
 		MapDocument* document();
 		//MapLayer* activeLayer();
 		MapView* view();
@@ -157,6 +164,9 @@
 		InfoDock* theInfo;
 		DirtyDock* theDirty;
 		LayerDock* theLayers;
+		#ifdef GEOIMAGE
+		GeoImageDock* theGeoImage;
+		#endif
 		QGPS* theGPS;
 		QDomDocument* theXmlDoc;
 
Index: PropertiesDock.cpp
===================================================================
--- PropertiesDock.cpp	(revision 10371)
+++ PropertiesDock.cpp	(working copy)
@@ -16,6 +16,10 @@
 #include "Map/RoadManipulations.h"
 #include "Map/TrackPoint.h"
 
+#ifdef GEOIMAGE
+#include "GeoImageDock.h"
+#endif
+
 #include <QtCore/QTimer>
 #include <QtGui/QHeaderView>
 #include <QtGui/QLineEdit>
@@ -205,8 +209,14 @@
 		for (unsigned int i=0; i<FullSelection.size(); ++i)
 			if (MultiUi.SelectionList->item(i)->isSelected())
 				Selection.push_back(FullSelection[i]);
-		if (Selection.size() == 1)
+		if (Selection.size() == 1) {
 			Main->info()->setHtml(Selection[0]->toHtml());
+
+			#ifdef GEOIMAGE
+			TrackPoint *Pt;
+			if ((Pt = dynamic_cast<TrackPoint*>(Selection[0]))) Main->geoImage()->setImage(Pt->getImageId());
+			#endif
+		}
 		theModel->setFeature(Selection);
 		MultiUi.lbStatus->setText(tr("%1/%2 selected item(s)").arg(Selection.size()).arg(FullSelection.size()));
 		Main->view()->update();
@@ -364,6 +374,10 @@
 			TrackPointUi.TagView->setModel(theModel);
                         TrackPointUi.TagView->setItemDelegate(delegate);
 			resetTagComboBox(TrackPointUi.Amenity,Pt,"amenity");
+
+			#ifdef GEOIMAGE
+			Main->geoImage()->setImage(Pt->getImageId());
+			#endif
 		}
 		else if (Road* R = dynamic_cast<Road*>(FullSelection[0]))
 		{
@@ -386,6 +400,9 @@
 	else if (FullSelection.size() > 1)
 	{
 		Main->info()->setHtml("");
+		#ifdef GEOIMAGE
+		Main->geoImage()->setImage(-1);
+		#endif
 		MultiUi.TagView->setModel(theModel);
 		MultiUi.TagView->setItemDelegate(delegate);
 	}
Index: MainWindow.cpp
===================================================================
--- MainWindow.cpp	(revision 10371)
+++ MainWindow.cpp	(working copy)
@@ -46,6 +46,10 @@
 #include "QMapControl/mapadapter.h"
 #include "QMapControl/wmsmapadapter.h"
 
+#ifdef GEOIMAGE
+#include "GeoImageDock.h"
+#endif
+
 #include "Render/NativeRenderDialog.h"
 #ifdef OSMARENDER
 	#include "Render/OsmaRenderDialog.h"
@@ -108,6 +112,12 @@
 	theDirty = new DirtyDock(this);
 	theGPS = new QGPS(this);
 
+	#ifdef GEOIMAGE
+	theGeoImage = new GeoImageDock(this);
+	theGeoImage->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+	addDockWidget(Qt::RightDockWidgetArea, theGeoImage);
+	#endif
+
 	connect (theDocument, SIGNAL(historyChanged()), theDirty, SLOT(updateList()));
 	connect (theLayers, SIGNAL(layersChanged(bool)), this, SLOT(adjustLayers(bool)));
 
@@ -223,6 +233,13 @@
 	return theInfo;
 }
 
+#ifdef GEOIMAGE
+GeoImageDock* MainWindow::geoImage()
+{
+	return theGeoImage;
+}
+#endif
+
 MapDocument* MainWindow::document()
 {
 	return theDocument;
@@ -404,7 +421,7 @@
 	MerkaartorPreferences::instance()->setWorkingDir(QDir::currentPath());
 }
 
-
+#ifndef GEOIMAGE
 #define FILTER_OPEN_SUPPORTED \
 	tr("Supported formats (*.mdc *.gpx *.osm *.osb *.ngt *.nmea *.nme)\n" \
 	"Merkaartor document (*.mdc)\n" \
@@ -414,6 +431,18 @@
 	"Noni GPSPlot format (*.ngt)\n" \
 	"NMEA GPS log format (*.nmea *.nme)\n" \
 	"All Files (*)")
+#else
+#define FILTER_OPEN_SUPPORTED \
+	tr("Supported formats (*.mdc *.gpx *.osm *.osb *.ngt *.nmea *.nme *.jpg)\n" \
+	"Merkaartor document (*.mdc)\n" \
+	"GPS Exchange format (*.gpx)\n" \
+	"OpenStreetMap format (*.osm)\n" \
+	"OpenStreetMap binary format (*.osb)\n" \
+	"Noni GPSPlot format (*.ngt)\n" \
+	"NMEA GPS log format (*.nmea *.nme)\n" \
+	"Geotagged images (*.jpg)\n" \
+	"All Files (*)")
+#endif
 #define FILTER_IMPORT_SUPPORTED \
 	tr("Supported formats (*.gpx *.osm *.osb *.ngt *.nmea *.nme)\n" \
 	"GPS Exchange format (*.gpx)\n" \
@@ -556,11 +585,22 @@
 
 void MainWindow::loadFiles(const QStringList & fileList)
 {
-	if (fileList.isEmpty())
-		return;
 
 	QStringList fileNames(fileList);
 
+#ifdef GEOIMAGE
+	QStringList images = fileList.filter(".jpg", Qt::CaseInsensitive);
+	if (!images.isEmpty()) {
+		theGeoImage->loadImages(images, theDocument, theView);
+		QString cur;
+		foreach (cur, images)
+			fileNames.removeAll(cur);
+	}
+#endif
+	
+	if (fileNames.isEmpty())
+		return;
+
 	QApplication::setOverrideCursor(Qt::BusyCursor);
 	theLayers->setUpdatesEnabled(false);
 	view()->setUpdatesEnabled(false);
@@ -571,6 +611,7 @@
 	while (it.hasNext())
 	{
 		const QString & fn = it.next();
+
 		if (fn.endsWith(".mdc") == false)
 			continue;
 
Index: Merkaartor.pro
===================================================================
--- Merkaartor.pro	(revision 10371)
+++ Merkaartor.pro	(working copy)
@@ -9,6 +9,7 @@
 # NODEBUG             - no debug target
 # OSMARENDER          - enable osmarender
 # MOBILE              - enable MOBILE
+# GEOIMAGE            - enable geotagged images (needs exiv2)
 
 TEMPLATE = app
 TARGET = merkaartor
@@ -118,4 +119,9 @@
     }
 }
 
+count(GEOIMAGE, 1) {
+	DEFINES += GEOIMAGE
+	LIBS += -lexiv2
+	include(GeoImage.pri)
+}
 
Index: Map/TrackPoint.cpp
===================================================================
--- Map/TrackPoint.cpp	(revision 10371)
+++ Map/TrackPoint.cpp	(working copy)
@@ -9,6 +9,9 @@
 TrackPoint::TrackPoint(const Coord& aCoord)
 : Position(aCoord), Elevation(0.0), Speed(0.0)
 {
+	#ifdef GEOIMAGE
+	ImageId = -1;
+	#endif
 }
 
 TrackPoint::TrackPoint(const TrackPoint& other)
@@ -52,6 +55,18 @@
 	Elevation = aElevation;
 }
 
+#ifdef GEOIMAGE
+void TrackPoint::setImageId(int aImageId)
+{
+	ImageId = aImageId;
+}
+
+int TrackPoint::getImageId(void) const
+{
+	return ImageId;
+}
+#endif // GEOIMAGE
+
 bool TrackPoint::notEverythingDownloaded() const
 {
 	return lastUpdated() == MapFeature::NotYetDownloaded;
@@ -62,10 +77,23 @@
 	return CoordBox(Position,Position);
 }
 
+#ifndef GEOIMAGE
 void TrackPoint::draw(QPainter& /* thePainter */, const Projection& /*theProjection*/ )
 {
 }
+#else
+void TrackPoint::draw(QPainter& thePainter, const Projection& theProjection )
+{
+	if (ImageId != -1) {
+		QPointF me = theProjection.project(position());
+		thePainter.setPen(QPen(QColor(0, 0, 0), 2));
+		QRectF box(me - QPointF(5, 3), me + QPointF(5, 3));
+		thePainter.drawRect(box);
+	}
+}
+#endif // GEOIMAGE
 
+
 void TrackPoint::drawFocus(QPainter& thePainter, const Projection& theProjection)
 {
 	thePainter.setPen(MerkaartorPreferences::instance()->getFocusColor());
Index: Map/ImportGPX.cpp
===================================================================
--- Map/ImportGPX.cpp	(revision 10371)
+++ Map/ImportGPX.cpp	(working copy)
@@ -88,6 +88,7 @@
 		if (!t.isNull() && t.tagName() == "trkpt")
 		{
 			TrackPoint* Pt = importTrkPt(t,theDocument, theLayer, theList);
+			Pt->setParent(S);
 			if (MakeSegment)
 				S->add(Pt);
 			progress.setValue(progress.value()+1);
Index: Map/TrackPoint.h
===================================================================
--- Map/TrackPoint.h	(revision 10371)
+++ Map/TrackPoint.h	(working copy)
@@ -39,6 +39,11 @@
 		double elevation() const;
 		void setElevation(double aElevation);
 
+		#ifdef GEOIMAGE
+		int getImageId() const;
+		void setImageId(int aImageId);
+		#endif
+
 		virtual void partChanged(MapFeature* F, unsigned int ChangeId);
 
 		virtual QString toXML(unsigned int lvl=0, QProgressDialog * progress=NULL);
@@ -57,6 +62,9 @@
 
 		double Elevation;
 		double Speed;
+		#ifdef GEOIMAGE
+		int ImageId;
+		#endif
 };
 
 #endif
