Skip to content

Commit

Permalink
new options
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Anderson committed Nov 13, 2013
1 parent 17888a3 commit 60f27ca
Show file tree
Hide file tree
Showing 4 changed files with 2,463 additions and 18 deletions.
53 changes: 45 additions & 8 deletions generatemap.php
@@ -1,4 +1,5 @@
<?
ini_set('memory_limit','800M');
header('Content-Type: image/png');
require_once('db.inc.php');

Expand Down Expand Up @@ -59,8 +60,28 @@
$stars=json_decode($_SESSION['starjson'],true);
}

$textsize=10;
if (isset($_SESSION['textsize']))
{
$textsize=$_SESSION['textsize'];
}

$regionsize=10;
if (isset($_SESSION['regionsize']))
{
$regionsize=$_SESSION['regionsize'];
}

$security=0;
if (isset($_SESSION['security']))
{
$security=$_SESSION['security'];
}
$font=0;
if (isset($_SESSION['font']))
{
$font=$_SESSION['font'];
}



Expand All @@ -71,7 +92,13 @@
$line_color = imagecolorallocate($im, 60, 60, 60);
$startext_color = imagecolorallocate($im, 90, 90, 255);
$regiontext_color = imagecolorallocate($im, 90, 90, 255);
$font='/usr/share/fonts/dejavu/DejaVuLGCSansMono.ttf';


$fontarray=array('/usr/share/fonts/dejavu/DejaVuLGCSansMono.ttf','/home/web/fuzzwork/htdocs/mapmaker/EveSansNeue-Bold.otf','/home/web/fuzzwork/htdocs/mapmaker/EveSansNeue-Regular.otf');


#$font='/usr/share/fonts/dejavu/DejaVuLGCSansMono.ttf';
$font=$fontarray[$font-1];


if (isset($_SESSION['mapbackground']))
Expand Down Expand Up @@ -139,7 +166,7 @@



$sql="select solarsystemid,solarsystemname,x,z as y from eve.mapSolarSystems mss1 where security !=-0.99";
$sql="select solarsystemid,solarsystemname,x,z as y,red starred, green stargreen,blue starblue from eve.mapSolarSystems mss1 join evesupport.securitycolor on (round(mss1.security,1)=evesupport.securitycolor.level) where security !=-0.99";

$stmt = $dbh->prepare($sql." ".$whereclause);

Expand All @@ -163,15 +190,25 @@
$color=$colors[$star['r']."#".$star['g']."#".$star['b']];
$starsize=$star['size'];
}

if ($security)
{
if (!isset($colors[$row->starred."#".$row->stargreen."#".$row->starblue]))
{
$colors[$row->starred."#".$row->stargreen."#".$row->starblue]=imagecolorallocate($im,$row->starred,$row->stargreen,$row->starblue);
}
$color=$colors[$row->starred."#".$row->stargreen."#".$row->starblue];
}
imagefilledellipse($im,(($row->x-$minx)/$scalex)+$margin,$y-((($row->y-$miny)/$scaley)-$margin),$starsize,$starsize,$color);
if ($systemlabel)
{
imagettftext($im, 10,0, (($row->x-$minx)/$scalex)+$margin+5,$y-((($row->y-$miny)/$scaley)-$margin+5),$startext_color,$font,$row->solarsystemname);
}
$stmt->execute();
if ($systemlabel)
{
while ($row = $stmt->fetchObject())
{
imagettftext($im, $textsize,0, (($row->x-$minx)/$scalex)+$margin+5,$y-((($row->y-$miny)/$scaley)-$margin+5),$startext_color,$font,$row->solarsystemname);
}
}


