Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
<a xlink:href="https://de.wikipedia.org/wiki/George_Washington">
<rect x="300" y="125" opacity="0" width="250" height="300" />
</a>
$areas.="
<a xlink:href=\"https://de.wikipedia.org/wiki/George_Washington\" style=\"fill:blue\">
<rect x=\"$x1\" y=\"$y1\" opacity=\"0\" width=\"$x2\" height=\"20\" style=\"fill: blue;\"></rect>
<text x=\"500px\" y=\"$yt1\" font-family=\"Verdana\" width=\"20\" font-size=\"15\" fill=\"red\">$strassenNamen[$streetID]</text>
</a>
";
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="640" height="480" version="1.1" viewBox="0 0 640 480">
<?php
function drawRoad($href, $xstart, $ystart, $length, $width, $fillcolor, $orientation = 'h') {
if ($orientation == 'h') {
$x = $xstart;
$y = $ystart - $width / 2;
$w = $length;
$h = $width;
} else {
$x = $xstart- $width / 2;
$y = $ystart;
$w = $width;
$h = $length;
}
$txtrect = '<rect height="' . $h . '" width="' . $w;
$txtrect .= '" x="' . $x . '" y="' . $y;
$txtrect .= '" fill="' . $fillcolor . '">';
echo '<a xlink:href="' . $href . '">' . $txtrect . '</a>';
}
drawRoad('https://wiki.selfhtml.org', 20, 20, 200, 10, '#ff0000', 'h');
drawRoad('https://wiki.selfhtml.org', 20, 40, 200, 10, '#ff0000', 'h');
drawRoad('https://wiki.selfhtml.org', 20, 50, 200, 10, '#0000ff', 'v');
?>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="640" height="480" version="1.1" viewBox="0 0 640 480">
<?php
function drawRoad($href, $name,
$xstart, $ystart, $length, $width,
$fillcolor, $orientation = 'h') {
if ($orientation == 'h') {
$x = $xstart;
$y = $ystart - $width / 2;
$w = $length;
$h = $width;
$xtxt = $xstart + $length / 2;
$ytxt = $ystart;
} else {
$x = $xstart- $width / 2;
$y = $ystart;
$w = $width;
$h = $length;
}
$text = '<text alignment-baseline="central" text-anchor="middle"';
$text .= ' fill="white"';
$text .= ' x="' . $xtxt . '" y="' . $ytxt . '">';
$text .= $name . '</text>';
$rect = '<rect height="' . $h . '" width="' . $w;
$rect .= '" x="' . $x . '" y="' . $y;
$rect .= '" fill="' . $fillcolor . '">';
$rect .= '</rect>';
echo '<a xlink:href="' . $href . '">' . $rect . '</a>';
echo $text;
}
drawRoad('https://wiki.selfhtml.org', 'Hauptstraße', 20, 20, 200, 20, '#ff0000', 'h');
// drawRoad('https://wiki.selfhtml.org', 20, 40, 200, 10, '#ff0000', 'h');
// drawRoad('https://wiki.selfhtml.org', 20, 50, 200, 10, '#0000ff', 'v');
?>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="640" height="480" version="1.1" viewBox="0 0 640 480">
<?php
function drawRoad($href, $name,
$xstart, $ystart, $length, $width,
$fillcolor, $orientation = 'h') {
if ($orientation == 'h') {
$x = $xstart;
$y = $ystart - $width / 2;
$w = $length;
$h = $width;
$xtxt = $xstart + $length / 2;
$ytxt = $ystart;
$transform ='';
} else {
$x = $xstart- $width / 2;
$y = $ystart;
$w = $width;
$h = $length;
$xtxt = $xstart + $length / 2;
$ytxt = $ystart - $width / 2;
$transform = ' transform="rotate(90,' . $x . ',' . $y . ')"';
}
$text = '<text alignment-baseline="central" text-anchor="middle"';
$text .= ' fill="white"';
$text .= ' x="' . $xtxt . '" y="' . $ytxt . '"';
$text .= $transform . '>';
$text .= $name . '</text>';
$rect = '<rect height="' . $h . '" width="' . $w;
$rect .= '" x="' . $x . '" y="' . $y;
$rect .= '" fill="' . $fillcolor . '">';
$rect .= '</rect>';
echo '<a xlink:href="' . $href . '">' . $rect . '</a>';
echo $text;
}
drawRoad('https://wiki.selfhtml.org', 'Hauptstraße', 20, 20, 200, 20, '#ff0000', 'h');
drawRoad('https://wiki.selfhtml.org', 'Unterstraße', 20, 60, 200, 20, '#ff0000', 'h');
drawRoad('https://wiki.selfhtml.org', 'Oberstraße', 20, 80, 200, 20, '#0000ff', 'v');
?>
</svg>
Das habe ich umgesetzt:Besser wäre es gewesen, das Rechteck und den Text einheitlich zu zeichnen und bei vertikaler Anordnung gemeinsam zu drehen.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="640" height="480" version="1.1" viewBox="0 0 640 480">
<?php
function drawRoad($href, $name,
$xstart, $ystart, $length, $width,
$fillcolor, $rot = 0) {
$x = $xstart;
$y = $ystart - $width / 2;
$w = $length;
$h = $width;
$xtxt = $xstart + $length / 2;
$ytxt = $ystart;
$transform = ' transform="rotate(' . $rot . ',' . $x . ',' . $y . ')"';
$text = '<text alignment-baseline="central" text-anchor="middle"';
$text .= ' fill="white"';
$text .= ' x="' . $xtxt . '" y="' . $ytxt . '"';
$text .= $transform . '>';
$text .= $name . '</text>';
$rect = '<rect height="' . $h . '" width="' . $w;
$rect .= '" x="' . $x . '" y="' . $y;
$rect .= '" fill="' . $fillcolor . '"';
$rect .= $transform . '>';
$rect .= '</rect>';
echo '<a xlink:href="' . $href . '">' . $rect . '</a>';
echo $text;
}
drawRoad('https://wiki.selfhtml.org', 'Hauptstraße', 20, 20, 200, 20, '#ff0000', 0);
drawRoad('https://wiki.selfhtml.org', 'Unterstraße', 20, 60, 200, 20, '#ff0000', 90);
drawRoad('https://wiki.selfhtml.org', 'Diagonalstraße', 80, 80, 200, 20, '#0000ff', 45);
?>
</svg>