Benutzer:MuwuM/Sandboxes/MapTool: Unterschied zwischen den Versionen

Aus FreieFantasyWelt
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „only boring code... <!-- <?php header('Content-type: text/html'); $viewzoneX = 0; $viewzoneY = 0; $viewzoneZ = 0; $viewzoneW = 1752; $viewzoneH = 2000; $viewz…“)
 
(Der Seiteninhalt wurde durch einen anderen Text ersetzt: „http://muwum.net/ffw/scale.html“)
 
Zeile 1: Zeile 1:
only boring code...
http://muwum.net/ffw/scale.html
 
<!--
<?php
header('Content-type: text/html');
$viewzoneX = 0;
$viewzoneY = 0;
$viewzoneZ = 0;
$viewzoneW = 1752;
$viewzoneH = 2000;
$viewzoneD = 0;
 
$zoom = (isset($_GET['z'])? $_GET['z'] : 1);
$top = (isset($_GET['t'])? $_GET['t'] : 0);
$left = (isset($_GET['l'])? $_GET['l'] : 0);
 
function scalePoint($x,$y){
global $zoom,$top,$left;
return array('x'=>(($x-$left)*$zoom),'y'=>(($y-$top)*$zoom));
}
 
 
function roadPoint($x,$y,$fromX,$fromY){
$curvetoX = $x + ($fromX-$x)/2;
$curvetoY = $y + ($fromY-$y)/2;
$arr = scalePoint($x,$y);
$arr['curveto'] = scalePoint($curvetoX,$curvetoY);
$arr['curvetosrc'] = scalePoint((2 * $x) - $curvetoX,(2 * $y) - $curvetoY);
return $arr;
}
 
$i = 0;
$roads[$i]['size']= 6;
$roads[$i]['name']= 'Altburger Straße';
$roads[$i]['points'][] = roadPoint(523,630,523,630);
$roads[$i]['points'][] = roadPoint(664,787,523,630);
$roads[$i]['points'][] = roadPoint(844,841,664,787);
$roads[$i]['points'][] = roadPoint(994,918,844,841);
$roads[$i]['points'][] = roadPoint(1069,988,994,918);
$roads[$i]['points'][] = roadPoint(1747,1007,1069,988);
 
$i++;
$roads[$i]['size']= 6;
$roads[$i]['name']= 'Mühlburger Straße';
$roads[$i]['points'][] = roadPoint(1032,160,1032,160);
$roads[$i]['points'][] = roadPoint(884,455,1032,160);
$roads[$i]['points'][] = roadPoint(833,572,884,455);
$roads[$i]['points'][] = roadPoint(789,639,833,572);
$roads[$i]['points'][] = roadPoint(743,692,789,639);
$roads[$i]['points'][] = roadPoint(656,772,743,692);
$roads[$i]['points'][] = roadPoint(644,824,656,772);
$roads[$i]['points'][] = roadPoint(561,881,644,824);
$roads[$i]['points'][] = roadPoint(471,973,561,881);
 
$i++;
$roads[$i]['size']= 5;
$roads[$i]['name']= 'Akademieweg';
$roads[$i]['points'][] = roadPoint(310,961,310,961);
$roads[$i]['points'][] = roadPoint(370,964,310,961);
$roads[$i]['points'][] = roadPoint(470,971,370,964);
$roads[$i]['points'][] = roadPoint(489,982,370,964);
$roads[$i]['points'][] = roadPoint(639,1039,489,982);
$roads[$i]['points'][] = roadPoint(710,1027,639,1039);
$roads[$i]['points'][] = roadPoint(761,1016,710,1027);
$roads[$i]['points'][] = roadPoint(844,1003,761,1016);
$roads[$i]['points'][] = roadPoint(856,1011,844,1003);
$roads[$i]['points'][] = roadPoint(943,988,856,1011);
$roads[$i]['points'][] = roadPoint(994,915,943,988);
$roads[$i]['points'][] = roadPoint(1032,883,994,915);
$roads[$i]['points'][] = roadPoint(1064,834,1032,883);
$roads[$i]['points'][] = roadPoint(1052,757,1064,834);
 
$i++;
$roads[$i]['size']= 5;
$roads[$i]['name']= 'Teichweg';
$roads[$i]['points'][] = roadPoint(858,1009,858,1009);
$roads[$i]['points'][] = roadPoint(900,1030,858,1009);
$roads[$i]['points'][] = roadPoint(918,1043,900,1030);
$roads[$i]['points'][] = roadPoint(938,1096,918,1043);
$roads[$i]['points'][] = roadPoint(952,1152,938,1096);
$roads[$i]['points'][] = roadPoint(965,1256,952,1152);
$roads[$i]['points'][] = roadPoint(998,1307,965,1256);
 
$i++;
$roads[$i]['size']= 5;
$roads[$i]['name']= 'Wernestraße';
$roads[$i]['points'][] = roadPoint(854,843,854,843);
$roads[$i]['points'][] = roadPoint(899,767,854,843);
$roads[$i]['points'][] = roadPoint(967,748,899,767);
$roads[$i]['points'][] = roadPoint(1052,759,967,748);
$roads[$i]['points'][] = roadPoint(1127,730,1052,759);
$roads[$i]['points'][] = roadPoint(1131,632,1127,730);
 
 
$i++;
 
 
 
 
 
 
echo('<!DOCTYPE html">
<html><head><style>.road:hover{stroke:#ba9876;}</style></head><body>
<svg xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events"
    version="1.1" baseProfile="full"
    width="'.($zoom*$viewzoneW).'px" height="'.($zoom*$viewzoneH).'px">');
$roadsOutlineSVG = '';
$roadsPathSVG = '';
foreach($roads as $id=>$road){
$d='M '.$road['points'][0]['x'].' '.$road['points'][0]['y'];
for($i=1;$i<count($road['points']);$i++){
$d .= ' C '.$road['points'][$i-1]['curvetosrc']['x'].' '.$road['points'][$i-1]['curvetosrc']['y'].' '.$road['points'][$i]['curveto']['x'].' '.$road['points'][$i]['curveto']['y'].' '.$road['points'][$i]['x'].' '.$road['points'][$i]['y'];
}
  $roadsOutlineSVG.=('<path d="'.$d.'" style="stroke:#654321;stroke-width:'.(($road['size']*3+3)*$zoom).';stroke-linejoin:round;stroke-linecap:round;fill:none;" />');
  $roadsPathSVG.=('<path class="road" title="'.$road['name'].'" d="'.$d.'" style="stroke:#987654;stroke-width:'.($road['size']*3*$zoom).';stroke-linejoin:round;stroke-linecap:round;fill:none;" />');
 
}
echo($roadsOutlineSVG.$roadsPathSVG);
echo(' </svg></body></html>');
 
?>
-->

Aktuelle Version vom 6. Juli 2013, 15:13 Uhr