From bdecafa5bd65da43f59d6be6abec2d608274398b Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 17 Nov 2010 10:58:22 +0100 Subject: [PATCH] draw icons of the points of interest loaded from a .osm file --- icons/atm.png | Bin 0 -> 548 bytes icons/bank.png | Bin 0 -> 611 bytes icons/bus_stop.png | Bin 0 -> 522 bytes icons/cinema.png | Bin 0 -> 616 bytes icons/drinking_water.png | Bin 0 -> 437 bytes icons/fuel.png | Bin 0 -> 505 bytes icons/hospital.png | Bin 0 -> 477 bytes icons/hostel.png | Bin 0 -> 502 bytes icons/hotel.png | Bin 0 -> 467 bytes icons/museum.png | Bin 0 -> 516 bytes icons/parking.png | Bin 0 -> 453 bytes icons/pharmacy.png | Bin 0 -> 342 bytes icons/recycling.png | Bin 0 -> 599 bytes icons/speed_camera.png | Bin 0 -> 456 bytes icons/telephone.png | Bin 0 -> 673 bytes icons/toilets.png | Bin 0 -> 647 bytes icons/viewpoint.png | Bin 0 -> 636 bytes poilayer.cpp | 25 ++++++++++++++++++++----- poilayer.h | 2 ++ 19 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 icons/atm.png create mode 100644 icons/bank.png create mode 100644 icons/bus_stop.png create mode 100644 icons/cinema.png create mode 100644 icons/drinking_water.png create mode 100644 icons/fuel.png create mode 100644 icons/hospital.png create mode 100644 icons/hostel.png create mode 100644 icons/hotel.png create mode 100644 icons/museum.png create mode 100644 icons/parking.png create mode 100644 icons/pharmacy.png create mode 100644 icons/recycling.png create mode 100644 icons/speed_camera.png create mode 100644 icons/telephone.png create mode 100644 icons/toilets.png create mode 100644 icons/viewpoint.png diff --git a/icons/atm.png b/icons/atm.png new file mode 100644 index 0000000000000000000000000000000000000000..9df1df9a05617fc3e16a031951fa69cf35b69c45 GIT binary patch literal 548 zcmV+<0^9wGP)Px#32;bRa{vGh*8l(w*8xH(n|J^K00(qQO+^RT0U8wu5s3L=$N&HUG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-In24YJ`L;(K){{a7>y{D4^00Cr4L_t(2Q+3k6O9EjW$8r0AtmRDX%s?YcrSeQ6 z`k_Qn6c|xKQ4mBei4heyv?y}JaiA9wr?><~pe{Nn4S^zZUPEg`lb_Bf@-(~QJv`6z zy65{0XHXOcrBVsGTu!$_p#asj3~lTU?!mfw-^skh_N)gdHZ(jRjv{ailIQRVBhCdl zLQ(iGKgb@veASO<&R#*8Ot9EzLAye5A3W;gsoe)q6a||%3_ttTnf5Q9yZKb%7WrV9 zcBoH!*2lk%uU=zxdL8uSqCWN%nGDit38E-MmSyDgc_fobQYw|wa6BG| zAPD4^NaP%iMg!Gq73Ff7RH;-n9E-)ss6--xJEIY`T8;cX-PP;$emukupja$|W!aw8 my&v2@?7pShY_`Y#t@RBz-~B%(&SK&K0000Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RT3JeJkFA+zH;s5{uG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-In24YJ`L;(K){{a7>y{D4^00E;(L_t(2Q;pKUYr;?v2k@i;({^x?PHk}z2P-0o z3c93I+rKX%$Pim}7HBFTythBasNq=W~k3<1v)WWw6`rCRE5;3~RzG6Osi^r<2Y( zo6YD4>h-!cwApOna5%v4_d}sjfa!D!s;XMUVzCJL6F|G&hF-5nJJxD7YZwZJ=xLHp xi^T#OjRxI;B{Waa<#ItXncP2BYxrBf!!HLMCOvd6O-KL$002ovPDHLkV1hH@^t1o~ literal 0 HcmV?d00001 diff --git a/icons/bus_stop.png b/icons/bus_stop.png new file mode 100644 index 0000000000000000000000000000000000000000..715105384bb35354c564ae60cdce7eff782531d4 GIT binary patch literal 522 zcmV+l0`>igP)00001b5ch_0Itp) z=>Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RT3<3clBWqzUj{pDwG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-In24YJ`L;(K){{a7>y{D4^00Bx#L_t(2&y|zGih@uShBabrCkFZunHyKOs^~2e zte{uOXK)$8&yl{q^hcg5c=(Q`*pm3-zf}3!m5nNV?G{_97WMxsL{uY9S(;( zG)$7@BIdrX*XygOp)Z)(nf5);yNVpVk(B)!SozU|K7{1#9Q{)D2d_;m`RHd9egFUf M07*qoM6N<$g0c7C=Kufz literal 0 HcmV?d00001 diff --git a/icons/cinema.png b/icons/cinema.png new file mode 100644 index 0000000000000000000000000000000000000000..ac50653ad0032a838d28d75945afae52801aea07 GIT binary patch literal 616 zcmV-u0+;=XP)Px#32;bRa{vGh*8l(w*8xH(n|J^K00(qQO+^RT0TU7=I%PAeDF6TfG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-Iox=BPqR5;6HV88)X7#P?^xVfW%OeO|WfG9V&goub(r>Kb7`#?|6|KeO+{zPdM z;o>q86PMa3A};kwB&z6#(A<;%g_@WD*Eck|PLu)uUS4md{1g8PEx-0(X!UJ4wsH6S zEY8VkLC^q@Q{`+tJ|b%tT6OEcw0F#ZZ!hl$#5jV<+tcTb(8Qhpg_d0UFOt#vM@&ZX zyNHHa4st?*4mSoDvttLuND5*C7nI6ArQ6p>NTiee)HtiEw^eP>{XE)7O>#2BV}X7w?|x53hkjCMB*BCC>S|xv6<249-QVi6yBi3gww4 z844j8sS56%z5!f5naQbn#i>>b0i{VfnaM8sxrv#1T=JXDZUgnRC3(BMF#HF>1$&oI z28w+3ba4!kknBBZsO?h7!0_RI@q6AmOL)XynU$K|Y;C-0Zg{HQKyppj(InCN4(gF} z9F07@VlFdF`Y=0r~YH`R+@UBb_`{khJgek literal 0 HcmV?d00001 diff --git a/icons/fuel.png b/icons/fuel.png new file mode 100644 index 0000000000000000000000000000000000000000..08fda2aacb8902221993d1a006bfafc897e67f8e GIT binary patch literal 505 zcmVPx#32;bRa{vGf6951U69E94oEQKA00(qQO+^RT3<3ck3ULjb-v9srG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-In24YJ`L;(K){{a7>y{D4^00B8kL_t(2k(JM}Y63wJfZ^TB!dfgv1PigWu?ie$ zp{w>H*ty<;*xQJmt&d=v#+(S*pl{(>T|me~Bv$*|oJONDmw~_hm>B_xs08o?yaK@= z`QifRBJ?>PkFAvQZpmcQ0>LFL0KsatvYAYVd_K>7KEFz9jSvE0cLR&XqLorotJU~9 zi^bvwCV(msX0ur%UxmCO{#R64!_l=ltB<)VvY~=c3falGGH1^30M9 zg^-L?1$R&104|@*$@q@#;hA*a55BSIM1O`o-Z8nf_}rONg(WLzoo)UBDHc7`WwDe46ttaBPON2z_@e(W?l6|vnSF&%`(9x$f5D}A^T2dNV{?;9274X9Og;8ygU$Te zADo?wH|52t)bi(+-I(+J%`@#YKfgSGGD9KqtwFBPUbS192kVN>9y2L;F~nVcDR~bV ObPS%ZelF{r5}E*8Rl!>T literal 0 HcmV?d00001 diff --git a/icons/hostel.png b/icons/hostel.png new file mode 100644 index 0000000000000000000000000000000000000000..2e594e3ae0ee88a2b62ce4ec3fad51ce20cbf13a GIT binary patch literal 502 zcmVPx#32;bRa{vGf6951U69E94oEQKA00(qQO+^RT0TCAkG19zjA^-pYG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-IoNJ&INR5;6}lQFA;P!z{4nj9M`yvI9u+X0xHDBuRKapN$T9p2uu9gRblJ>~8=v)A4v*CA+TM z01Ssi>XBSh_y+Ji52k6N-|y4;E|*Jew_A3=>(*6Oh41^{PJs!qTCETSK?T_F_n1s3 sREx!edU>AH_dz_eJ{}MD-}ouM0Q#}VBKs}ItN;K207*qoM6N<$f-0lYQvd(} literal 0 HcmV?d00001 diff --git a/icons/hotel.png b/icons/hotel.png new file mode 100644 index 0000000000000000000000000000000000000000..18f7cc85302bf2d8a0a930705533ddef74ac716b GIT binary patch literal 467 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sf4MssG3F$X&D}eG0CMB*BCC>S|xv6<249-QVi6yBi3gww4 z844j8sS56%z5!f5naQbn#i>>b0i{VfnaM8sxrv#1T=JXDZUgnRC3(BMF#HF>1$&oI z2D(Dn)5S5w;`H0#-CfNAB6G4s1azA@xXR34>i%J#_@|?FX~Yu2KirO=6vM*8ULJ7> z5Yf?jn^TihlE_^yK56US#?vz|pPBi2M@k)&wL_x%KUOm)M}Y?=RtG=txh^W#f4s(S z{_{;b(@X32-hOMgpJ~_o>X1;@K#_$ST(g!P{8-@J74$wXrGE_y_L$Q@7DDUyJa`N`z@1s4;Ww!p00i_>zopr E0BXOsPyhe` literal 0 HcmV?d00001 diff --git a/icons/museum.png b/icons/museum.png new file mode 100644 index 0000000000000000000000000000000000000000..f05e3218cf75829e8f528b95f3f62fd70d786f42 GIT binary patch literal 516 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?i-C%- zgD|6$#_S59AbW|YuPgfvCJr%Kxe2TXF93y1N?apKobz*YQ}ap~oQqNuOHxx5$}>wc z6hbmm72G|21Gs!LlT-7GQ>_#NN|SOjlU?$26EpL;ARQrdbcFVuz$#Y%_?;}N@~%?9l`C{0sJ=N@e8=0?22P^bj{1u;#l&p zLF}OAFLtN9(o&0-ab$61WvyJ;wv78-)i1kG+*zI0i&P&jj(_s=A4~0;kbj?6gsnC< zur6^FV2PX6tm_)+XM6rNyW@v@876uK`O?oGR(p!L#znQ*#$I2)NF&K}(gvN=5rHC0 zZO%u|TDIo)+f8YkD|@&8R+w_QAZq3H*JliP(ju<~{D`{eSU!_~#+KaKM+7k!TX4@oCY1tr%VyzI(+fO)N|x=bTgUfB<9LDdPmZEf z=>-lyJMF*h=W&o&eKqU&Bo*G2NWFr+t>LHmKY09PeW&^Tf~9+T6Mx3+WhW0A=p?@W zcjEispw(9&{Z5$9KOtdq&VFVdQ&MBb@ E0HsLNiU0rr literal 0 HcmV?d00001 diff --git a/icons/parking.png b/icons/parking.png new file mode 100644 index 0000000000000000000000000000000000000000..68d704726defe4a0eaf398dfeeb0abf2eb8c5c9d GIT binary patch literal 453 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?i-C%- zgD|6$#_S59AbW|YuPgfvMrmFt)oOzRW}uKsiEBiObAE1aYF-J0b5UwyNotBhd1gt5 zLP$ocg1e`00GCf@a%x_2s+B@OX;MyRvP*t$VrCwf{3f&8Ks&`fT^vI!dXs1D%JBEi zI(#i#W5+xTo9ds9d~Iu{y}d5klm1VgJ>4{aKc~?HwoM5xPv`w-wLSj8V)y40^~b-Q z{V(Zjzz z&G)zUF?Z_>{4(u+{C{vWJwd-E{LMiV1@>;n7Z0AV-~WGh+Wez(+&6eC{(L%Je|Uvy z!W!|7&+O;lty%MuA?-k}Q(^UV)cr=)u*i>F{v>0Dp zU@M@sdL@g~9JVJ+idH9>oNh@y;Axo|utSLB;=v+?mXpnUIuZ{kDX55@VL$XRqk&mq znUkW%feQzNKysIkDEP3Sn53ZY=h(c>q2qExt-}pBr91pB3Cs5r00001b5ch_0Itp) z=>Px#32;bRa{vGh*8l(w*8xH(n|J^K00(qQO+^RT0TC4=9=SILF#rGnG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-In24YJ`L;(K){{a7>y{D4^00EatL_t(2&y~?XNYrr{2Jlarf9m2ovND3gEh3?a zNIat=8r0!RDu>j|3X+7&(1bJbDnd%g2#oZWqV1X*qQ%L%ID)_>sHvKyhR7kKUxV_q z>wX2j@GQ^!yzl!w-!FgGeo5!t*KAm;X9m1l#!D?a{j+LpcHI|wfd>N3o|+WMFJsia zH8x^v^nxzap*Sy)_DHXp60XNbaeK;#V|KaiM<~4In_4^6+wG3Uknb|}w*adhan`U; z@&fH{fVh;jIYZv-GpE`n3Hw&Y;*RT7a7jV8C#ZAO2-cOI*lwqbo*Nf9plyk)kZ{d> zXtCYRNPl&jjQJkw2E9c!r;L_7(p3w#sE>@8Q7qB6$>sn(#B! zcgRsC;er{1-Z*J2(teW@);kDJyJtXA+6$F7ED0J-$og7_l)I=gyAoVC9R;}Y={<@Q6ZzK&ujf= lo$(l}{8u$dS}PgV`UUV3r}}sxpick*002ovPDHLkV1k>l0%HIG literal 0 HcmV?d00001 diff --git a/icons/speed_camera.png b/icons/speed_camera.png new file mode 100644 index 0000000000000000000000000000000000000000..33bf9cc265bac4fc5935f84f1209f96b0c3840cd GIT binary patch literal 456 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgfvPF`^)m0R=oz5ohImbgZgIOpf) zrskC}I2WZRmZYXAlxLP?D7bt2281{Ai36=t_H=O!u{gbS^1{Am2NBovIoGaT32itg z+MM0&7^d`#vBojj^H9R;AN{N97*$GnIlD|0S2Dyq2K~MEMrfDL?YrO9{Lh>|Q~Ukg z* zZCSomPOC!eSonu~_G_+Z`&>@hf4_KV%s=-DDx7_f3#{f^$o1=pb@v@9y?dO+Q6NEr z?fPp`hWp=dzAd|ZROj?Nxw>43@9e&pA5_X+ekpRiaK-Ci`6p}iCg0em`}}ic-uBrl wo=Oc2i?&X?e<4z%i|O>HdEO7F_Wolya%5)P(!&=f0>hNS)78&qol`;+0BbA1N&o-= literal 0 HcmV?d00001 diff --git a/icons/telephone.png b/icons/telephone.png new file mode 100644 index 0000000000000000000000000000000000000000..c4fe3b9b5951ca92c886ed2e897ebea50cbdbc47 GIT binary patch literal 673 zcmV;S0$%-zP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RT3<3Zv1zTDejsO4vG;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-In24YJ`L;wH)0002_L%V+f00H4iL_t(I%Z-zdhp%7g6_kcgL~+pJMq(d< z2no`V7}D$zZn=o! zoxY-e3e1}Xyw#^lrNR_!IoWJhUx<2hJ{mZL7fLaxDevbXs5g{r)G;lEA)IpsMOp zkjZ4oWHM2&*V|oS?4VdIQoUYBnRXWh0s$^ynx--A=inXOfMc+?Rgg#|bb-(3lY%>N zuuBefLAhMk1)O%f%_VQ(0$8^Rcu*d?-R`#(@C>YUu`x)0!8MqAz24;@o6RN}y3kfo zjRHQP6Y#>5CzaWIR=<0K`8LSeycoLnw9L&Rrd-;ol<@Hg^8 zXFMLy-EQ{+f^US0#bPlQ4u`2)trD_Ap-_lMqtQ&x$2br^?HK3}27`soW|KqJyRld- zR4SDy5{Z!0>71_Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RT0TU7(CkU}iN&o-=G;~E+bVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;8Fb7eXpP<3K#X=6lhZDDC{3LmmI z+W-Io*-1n}R5*>LlD*5hQ5?pJWOycn(IPLAmrw|UfrL;78Hh#R%H$<4gR;qDu=x`h zr3{LR#Ue3@#2+9@=z6-3+)u)9`F-oueeUZzpYuJ}ISl+~F`ggu`5ftV8jHn(788jC z>~=dn?{>TJdc9aKm+yc;AOHq~flw$!i*C0YLZOhJ8w>{GDVNLdfZ=cmhr@x6F!&3x zQmKH)mUJsp4=N<5= h&gU~ur_;YI_ytm}+HxC)(oO&X002ovPDHLkV1kP?650R& literal 0 HcmV?d00001 diff --git a/icons/viewpoint.png b/icons/viewpoint.png new file mode 100644 index 0000000000000000000000000000000000000000..b18660c86a7fb794a172e3bf1d2673487823034d GIT binary patch literal 636 zcmV-?0)zdDP)Lk-uvbaTvxw?>Be3ODx(h zLUE~sh1N|(#4awyUV z1kJp)9Uk}My*2bULVUCA22i~TFgB1l7op>#YR5^eLM7j1%=UtMSX)(L1pwtl(^t^} z5p01qtZ;Ta^GCtNb4oGnA%qW#bo(c9e-+RJe2yZ?N7gx>Y$O;3xzQ3HvO! zv{9)iopnUoiTGqhUPmH}c2It@^{RUCvf(5Tf(D>Qp-WW0S+=z<09QO5%eV*DlGW9z zDMEmp=bn!YU8v53Ig>9`h5>vZv$5oM8Dsy*&uo6(@rap}a|xAOMj33gtBaeV`yO;U zUkFB8vt|c)7|b0pd~d5(U-&bWQC3vtawhFe?piQ%HrXj6*9C1y^_@RQ|L+r&fJjg%8DzR?*R1fN!WYm`QD>*Mx0Lnby<_QQy44>&Wgp9ViN0Oof6-4P W;nl(lK4vQb0000 #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; };