Fix stylesheet, imagemap
This commit is contained in:
parent
179eee3feb
commit
02fa59a4af
2 changed files with 15 additions and 8 deletions
|
@ -561,10 +561,11 @@ def optimize_text_layout(ns, erfas, chaostreffs, size, svg):
|
|||
def create_imagemap(ns, size, parent,
|
||||
erfas, erfa_urls, erfa_names, texts,
|
||||
chaostreffs, chaostreff_urls, chaostreff_names):
|
||||
s = ns.png_scale
|
||||
img = etree.Element('img',
|
||||
src=ns.output_directory.rel(ns.output_directory.png_path),
|
||||
usemap='#erfamap',
|
||||
width=str(size[0]), height=str(size[1]))
|
||||
width=str(size[0]*s), height=str(size[1]*s))
|
||||
imgmap = etree.Element('map', name='erfamap')
|
||||
|
||||
for city, location in erfas.items():
|
||||
|
@ -573,11 +574,11 @@ def create_imagemap(ns, size, parent,
|
|||
box = texts[city]
|
||||
area = etree.Element('area',
|
||||
shape='circle',
|
||||
coords=f'{location[0]},{location[1]},{ns.dotsize_erfa}',
|
||||
coords=f'{location[0]*s},{location[1]*s},{ns.dotsize_erfa*s}',
|
||||
href=erfa_urls[city])
|
||||
area2 = etree.Element('area',
|
||||
shape='rect',
|
||||
coords=f'{box.left},{box.top},{box.right},{box.bottom}',
|
||||
coords=f'{box.left*s},{box.top*s},{box.right*s},{box.bottom*s}',
|
||||
href=erfa_urls[city])
|
||||
if city in erfa_names:
|
||||
area.set('title', erfa_names[city])
|
||||
|
@ -590,7 +591,7 @@ def create_imagemap(ns, size, parent,
|
|||
continue
|
||||
area = etree.Element('area',
|
||||
shape='circle',
|
||||
coords=f'{location[0]},{location[1]},{ns.dotsize_treff}',
|
||||
coords=f'{location[0]*s},{location[1]*s},{ns.dotsize_treff*s}',
|
||||
href=chaostreff_urls[city])
|
||||
if city in chaostreff_names:
|
||||
area.set('title', chaostreff_names[city])
|
||||
|
@ -803,7 +804,8 @@ def create_svg(ns, bbox):
|
|||
root.write(mapfile)
|
||||
|
||||
print('Writing PNG')
|
||||
cairosvg.svg2png(url=ns.output_directory.svg_path, write_to=ns.output_directory.png_path)
|
||||
cairosvg.svg2png(url=ns.output_directory.svg_path, write_to=ns.output_directory.png_path,
|
||||
scale=ns.png_scale)
|
||||
|
||||
print('Writing HTML SVG page')
|
||||
html = etree.Element('html')
|
||||
|
@ -826,6 +828,10 @@ def create_svg(ns, bbox):
|
|||
|
||||
print('Writing HTML Image Map')
|
||||
html = etree.Element('html')
|
||||
head = etree.Element('head')
|
||||
link = etree.Element('link', rel='stylesheet', href=ns.stylesheet)
|
||||
head.append(link)
|
||||
html.append(head)
|
||||
body = etree.Element('body')
|
||||
html.append(body)
|
||||
|
||||
|
@ -858,6 +864,7 @@ def main():
|
|||
ap.add_argument('--projection', type=str, default='epsg:4258', help='Map projection to convert the WGS84 coordinates to')
|
||||
ap.add_argument('--scale-x', type=float, default=130, help='X axis scale to apply after projecting')
|
||||
ap.add_argument('--scale-y', type=float, default=200, help='Y axis scale to apply after projecting')
|
||||
ap.add_argument('--png-scale', type=float, default=1.0, help='Scale of the PNG image')
|
||||
ap.add_argument('--debug', action='store_true', default=False, help='Add debug information to the produced SVG')
|
||||
|
||||
ns = ap.parse_args(sys.argv[1:])
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
* {
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
object, img {
|
||||
body {
|
||||
max-width: 100%;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
|
||||
rect.background {
|
||||
fill: #759eb5;
|
||||
stroke: none;
|
||||
|
|
Loading…
Reference in a new issue