From ea7c30d5b287515d6bfe2e1ad8ac74300778e497 Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Sun, 3 Apr 2016 14:12:45 +0200 Subject: [PATCH] use current SVG version of OSM logo instead of PNG version of the old logo --- INSTALL | 2 +- images/osm-logo.svg | 3572 +++++++++++++++++++--- ocitysmap/layoutlib/abstract_renderer.py | 14 +- 3 files changed, 3146 insertions(+), 442 deletions(-) diff --git a/INSTALL b/INSTALL index 7398c40c..1d5ef1f5 100644 --- a/INSTALL +++ b/INSTALL @@ -259,7 +259,7 @@ are using. They have been tested on several x86_64 hosts. sudo aptitude install python-psycopg2 python-gdal \ python-gtk2 python-cairo \ - python-shapely + python-shapely python-rsvg Note that python-gtk2 is not needed for any graphical interface, but because it contains Pango and PangoCairo that we use to render diff --git a/images/osm-logo.svg b/images/osm-logo.svg index 9fc61c25..a14487f3 100644 --- a/images/osm-logo.svg +++ b/images/osm-logo.svg @@ -1,276 +1,2651 @@ - + + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="256" + height="256" + id="svg3038" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="Public-images-osm_logo.svg" + inkscape:export-filename="/home/fred/bla.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" + sodipodi:version="0.32" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + OpenStreetMap logo 2011 + id="defs3040"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="linearGradient8290"> + style="stop-color:#000000;stop-opacity:1;" + offset="0" + id="stop8292" /> + style="stop-color:#000000;stop-opacity:0;" + offset="1" + id="stop8294" /> + id="linearGradient8297"> + + + + + + + + id="stop5753-6-08" + offset="0.83932751" + style="stop-color:#d0e9f2;stop-opacity:0;" /> + style="stop-color:#d0e9f2;stop-opacity:0.28185329;" + offset="0.94308507" + id="stop5755-9-5" /> + + + + - - - - - - - - - - - - - - - - 001001000111 - - - 001001000111 - - - 001001000111 - - - 001001000111 - - - 001001000111 - + xlink:href="#linearGradient5745-3-1" + id="radialGradient8621" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.80254238,0.77986154,0.80254238,-0.82522321,-10.401684,73.423363)" + cx="128" + cy="86" + fx="128" + fy="86" + r="47" /> + + + + + + + + + + + + + + + + + + + + + inkscape:window-width="1265" + inkscape:window-height="720" + inkscape:window-x="101" + inkscape:window-y="25" + inkscape:window-maximized="1" /> - + id="metadata3043"> + - image/svg+xml + rdf:about=""> + image/svg+xml + OpenStreetMap logo 2011 + + + Ken Vermette + + + + April 2011 + + + OpenStreetMap.org + + + Replacement logo for OpenStreetMap Foundation + + + OSM openstreetmap logo + + + http://wiki.openstreetmap.org/wiki/File:Public-images-osm_logo.svg + + + + + + + + + + + + + + - - - - + inkscape:label="map_details" + sodipodi:insensitive="true" + style="display:inline"> + style="fill:#ceeeab;fill-opacity:1;stroke:none" + d="M 9,2.25 C 9,2.25 16.5,15.25 20.75,30 C 25,44.75 27,55.5 27,55.5 C 27,55.5 21.5,68.25 18.75,80.25 C 16,92.25 13,103.25 13,103.25 C 13,103.25 18.75,119.25 22.25,133.25 C 25.75,147.25 26,157.5 26,157.5 C 26,157.5 22,167.75 18.5,181.75 C 15,195.75 13.5,212.5 13.5,212.5 C 13.5,212.5 22.75,210.5 42,213.75 C 61.25,217 74.25,219.75 74.25,219.75 C 74.25,219.75 87,217 98.25,213.5 C 109.5,210 114.5,207 114.5,207 C 114.5,207 120,207.5 137,213.25 C 154,219 166.25,221.75 166.25,221.75 C 166.25,221.75 179.25,219 192.25,216 C 205.25,213 218.75,208 218.75,208 C 218.75,208 218,203 223,183.5 C 228,164 231.75,155.5 231.75,155.5 C 231.75,155.5 231.25,151 228,135.75 C 224.75,120.5 218,106 218,106 C 218,106 219.75,95.5 224.75,82.25 C 229.75,69 235,55.5 235,55.5 C 235,55.5 230.25,40.25 227.5,25.75 C 224.75,11.25 219.25,0 219.25,0 C 219.25,0 195,9 187.5,10.5 C 180,12 166.5,15.75 166.5,15.75 C 166.5,15.75 156.75,11.5 144.5,7.25 C 132.25,3 114.75,1.75 114.75,1.75 C 114.75,1.75 111.5,5.25 92.75,9.75 C 74,14.25 65.25,15.5 65.25,15.5 C 65.25,15.5 46.75,6.5 33.75,4 C 20.75,1.5 9.75,2 9,2.25 z" + id="path3834-9" /> + + + + style="fill:#aac3e7;fill-opacity:1;stroke:none" + d="M 158.53125,75.34375 C 153.77142,75.329407 149.5,76.3125 147,78.5 C 139,85.5 112,79.25 98.5,85.5 C 85,91.75 85.25,123.5 83.75,130 C 82.25,136.5 66.25,150.75 63.75,153.5 C 61.25,156.25 50.5,160.75 44.25,162 C 38,163.25 31.5,169.25 28.75,173 C 26.728876,175.75608 21.343981,179.45031 18.625,181.21875 C 18.5792,181.40003 18.54564,181.56743 18.5,181.75 C 18.366311,182.28475 18.25288,182.83331 18.125,183.375 C 23.104513,181.77018 29.304508,175.19549 34.75,169.75 C 41,163.5 54.75,162 62.5,158.25 C 70.25,154.5 76.75,138.5 89,134.5 C 101.25,130.5 110.25,146.25 113.25,153 C 116.25,159.75 115,165.75 117,170 C 119,174.25 128,181.75 128.5,183.5 C 129,185.25 123.5,190 122.25,192 C 121,194 111.75,199 110.5,200.75 C 109.53432,202.10195 108.57684,207.52314 108.1875,209.96875 C 108.60053,209.79955 108.94168,209.65822 109.3125,209.5 C 109.7965,206.97067 110.82799,202.42201 112.25,201 C 114.25,199 123.5,196.5 124.75,192.5 C 126,188.5 131.75,186 131.75,186 C 131.75,186 134.5,190 147.75,200 C 156.58333,206.66667 160.5081,215.53356 162.15625,220.71875 C 162.82985,220.8894 163.6892,221.12815 164.1875,221.25 C 162.96635,216.93129 159.35104,205.01115 155.25,200.5 C 150.25,195 136.75,189.75 132.5,178.5 C 128.25,167.25 108,144.25 115,138.25 C 122,132.25 131.5,134.25 143.5,145.75 C 155.5,157.25 189.75,151.5 201.25,149.5 C 211.20453,147.76878 222.08445,164.38321 225.15625,175.53125 C 225.74525,173.43558 226.28288,171.52906 226.8125,169.78125 C 225.07444,167.85545 223.11528,165.16129 221.5,161.5 C 217.75,153 209.5,148.25 209.5,148.25 C 209.5,148.25 218.25,143.25 224.25,140.5 C 225.86703,139.75886 227.25627,138.82287 228.4375,137.84375 C 228.27516,137.06972 228.17857,136.5879 228,135.75 C 227.9689,135.60389 227.938,135.45846 227.9063,135.3125 C 223.14065,140.8749 208.67404,144.92782 206.25005,146.25 C 203.50005,147.75 188.00005,149.25 170.50005,150.75 C 153.00005,152.25 143.75005,143.25 136.25005,136 C 128.75005,128.75 123.25005,100 133.25005,98 C 143.25005,96 153.25005,111.75 163.25005,115 C 173.25005,118.25 184.75005,99.25 183.00005,88 C 181.79693,80.265625 169.00292,75.375305 158.5313,75.34375 L 158.53125,75.34375 z M 105.1875,88.625 C 106.46283,88.6265 111.04688,90.21875 111.75,91 C 114,93.5 113.75,98.25 111.75,99 C 109.75,99.75 99,107 101.25,113.25 C 103.5,119.5 103,131.25 97.75,131.25 C 92.5,131.25 89.75,131.25 87.75,128.75 C 85.75,126.25 85.75,116.75 87.75,109 C 89.75,101.25 91.25,94 95.75,90.75 C 98.84375,88.51562 102.38177,88.621643 105.1875,88.625 L 105.1875,88.625 z M 118.78125,161.71875 C 118.9845,161.73245 120.6875,165.23438 123.5,168.75 C 126.5,172.5 126.75,177 126.75,177 C 126.75,177 122.5,172.25 120.75,169 C 119,165.75 118.75,161.75 118.75,161.75 C 118.75,161.7188 118.7678,161.7177 118.7812,161.7188 L 118.78125,161.71875 z" + id="path5280" /> + style="opacity:0.38695655;fill:none;stroke:#6d7f42;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 122.75,62.25 C 129,62.75 135,60 133.5,55.75 C 132,51.5 121,48.5 120.25,52.75 C 119.5,57 122.25,63.25 122.75,62.25 z" + id="path5319" /> - - - - - - - - + style="opacity:0.38695655;fill:none;stroke:#6d7f42;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 108.75,46.75 C 100.25,41.25 100.25,39.5 101.75,38.75 C 103.25,38 112,43.75 114.5,46.75 C 117,49.75 112.25,48.75 108.75,46.75 z" + id="path5321" /> + id="g5373" + clip-path="url(#clipPath5383)" + transform="translate(0,-10)"> + + id="path5311" + d="M 17.5,177.25 C 35.75,167.25 46.25,168.75 52.5,165.75 C 58.75,162.75 65.75,160 68.25,156.25 C 70.75,152.5 74,144.75 74,138.25 C 74,131.75 70.5,102.25 77.25,94.75 C 84,87.25 94.5,68.75 103.25,71.5 C 112,74.25 115.5,81.25 125.25,81 C 135,80.75 147,77 149.5,68.75 C 152,60.5 133.75,52.75 133.5,45.75 C 133.25,38.75 139,31.5 153.75,28.75 C 168.5,26 177.25,17.25 177.25,17.25" + style="opacity:0.38695655;fill:none;stroke:#6d7f42;stroke-opacity:1" /> + id="path5313" + d="M 14.5,161 C 29.75,159.5 36.75,164.5 46,162.75 C 55.25,161 59.25,159.75 63.75,157 C 68.25,154.25 69.75,153.25 70,150.5 C 70.25,147.75 71,138 67,128.5 C 63,119 54.5,97 58.75,89.75 C 63,82.5 64,68.25 74.5,65.25 C 85,62.25 95.5,59 102.25,64 C 109,69 115,78.25 122.25,78.5 C 129.5,78.75 134,77 136.75,74 C 139.5,71 141.25,63.75 138.5,60.25 C 135.75,56.75 123,54.75 121.25,50.75 C 119.5,46.75 110.5,33.75 121,24 C 131.5,14.25 157.25,15.75 157.25,15.75" + style="opacity:0.38695655;fill:none;stroke:#6d7f42;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path5315" + d="M 21.25,159 C 35,160 42.75,163.25 54.75,158.5 C 66.75,153.75 68.25,153.25 68.5,149.75 C 68.75,146.25 68.25,134 65.5,129.75 C 62.75,125.5 52.5,116 49.75,105.5 C 47,95 50,64.5 58.25,57.25 C 66.5,50 90.25,50 95.75,46.75 C 101.25,43.5 101,30 108.75,22.25 C 116.5,14.5 135.75,9.9999997 135.75,9.9999997" + style="opacity:0.38695655;fill:none;stroke:#6d7f42;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path5317" + d="M 190,18.5 C 201.75,23.5 229,28.25 237.25,58.75" + style="opacity:0.38695655;fill:none;stroke:#6d7f42;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path5325" + d="M 9.75,214 C 28.75,201.5 45.75,212.75 58.75,210 C 71.75,207.25 97,172.75 104.75,173 C 112.5,173.25 110.25,161.25 113.25,159.75 C 116.25,158.25 118.75,165.75 125,167.75 C 131.25,169.75 149.5,165 148.5,162 C 147.5,159 141.5,154.25 143,153.5 C 144.5,152.75 151.5,158.5 155.75,157 C 160,155.5 199.5,156 204.25,143.5 C 209,131 225.75,130 225.75,130" + style="opacity:0.38695655;fill:none;stroke:#6d7f42;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + id="path5387" + d="M 57.75,20 L 49.25,48.25 L 67.25,54.5 L 75,90.75 L 54,113 L 63,123.5 L 51,135 L 51.5,139.5 L 71.75,164 L 85.75,157.25 L 106.25,175.75 L 95.75,204 L 106,212.5 L 103.25,225.5" + style="fill:none;stroke:#d38484;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path5389" + d="M 105.75,212.25 L 118.25,184.5 L 129.25,177.5 L 156.75,193.25 L 177.25,189.5 L 177,173.75 L 166.75,167.75 L 179.5,141.5 L 185.25,137.75 L 224,127.75" + style="fill:none;stroke:#d38484;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - + transform="translate(0,192)" + style="display:inline"> - - - + style="opacity:0.03913042;fill:url(#linearGradient5168);fill-opacity:1;stroke:none" + d="m 9,-189.75 c 0,0 7.5,13 11.75,27.75 4.25,14.75 6.25,25.5 6.25,25.5 0,0 -5.5,12.75 -8.25,24.75 -2.75,12 -5.75,23 -5.75,23 0,0 5.75,16 9.25,30 3.5,14 3.75,24.25 3.75,24.25 0,0 -4,10.25 -7.5,24.25 -3.5,14 -5,30.75 -5,30.75 0,0 9.25,-2 28.5,1.25 19.25,3.25 32.25,6 32.25,6 0,0 12.75,-2.75 24,-6.25 C 109.5,18 114.5,15 114.5,15 c 0,0 5.5,0.5 22.5,6.25 17,5.75 29.25,8.5 29.25,8.5 0,0 13,-2.75 26,-5.75 13,-3 26.5,-8 26.5,-8 0,0 -0.75,-5 4.25,-24.5 5,-19.5 8.75,-28 8.75,-28 0,0 -0.5,-4.5 -3.75,-19.75 C 224.75,-71.5 218,-86 218,-86 c 0,0 1.75,-10.5 6.75,-23.75 5,-13.25 10.25,-26.75 10.25,-26.75 0,0 -4.75,-15.25 -7.5,-29.75 -2.75,-14.5 -8.25,-25.75 -8.25,-25.75 0,0 -24.25,9 -31.75,10.5 -7.5,1.5 -21,5.25 -21,5.25 0,0 -9.75,-4.25 -22,-8.5 -12.25,-4.25 -29.75,-5.5 -29.75,-5.5 0,0 -3.25,3.5 -22,8 -18.75,4.5 -27.5,5.75 -27.5,5.75 0,0 -18.5,-9 -31.5,-11.5 -13,-2.5 -24,-2 -24.75,-1.75 z" + id="path3834-49" + inkscape:connector-curvature="0" /> + + + + + + + + + + + + + + + + + + + + + + + style="display:inline"> + style="display:inline" + id="g8102" + transform="matrix(1.2525366,3.539823e-2,0,1.2525366,-27.80947,-48.34395)" + clip-path="url(#clipPath8617)"> + + + + + + + + + + + + + + + + + + clip-path="url(#clipPath5426-1-6)" + id="g5400-4"> - + style="fill:none;stroke:#d38484;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 57.75,20 L 49.25,48.25 L 67.25,54.5 L 75,90.75 L 54,113 L 63,123.5 L 51,135 L 51.5,139.5 L 71.75,164 L 85.75,157.25 L 106.25,175.75 L 95.75,204 L 106,212.5 L 103.25,225.5" + id="path5387-2" /> + - + id="path3834-49-6" + d="M 9,12.25 C 9,12.25 16.5,25.25 20.75,40 C 25,54.75 27,65.5 27,65.5 C 27,65.5 21.5,78.25 18.75,90.25 C 16,102.25 13,113.25 13,113.25 C 13,113.25 18.75,129.25 22.25,143.25 C 25.75,157.25 26,167.5 26,167.5 C 26,167.5 22,177.75 18.5,191.75 C 15,205.75 13.5,222.5 13.5,222.5 C 13.5,222.5 22.75,220.5 42,223.75 C 61.25,227 74.25,229.75 74.25,229.75 C 74.25,229.75 87,227 98.25,223.5 C 109.5,220 114.5,217 114.5,217 C 114.5,217 120,217.5 137,223.25 C 154,229 166.25,231.75 166.25,231.75 C 166.25,231.75 179.25,229 192.25,226 C 205.25,223 218.75,218 218.75,218 C 218.75,218 218,213 223,193.5 C 228,174 231.75,165.5 231.75,165.5 C 231.75,165.5 231.25,161 228,145.75 C 224.75,130.5 218,116 218,116 C 218,116 219.75,105.5 224.75,92.25 C 229.75,79 235,65.5 235,65.5 C 235,65.5 230.25,50.25 227.5,35.75 C 224.75,21.25 219.25,10 219.25,10 C 219.25,10 195,19 187.5,20.5 C 180,22 166.5,25.75 166.5,25.75 C 166.5,25.75 156.75,21.5 144.5,17.25 C 132.25,13 114.75,11.75 114.75,11.75 C 114.75,11.75 111.5,15.25 92.75,19.75 C 74,24.25 65.25,25.5 65.25,25.5 C 65.25,25.5 46.75,16.5 33.75,14 C 20.75,11.5 9.75,12 9,12.25 z" + style="opacity:0.03913042;fill:url(#linearGradient5168-2-9);fill-opacity:1;stroke:none" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 010110010011010110010011 + 010110010011010110010011 + + diff --git a/ocitysmap/layoutlib/abstract_renderer.py b/ocitysmap/layoutlib/abstract_renderer.py index dc85cfd5..ac31c0bb 100644 --- a/ocitysmap/layoutlib/abstract_renderer.py +++ b/ocitysmap/layoutlib/abstract_renderer.py @@ -24,6 +24,7 @@ # along with this program. If not, see . import cairo +import rsvg import logging import mapnik assert mapnik.mapnik_version >= 200100, \ @@ -98,15 +99,15 @@ def _get_osm_logo(ctx, height): """ # TODO: read vector logo logo_path = os.path.abspath(os.path.join( - os.path.dirname(__file__), '..', '..', 'images', 'osm-logo.png')) + os.path.dirname(__file__), '..', '..', 'images', 'osm-logo.svg')) if not os.path.exists(logo_path): logo_path = os.path.join( sys.exec_prefix, 'share', 'images', 'ocitysmap', - 'osm-logo.png') + 'osm-logo.svg') try: with open(logo_path, 'rb') as f: - png = cairo.ImageSurface.create_from_png(f) + svg = rsvg.Handle(logo_path); LOG.debug('Using copyright logo: %s.' % logo_path) except IOError: LOG.warning('Cannot open logo from %s.' % logo_path) @@ -115,12 +116,11 @@ def _get_osm_logo(ctx, height): ctx.push_group() ctx.save() ctx.move_to(0, 0) - factor = height / png.get_height() + factor = height / svg.props.height ctx.scale(factor, factor) - ctx.set_source_surface(png) - ctx.paint() + svg.render_cairo(ctx) ctx.restore() - return ctx.pop_group(), png.get_width()*factor + return ctx.pop_group(), svg.props.width * factor @staticmethod def _draw_labels(ctx, map_grid,