'; ?> 30 10 31 11 [70, 68], 20 => [70, 44], 30 => [70, 20], 11 => [405, 68], 12 => [370, 68], 13 => [335, 68], 14 => [300, 68], 15 => [265, 68], 16 => [230, 68], 17 => [195, 68], 18 => [160, 68], 19 => [125, 68], 21 => [405, 44], 22 => [370, 44], 23 => [335, 44], 24 => [300, 44], 25 => [265, 44], 26 => [220, 44], 27 => [185, 44], 28 => [150, 44], 29 => [115, 44], 31 => [405, 20], 32 => [370, 20], 33 => [335, 20], 34 => [300, 20], 35 => [265, 20], 36 => [230, 20], 37 => [195, 20], 38 => [160, 20], 39 => [125, 20], ]; // Rechtecke einfärben, wenn "fill"-Modus aktiv ist if ($_GET["mode"] == "fill") { $data = $_GET["data"]; $data = json_decode(urldecode($data), true); foreach ($pin_coordinates as $key => $coordinates) { $fill = in_array($key, $data) ? "green" : "red"; echo ''; } } else { // Nur Umrisse foreach ($pin_coordinates as $coordinates) { echo ''; } } // SVG frühzeitig beenden, wenn kein Data vorhanden oder im fill-Modus if (empty($_GET['data']) || $_GET["mode"] == "fill") { print ""; die(); } // Brückenverbindungen übersetzen, falls aktiviert if ($_GET["translate"] == "true") { $db = new SQLite3('db-test/test.db'); $data = json_decode($_GET["data"], true); $plug = json_decode(file_get_contents("settings.json"), true)["plug"]; $nodes_raw = []; foreach ($data as $bridge) { $nodes = $db->query("SELECT node_from, node_to FROM nodes WHERE required_by = " . $bridge); while ($node = $nodes->fetchArray(SQLITE3_ASSOC)) { $nodes_raw[] = [$node['node_from'], $node['node_to']]; } } $inputArray = $nodes_raw; } else { $inputArray = json_decode($_GET['data'], true); } // Koordinaten übersetzen $translatedArray = array_map(function ($pair) use ($pin_coordinates) { return [ $pin_coordinates[$pair[0]], $pin_coordinates[$pair[1]], ]; }, $inputArray); $colors = ["#1a5fb4", "#26a269", "#e5a50a", "#c64600", "#a51d2d", "#613583", "#63452c", "#3d3846"]; // Linien ausgeben $colorNumber = 0; foreach ($translatedArray as $line) { $point1 = $line[0]; $point2 = $line[1]; $point1x = $point1[0] + 10; $point1y = $point1[1] + 5; $point2x = $point2[0] + 10; $point2y = $point2[1] + 5; echo ''; $colorNumber = ($colorNumber + 1) % count($colors); } ?>