Exemplo n.º 1
0
function draw_constellation_grid()
{
    $sth = mysql_query("select max(x), max(y), min(x), min(y) from systems group by cid");
    if (!$sth || mysql_num_rows($sth) == 0) {
        return 0;
    }
    $SVG_output = "<g class=\"constellationMMapGrid\">";
    $gMaxX = 0;
    $gMaxY = 0;
    while ($system_max_coords = mysql_fetch_array($sth)) {
        if ($gMaxX < $system_max_coords["max(x)"]) {
            $gMaxX = $system_max_coords["max(x)"];
        }
        if ($gMaxY < $system_max_coords["max(y)"]) {
            $gMaxY = $system_max_coords["max(y)"];
        }
        $universe = new universe();
        $bla = $universe->get_start_coords($system_max_coords["min(x)"], $system_max_coords["max(x)"], $system_max_coords["min(y)"], $system_max_coords["max(y)"]);
        $min_x = round($bla[0], 1);
        $max_x = round($bla[1], 1);
        $min_y = round($bla[2], 1);
        $max_y = round($bla[3], 1);
        $SVG_output .= "<rect x=\"" . $min_x . "\" y=\"" . $min_y . "\" width=\"" . ($max_x - $min_x) . "\" height=\"" . ($max_y - $min_y) . "\"/>\n";
    }
    $SVG_output .= "</g>\n";
    $SVG_output .= "<!-- " . $gMaxX . " " . $gMaxY . " -->\n";
    return $SVG_output;
}
Exemplo n.º 2
0
/**
* lädt sterne nach
*
* @return
*/
function postload_stars()
{
    /**
     * von geturl
     */
    global $x, $y;
    global $globalTranslate;
    global $uid;
    $translate = explode(" ", $globalTranslate);
    $x += -$translate[0];
    $y += -$translate[1];
    if ($x <= 0) {
        $x = 1;
    }
    if ($y <= 0) {
        $y = 1;
    }
    $universe = new universe();
    $cids = $universe->get_surrounding_constellations($universe->const_exists($universe->get_start_coords($x, $x, $y, $y)));
    $GLOBALS["map_info"] = new map_info($uid, $cids);
    if (sizeof($cids) > 0) {
        get_svg_stars_of_cids($cids, $fleet_symbols, $fleet_routes, $scans, $systems);
        // runelord: XML Root benötigt
        echo "<g id=\"universe_temp_container\">";
        echo "<g id=\"fleet_scans\">\n";
        echo $scans;
        echo "</g>\n";
        echo "<g id=\"stars\">\n";
        echo $systems;
        echo "</g>\n";
        echo "<g id=\"flottenpfade\">\n";
        echo $fleet_routes;
        echo "</g>\n";
        echo "<g id=\"fleet_symbols\">\n";
        echo $fleet_symbols;
        echo "</g>\n";
        echo "</g>";
        // mop: arrays zusammenfügen, um sie in der session zu speichern
        $coords = $universe->get_coords_by_cids($cids);
        echo "\n<!-- " . ($coords[0] + $translate[0]) . " " . ($coords[1] + $translate[0]) . " " . ($coords[2] + $translate[1]) . " " . ($coords[3] + $translate[1]) . " -->";
    }
}