if ($regionlabel)
{
$labelsql="select regionname,x,z as y from mapRegions where x between :minx and :maxx and z between :miny and :maxy";
Expand All @@ -180,7 +217,7 @@
$stmt->execute(array(":minx"=>$minx,":miny"=>$miny,":maxx"=>$maxx,":maxy"=>$maxy));

while ($row = $stmt->fetchObject()){
imagettftext($im, 10,0, (($row->x-$minx)/$scalex)+$margin,$y-((($row->y-$miny)/$scaley)-$margin),$regiontext_color,$font,$row->regionname);
imagettftext($im, $regionsize,0, (($row->x-$minx)/$scalex)+$margin,$y-((($row->y-$miny)/$scaley)-$margin),$regiontext_color,$font,$row->regionname);
}
}

Expand Down
59 changes: 49 additions & 10 deletions index.php
Expand Up @@ -5,27 +5,31 @@
$margin=20;
$region="";
$constellation="";
$security="";
$systemlabel=0;
$regionlabel=0;
$stardisplay="";
$bgcolor="#000000";
$starcolor="#ffffff";
$linecolor="#666666";
$starsize=2;
$textsize=10;
$regionsize=10;
$linewidth=1;
$font=1;
$startextcolor="#0000ff";
$regiontextcolor="#0000ff";

