×
SVG:
<svg id="mapbsp" viewBox="0 0 367 230">
<defs>
<filter id="weich" x="0" y="0" width="270" height="180" filterUnits="userSpaceOnUse">
<feGaussianBlur stdDeviation="3" />
</filter>
</defs>
<!-- Rahmen um die Karte setzen -->
<rect x="1" y="1" width="270" height="180" stroke="rgb(0,0,0)" stroke-width="1" fill="rgb(255,255,255)"/>
<!-- Wälder zeichnen -->
<g id="wald" fill="rgb(0,128,0)" stroke="rgb(0,0,0)" stroke-width="1">
<polygon points="17.5,18.5 12.5,43.5 12.5,80.5 18.5,115.5 34.5,113.5 87.5,109.5 51.5,83.5 41.5,54.5"/>
<polygon points="13.5,168.5 65.5,151.5 118.5,147.5 187.5,150.5 242.5,171.5 172.5,175.5 85.5,169.5"/>
<polygon points="70.5,1.5 103.5,34.5 114.5,62.5 138.5,31.5 141.5,1.5"/>
<polygon points="220.5,22.5 201.5,52.5 180.5,95.5 184.5,118.5 226.5,118.5 254.5,135.5 270.5,135.5 270.5,76.5 250.5,19.5"/>
</g>
<!-- Flüsse zeichnen -->
<g id="fluss" fill="none" stroke="rgb(0,0,192)">
<path d="M234.5 1.5 C215.26 11.1199 152.483 27.9824 145.5 43.5 C140.38 54.8779 151.063 74.6761
143.5 83.5 C137.325 90.7038 88.8283 92.2381 109.5 114.5 C123.304 129.366
143.97 100.735 161.5 109.5 C175.139 116.32 173.294 127.325 186.5 135.5 C205.421
147.213 221.866 124.683 237.5 132.5 C251.006 139.253 257.703 161.615 270.5
172.5" stroke-width="3"/>
<path d="M37.5 1.5 C43.4632 17.4018 35.8262 24.1462 40.5 37.5 C53.1435 73.6244 84.9843 11.9216
104 105" stroke-width="2"/>
<path d="M30.5 75.5 C83.1925 101.846 53.7893 50.8157 90.5 65.5"/>
<path d="M118.5 11.5 C118.5 36.0439 126.466 35.7954 144 52.5"/>
<path d="M58.5 161.5 C45.9565 161.5 -7.99749 151.784 21.5 126.5 C41.6019 109.27 71.8797 141.405
91.5 136.5 C103.18 133.58 110.256 122.998 121.5 118.5"/>
<path d="M239.5 41.5 C225.944 43.6865 209.815 53.2793 198.5 45.5 C180.198 32.9173 207.826
31.1631 186.5 20.5"/>
<path d="M231.5 87.5 C191.006 98.2983 181.608 111.165 220.5 134.5"/>
<path d="M135.5 158.5 C185.954 158.5 148.706 134.659 179 129.5"/>
</g>
<!-- Strassen zeichnen -->
<g id="strasse" fill="none" stroke="rgb(128,128,0)" stroke-width="2">
<path d="M44.5 1.5 C48.9668 10.4337 53.1271 23.8525 59.5 31.5 C70.4237 44.6085 89.125 45.2858
95.5 63.5 C104.461 89.1018 85.2245 106.335 110.5 121.5 C123.209 129.126 136.831
123.45 150.5 125.5 C172.116 128.742 187.091 146.159 210.5 148.5 C217.558
149.206 235.603 145.176 241.5 149.5 C247.18 153.665 258.176 171.845 263.5
180.5"/>
<path d="M191.5 1.5 C184.542 5.67486 176.155 9.37791 172.5 17.5 C163.22 38.1211 181.607 16.7888
178.5 37.5 C177.835 41.9349 171.944 43.74 169.5 47.5 C163.316 57.0131 164.688
68.8005 156.5 77.5 C140.367 94.6415 135.5 99.7009 135.5 124.5"/>
<path d="M1.5 154.5 C17.6894 150.821 28.5089 144.997 43.5 140.5 C73.2774 131.567 106.3 154.98
135.5 125"/>
<path d="M43.5 140 C43.5 91.9071 -8.71872 68.5875 64 37"/>
<path d="M238.5 149.5 C273.972 78.5568 248.011 70.1445 187.5 61.5 C177.104 60.0148 168.41
53.9545 157.5 54.5 C133.715 55.6893 120.756 74.128 95.5 61.5"/>
</g>
<!-- Orte zeichnen mit Ortsname-Anzeige bei mouseover -->
<g id="ort" fill="rgb(255,0,0)" stroke-width="1" stroke="rgb(128,0,0)">
<circle cx="44" cy="138" r="8" onmouseover="OrtsnameZeig(evt,'Entenhausen')" onmouseout="OrtsnameWeg(evt)"/>
<circle cx="63" cy="38" r="8" onmouseover="OrtsnameZeig(evt,'Quark City')" onmouseout="OrtsnameWeg(evt)"/>
<circle cx="169" cy="56" r="8" onmouseover="OrtsnameZeig(evt,'Muppetswil')" onmouseout="OrtsnameWeg(evt)"/>
<circle cx="234" cy="149" r="8" onmouseover="OrtsnameZeig(evt,'Nixis')" onmouseout="OrtsnameWeg(evt)"/>
<circle cx="136" cy="126" r="8" onmouseover="OrtsnameZeig(evt,'Jakubsheim')" onmouseout="OrtsnameWeg(evt)"/>
</g>
<!-- Gemeindeflächen zeichnen -->
<g id="gemeinde" visibility="hidden">
<polyline id="enten" points="112,180.5 84,145 79,117 47,97 19,73 1.5,80 1.5,180.5" opacity="0.5" fill="rgb(255,64,64)"/>
<polyline points="112,180.5 84,145 79,117 47,97 19,73 1.5,80" stroke-dasharray="2 2" fill="none" stroke-width="1" stroke="rgb(128,0,0)"/>
<polyline id="quark" points="1.5,1.5 1.5,80 19,73 47,97 79,117 105,102 112,95 142,85 145,78 143,46 130,18 125,1.5" opacity="0.5" fill="rgb(64,255,255)"/>
<polyline points="79,117 105,102 112,95 142,85 145,78 143,46 130,18 125,1.5" stroke-dasharray="2 2" fill="none" stroke-width="1" stroke="rgb(128,0,0)"/>
<polyline id="muppets" points="125,1.5 130,18 143,46 145,78 178,97 211,78 239,67 270.5,74 270.5,1.5" opacity="0.5" fill="rgb(255,255,64)"/>
<polyline points="145,78 178,97 211,78 239,67 270.5,74" stroke-dasharray="2 2" fill="none" stroke-width="1" stroke="rgb(128,0,0)"/>
<polyline id="nixis" points="270.5,74 239,67 211,78 178,97 173,121 182,132 192,136 184,160 179,180.5 270.5,180.5" opacity="0.5" fill="rgb(255,128,255)"/>
<polyline points="178,97 173,121 182,132 192,136 184,160 179,180.5" stroke-dasharray="2 2" fill="none" stroke-width="1" stroke="rgb(128,0,0)"/>
<polyline id="jakub" points="178,97 173,121 182,132 192,136 184,160 179,180.5 112,180.5 84,145 79,117 105,102 112,95 142,85 145,78" fill="rgb(64,255,64)" opacity="0.5"/>
</g>
<!-- Häckchen zum Ein-und Ausschalten der Themen zeichnen -->
<g id="wald-an" visibility="visible">
<line x1="280" y1="55" x2="292" y2="67" stroke="black" stroke-width="1"/>
<line x1="280" y1="67" x2="292" y2="55" stroke="black" stroke-width="1"/>
</g>
<g id="fluss-an" visibility="visible">
<line x1="280" y1="82" x2="292" y2="94" stroke="black" stroke-width="1"/>
<line x1="280" y1="94" x2="292" y2="82" stroke="black" stroke-width="1"/>
</g>
<g id="strasse-an" visibility="visible">
<line x1="280" y1="109" x2="292" y2="121" stroke="black" stroke-width="1"/>
<line x1="280" y1="121" x2="292" y2="109" stroke="black" stroke-width="1"/>
</g>
<g id="ort-an" visibility="visible">
<line x1="280" y1="136" x2="292" y2="148" stroke="black" stroke-width="1"/>
<line x1="280" y1="148" x2="292" y2="136" stroke="black" stroke-width="1"/>
</g>
<g id="gemeinde-an" visibility="hidden">
<line x1="280" y1="163" x2="292" y2="175" stroke="black" stroke-width="1"/>
<line x1="280" y1="175" x2="292" y2="163" stroke="black" stroke-width="1"/>
</g>
<!-- Legende und Quadrate zeichnen welche auf Mausklick mit Ein- oder Ausblenden der Themen reagieren -->
<text x="280px" y="10px" fill="rgb(0,0,0)" font-size="14px" font-family="Arial">Legende:</text>
<text x="280px" y="30px" fill="rgb(0,0,0)" font-size="10px" font-family="Arial">(Ankreuzen zum</text>
<text x="280px" y="40px" fill="rgb(0,0,0)" font-size="10px" font-family="Arial">Sichtbarmachen)</text>
<rect x="280" y="55" width="12" height="12" onclick="ShowHide('wald','wald-an')"
fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="1" fill-opacity="0"/>
<text x="297px" y="65px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">Wälder</text>
<polygon points="342 56, 345 68, 354 65, 357 54"
fill="rgb(0,128,0)" stroke="rgb(0,0,0)" stroke-width="1"/>
<rect x="280" y="82" width="12" height="12" onclick="ShowHide('fluss','fluss-an')"
fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="1" fill-opacity="0"/>
<text x="297px" y="92px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">Flüsse</text>
<rect x="280" y="109" width="12" height="12" onclick="ShowHide('strasse','strasse-an')"
fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="1" fill-opacity="0"/>
<text x="297px" y="119px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">Strassen</text>
<rect x="280" y="136" width="12" height="12" onclick="ShowHide('ort','ort-an')"
fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="1" fill-opacity="0"/>
<text x="297px" y="146px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">Orte</text>
<path d="M337.5 88 C350.782 93.534 342.287 86.9398 353.5 81.3333"
fill="none" stroke="rgb(0,0,192)" stroke-width="2"/>
<path d="M344 82 C345 82 347 87 347 88"
fill="none" stroke="rgb(0,0,192)" stroke-width="1"/>
<path d="M349 121.5 C354.29 108.516 348.777 112.617 362.5 108.5"
fill="none" stroke="rgb(128,128,0)" stroke-width="2"/>
<circle cx="337" cy="142" r="7" fill="rgb(255,0,0)" stroke-width="1" stroke="rgb(128,0,0)"/>
<rect x="280" y="163" width="12" height="12" onclick="ShowHide('gemeinde','gemeinde-an')"
fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="1" fill-opacity="0"/>
<text x="297px" y="170px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">Gemeinde-</text>
<text x="297px" y="183px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">flächen</text>
<!-- Ortsnamen-Box und Text zeichnen -->
<g id="tooltip">
<rect id="ttr" x="0" y="0" rx="5" ry="5" width="100" height="16" fill="#FFFFCC" stroke="#000000" stroke-width="0.5px" visibility="hidden"/>
<text id="ttt" x="2" y="12" visibility="hidden" fill="#0000CC" font-size="11px">dyn. Text</text>
</g>
<!-- Gemeindenamen-Boxen zeichnen -->
<g visibility="hidden">
<rect x="2" y="147" width="75" height="19" rx="5" ry="5" fill="white" filter="url(#weich)"/>
<text x="8px" y="160px" fill="rgb(0,0,0)" font-size="11px" font-family="Arial">Entenhausen</text>
<set attributeName="visibility" begin="enten.mouseover" from="hidden" to="visible" fill="freeze" />
<set attributeName="visibility" begin="enten.mouseout" from="visible" to="hidden" fill="freeze" />
</g>
<g visibility="hidden">
<rect x="44" y="47" width="65" height="19" rx="5" ry="5" fill="white" filter="url(#weich)"/>
<text x="50px" y="60px" fill="rgb(0,0,0)" font-family="Arial" font-size="11px">Quark City</text>
<set attributeName="visibility" begin="quark.mouseover" from="hidden" to="visible" fill="freeze" />
<set attributeName="visibility" begin="quark.mouseout" from="visible" to="hidden" fill="freeze" />
</g>
<g visibility="hidden">
<rect x="154" y="27" width="67" height="19" rx="5" ry="5" fill="white" filter="url(#weich)"/>
<text x="160px" y="40px" fill="rgb(0,0,0)" font-size="11px" font-family="Arial">Muppetswil</text>
<set attributeName="visibility" begin="muppets.mouseover" from="hidden" to="visible" fill="freeze" />
<set attributeName="visibility" begin="muppets.mouseout" from="visible" to="hidden" fill="freeze" />
</g>
<g visibility="hidden">
<rect x="98" y="134" width="70" height="19" rx="5" ry="5" fill="white" filter="url(#weich)"/>
<text x="104px" y="147px" fill="rgb(0,0,0)" font-size="11px" font-family="Arial">Jakubsheim</text>
<set attributeName="visibility" begin="jakub.mouseover" from="hidden" to="visible" fill="freeze" />
<set attributeName="visibility" begin="jakub.mouseout" from="visible" to="hidden" fill="freeze" />
</g>
<g visibility="hidden">
<rect x="214" y="115" width="35" height="19" rx="5" ry="5" fill="white" filter="url(#weich)"/>
<text x="220px" y="128px" fill="rgb(0,0,0)" font-size="11px" font-family="Arial">Nixis</text>
<set attributeName="visibility" begin="nixis.mouseover" from="hidden" to="visible" fill="freeze" />
<set attributeName="visibility" begin="nixis.mouseout" from="visible" to="hidden" fill="freeze" />
</g>
<!-- Begleittext schreiben -->
<text x="1px" y="200px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">
Beim Ueberfahren von Orten und Gemeindeflächen mit der Maus
</text>
<text x="1px" y="217px" fill="rgb(0,0,0)" font-size="12px" font-family="Arial">
erscheint der entsprechende Ortsname.
</text>
</svg>
Javascript:
// Ein-und Auschalten der verschiedenen Themen auf der Karte
function ShowHide(gruppe,ankreuz) {
was=document.getElementById(gruppe);
kreuz=document.getElementById(ankreuz);
if(kreuz.getAttribute("visibility")=="visible") {
was.setAttribute("visibility","hidden");
kreuz.setAttribute("visibility","hidden");
} else {
was.setAttribute("visibility","visible");
kreuz.setAttribute("visibility","visible");
}
}
function OrtsnameZeig(e,txt) {
var ttrelem,tttelem,obj,tooltx,toolty,ortsx,ortsy,movex,movey;
// Tooltip-Box-Text durch Ortsnamen ersetzen
ttrelem=document.getElementById("ttr");
tttelem=document.getElementById("ttt");
tttelem.innerHTML=txt;
// Welche Ortschaft wurde angewählt:
obj = e.target;
// Aktuelle Tooltip-Box-Position:
tooltx = ttrelem.getAttribute("x");
toolty = ttrelem.getAttribute("y");
// Position der angewählten Ortschaft:
ortsx = obj.getAttribute("cx");
ortsy = obj.getAttribute("cy");
// Tooltip-Box zu Ortschaft verschieben:
movex = ortsx - tooltx + 7;
movey = ortsy - toolty - 22;
versch = "translate(" + movex + " " + movey + ")";
document.getElementById("tooltip").setAttribute("transform", versch);
// Tooltip-Box-Breite dem Text anpassen und Box sichtbar machen:
ttrelem.setAttribute("width",tttelem.getComputedTextLength()+5);
tttelem.setAttribute("visibility","visible");
ttrelem.setAttribute("visibility","visible");
}
function OrtsnameWeg(evt) {
var ttrelem,ttrelem;
ttrelem=document.getElementById("ttr");
tttelem=document.getElementById("ttt");
ttrelem.setAttribute("visibility","hidden");
tttelem.setAttribute("visibility","hidden");
}