diff --git a/icons/atm.png b/icons/atm.png new file mode 100644 index 0000000..9df1df9 Binary files /dev/null and b/icons/atm.png differ diff --git a/icons/bank.png b/icons/bank.png new file mode 100644 index 0000000..88877e4 Binary files /dev/null and b/icons/bank.png differ diff --git a/icons/bus_stop.png b/icons/bus_stop.png new file mode 100644 index 0000000..7151053 Binary files /dev/null and b/icons/bus_stop.png differ diff --git a/icons/cinema.png b/icons/cinema.png new file mode 100644 index 0000000..ac50653 Binary files /dev/null and b/icons/cinema.png differ diff --git a/icons/drinking_water.png b/icons/drinking_water.png new file mode 100644 index 0000000..d71b38e Binary files /dev/null and b/icons/drinking_water.png differ diff --git a/icons/fuel.png b/icons/fuel.png new file mode 100644 index 0000000..08fda2a Binary files /dev/null and b/icons/fuel.png differ diff --git a/icons/hospital.png b/icons/hospital.png new file mode 100644 index 0000000..d70bd06 Binary files /dev/null and b/icons/hospital.png differ diff --git a/icons/hostel.png b/icons/hostel.png new file mode 100644 index 0000000..2e594e3 Binary files /dev/null and b/icons/hostel.png differ diff --git a/icons/hotel.png b/icons/hotel.png new file mode 100644 index 0000000..18f7cc8 Binary files /dev/null and b/icons/hotel.png differ diff --git a/icons/museum.png b/icons/museum.png new file mode 100644 index 0000000..f05e321 Binary files /dev/null and b/icons/museum.png differ diff --git a/icons/parking.png b/icons/parking.png new file mode 100644 index 0000000..68d7047 Binary files /dev/null and b/icons/parking.png differ diff --git a/icons/pharmacy.png b/icons/pharmacy.png new file mode 100644 index 0000000..5d765a1 Binary files /dev/null and b/icons/pharmacy.png differ diff --git a/icons/recycling.png b/icons/recycling.png new file mode 100644 index 0000000..b0a03af Binary files /dev/null and b/icons/recycling.png differ diff --git a/icons/speed_camera.png b/icons/speed_camera.png new file mode 100644 index 0000000..33bf9cc Binary files /dev/null and b/icons/speed_camera.png differ diff --git a/icons/telephone.png b/icons/telephone.png new file mode 100644 index 0000000..c4fe3b9 Binary files /dev/null and b/icons/telephone.png differ diff --git a/icons/toilets.png b/icons/toilets.png new file mode 100644 index 0000000..5c0e3a4 Binary files /dev/null and b/icons/toilets.png differ diff --git a/icons/viewpoint.png b/icons/viewpoint.png new file mode 100644 index 0000000..b18660c Binary files /dev/null and b/icons/viewpoint.png differ diff --git a/poilayer.cpp b/poilayer.cpp index 3193c85..85292bf 100644 --- a/poilayer.cpp +++ b/poilayer.cpp @@ -22,7 +22,9 @@ #include "mapwidget.h" #include "projection.h" +#include #include +#include #include PoiLayer::PoiLayer(MapWidget *map) : @@ -30,8 +32,15 @@ PoiLayer::PoiLayer(MapWidget *map) : m_points(), m_pointsOnScreen(), m_icons(), - m_pointsOffset(0, 0) + m_pointsOffset(0, 0), + m_iconPath(), + m_iconCache() { + QSettings set(QDir::homePath()+"/Maps/nanomap.conf", QSettings::NativeFormat); + + set.beginGroup("poi"); + m_iconPath = set.value("iconpath", "/usr/share/NanoMap/icons").toString(); + set.endGroup(); } void PoiLayer::load(const QString &filename) @@ -83,9 +92,15 @@ void PoiLayer::load(const QString &filename) foreach (const QString &c, categories) { QString t = tags.value(c, ""); if (!t.isEmpty()) { - m_points << pos; - m_icons << t; - break; + QString icon = m_iconPath+"/"+t+".png"; + if (QFile::exists(icon)) { + if (!m_iconCache.contains(t)) { + m_iconCache.insert(t, new QPixmap(icon)); + } + m_points << pos; + m_icons << t; + break; + } } } tags.clear(); @@ -120,7 +135,7 @@ void PoiLayer::paint(QPainter *painter) QPoint p; for (int i = 0; i < m_pointsOnScreen.count(); ++i) { p = m_pointsOnScreen.at(i); - painter->drawEllipse(p + m_pointsOffset, 5, 5); + painter->drawPixmap(p + m_pointsOffset, *m_iconCache.value(m_icons.at(i))); } } diff --git a/poilayer.h b/poilayer.h index a3c76f0..4527b6e 100644 --- a/poilayer.h +++ b/poilayer.h @@ -42,6 +42,8 @@ private: QList m_pointsOnScreen; QStringList m_icons; QPoint m_pointsOffset; + QString m_iconPath; + QHash m_iconCache; };