if (isset($_POST['submit']))
{
session_start();

if (isset($_POST['x']) && is_numeric($_POST['x']) && $_POST['x']<3000)
if (isset($_POST['x']) && is_numeric($_POST['x']) && $_POST['x']<=9000)
{
$x=$_POST['x'];
$_SESSION['mapx']=$_POST['x'];
}
if (isset($_POST['y']) && is_numeric($_POST['y']) && $_POST['y']<3000)
if (isset($_POST['y']) && is_numeric($_POST['y']) && $_POST['y']<=9000)
{
$y=$_POST['y'];
$_SESSION['mapy']=$_POST['y'];
Expand Down Expand Up @@ -55,12 +59,14 @@
{
unset($_SESSION['mapconstellation']);
}

if (isset($_POST['constellation']) && is_numeric($_POST['constellation']))
if (isset($_POST['security']) && is_numeric($_POST['security']))
{
$constellation=$_POST['constellation'];
$_SESSION['mapconstellation']=$_POST['constellation'];
$security=$_POST['security'];
$_SESSION['security']=$_POST['security'];
}



if (isset($_POST['systemlabel']) && is_numeric($_POST['systemlabel']) && $_POST['systemlabel']<2)
{
Expand Down Expand Up @@ -95,6 +101,25 @@
$starsize=$_POST['starsize'];
$_SESSION['starsize']=$_POST['starsize'];
}
if (isset($_POST['textsize']) && is_numeric($_POST['textsize']) && $_POST['textsize']<100)
{
$textsize=$_POST['textsize'];
$_SESSION['textsize']=$_POST['textsize'];
}

if (isset($_POST['regionsize']) && is_numeric($_POST['regionsize']) && $_POST['regionsize']<100)
{
$regionsize=$_POST['regionsize'];
$_SESSION['regionsize']=$_POST['regionsize'];
}

if (isset($_POST['font']) && is_numeric($_POST['font']) && $_POST['font']<4)
{
$font=$_POST['font'];
$_SESSION['font']=$_POST['font'];
}


if (isset($_POST['linewidth']) && is_numeric($_POST['linewidth']) && $_POST['linewidth']<3000)
{
$linewidth=$_POST['linewidth'];
Expand Down Expand Up @@ -133,7 +158,10 @@

<html>
<head><title>Create Starmap</title>
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

<script src='spectrum.js'></script>
<link rel='stylesheet' href='spectrum.css' />
<script>
Expand All @@ -145,23 +173,31 @@
$('#regioncolor').spectrum({});
});
</script>
<?php include('/home/web/fuzzwork/htdocs/menu/menuhead.php'); ?>

<?php include('/home/web/fuzzwork/htdocs/bootstrap/header.php'); ?>
</head>
<body>
<?php include('/home/web/fuzzwork/htdocs/menu/menu.php'); ?>
<?php include('/home/web/fuzzwork/htdocs/menu/menubootstrap.php'); ?>
<div class="container">


<p>These maps are not stored, being generated from your session. Save them to your computer, then upload them to imgur or another host</p>
<p> Get the source from <a href="https://github.com/fuzzysteve/eve-custom-starmap">https://github.com/fuzzysteve/eve-custom-starmap</a></p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<table>
<tr><td><label for='x'>X</label></td><td><input class="input" type=text id="x" name=x value=<?php echo $x; ?>></td><td></td></tr>
<tr><td><label for='y'>Y</label></td><td><input class="input" type=text id="y" name=y value=<?php echo $y; ?>></td><td></td></tr>
<tr><td><label for='starsize'>Star Size</label></td><td><input class="input" tstarsizepe=text id="starsize" name=starsize value=<?php echo $starsize; ?>></td><td></td></tr>
<tr><td><label for='linewidth'>Line Width</label></td><td><input class="input" tlinewidthpe=text id="linewidth" name=linewidth value=<?php echo $linewidth; ?>></td><td></td></tr>
<tr><td><label for='starsize'>Star Size</label></td><td><input class="input" type=text id="starsize" name=starsize value=<?php echo $starsize; ?>></td><td></td></tr>
<tr><td><label for='textsize'>Text Size</label></td><td><input class="input" type=text id="textsize" name=textsize value=<?php echo $textsize; ?>></td><td></td></tr>
<tr><td><label for='regionsize'>Region Text Size</label></td><td><input class="input" type=text id="regionsize" name=regionsize value=<?php echo $regionsize; ?>></td><td></td></tr>
<tr><td><label for='linewidth'>Line Width</label></td><td><input class="input" type=text id="linewidth" name=linewidth value=<?php echo $linewidth; ?>></td><td></td></tr>
<tr><td><label for='margin'>Margin</label></td><td><input class="input" name=margin type=text id="margin" value=<?php echo $margin?>></td><td></td></tr>
<tr><td><label for="region">Region</label></td><td><input class="input" type=text id="region" name="region" value=<?php echo $region?>></td><td> Leave blank for no region restriction</td></tr>
<tr><td><label for="constellation">Constellation</label></td><td><input class="input" type=text id="constellation" name=constellation value=<?php echo $constellation?>></td><td> Leave blank for no Constellation restriction</td></tr>
<tr><td>System labels</td><td><select name="systemlabel"><option value=0 <? if ($systemlabel==0){ echo "selected"; }?>>Off</option> <option value=1 <? if ($systemlabel==1){ echo "selected"; }?>>On</input></select></td><td></tr>
<tr><td>Region labels</td><td><select name="regionlabel"><option value=0 <? if ($regionlabel==0){ echo "selected"; }?>>Off</option> <option value=1 <? if ($regionlabel==1){ echo "selected"; }?>>On</input></select></td><td></tr>
<tr><td>Color by Security Status</td><td><select name="security"><option value=0 <? if ($security==0){ echo "selected"; }?>>Off</option> <option value=1 <? if ($security==1){ echo "selected"; }?>>On</input></select></td><td></tr>
<tr><td>Font</td><td><select name="font"><option value=1 <? if ($font==1){ echo "selected"; }?>>Font 1</option> <option value=2 <? if ($font==2){ echo "selected"; }?>>Font 2</input><option value=3 <? if ($font==3){ echo "selected"; }?>>Font 3</input></select></td><td></tr>
<tr><td>Custom Highlights</td><td><textarea name="stars"><?echo $stardisplay; ?></textarea></td><td>starid,red,green,blue,size</td></tr>
<tr><td>Background Colour</td><td><input type="text" id="background" name="background" value="<?php echo $bgcolor ?>"></td><td></td></tr>
<tr><td>Star Colour</td><td><input type="text" id="starcolor" name="starcolor" value="<?php echo $starcolor ?>"></td><td></td></tr>
Expand All @@ -173,5 +209,8 @@
</form>
<hr>
<img src="generatemap.php">
</div>
<?php include('/home/web/fuzzwork/htdocs/bootstrap/footer.php'); ?>

</body>
</html>

0 comments on commit 60f27ca

Please sign in to comment.