Changeset 249

Show
Ignore:
Timestamp:
11/17/07 16:39:22 (13 years ago)
Author:
exi
Message:

Patched the area linker to use proper start/end counts and therefore fix that issue in the Goonswarm area.
Sovereignty changes in station systems now have a border around the entry in the legend.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • sovereignty/gen_map.php5

    r246 r249  
    1717include('evedb.php'); 
    1818 
    19 set_time_limit(330); 
     19set_time_limit(390); 
    2020error_reporting(E_ALL ^ E_NOTICE); 
    2121 
     
    364364function paintRow($y) 
    365365{ 
    366     global $image, $alliances, $curBorder, $curRow, $prevRow, $opt, $nameStack, $segID; 
     366    global $image, $alliances, $curBorder, $curRow, $prevRow, $opt, $nameStack, $segID, $segGID; 
    367367 
    368368    $curA = -1; 
     
    435435        { 
    436436            // make sure we dont connect bubbles on the same x when they're spread apart 
    437             if ($curSegment['lasty'] - $segment['lasty'] > 5) 
     437            if ($curSegment['lasty'] - $segment['lasty'] > 2) 
    438438            { 
    439439                continue; 
    440440            } 
    441441 
    442             if (($segment['lstart']-30 < $curSegment['start']) && ($segment['lend']+30 > $curSegment['end'])) 
     442            if (($segment['lstart']-10 < $curSegment['start']) && ($segment['lend']+10 > $curSegment['end'])) 
    443443            { 
    444444                // the current segment fits into this from the alliance 
    445445                $validSegs[] = $id; 
    446446            } 
    447             elseif (($segment['lstart']+30 > $curSegment['start']) && ($segment['lend']-30 < $curSegment['end'])) 
     447            elseif (($segment['lstart']+10 > $curSegment['start']) && ($segment['lend']-10 < $curSegment['end'])) 
    448448            { 
    449449                // the alliance segment fits into the current one 
     
    454454        if (count($validSegs) > 1) 
    455455        { 
    456             $tmp = array_shift($validSegs); 
     456            // get the biggest chunk and set the id to that parent 
     457            $max = 0; 
    457458            foreach ($validSegs as $id) 
    458459            { 
     460                if ($alliances[$alliance]['segments'][$id]['count'] > $max) 
     461                { 
     462                    $max = $alliances[$alliance]['segments'][$id]['count']; 
     463                    $maxid = $id; 
     464                } 
     465            } 
     466 
     467            foreach ($validSegs as $id) 
     468            { 
    459469                // set all ids to the same value so they are merged 
    460                 $alliances[$alliance]['segments'][$id]['id'] = $tmp; 
     470                $alliances[$alliance]['segments'][$id]['id'] = $maxid; 
    461471             } 
    462              $curSegment['id'] = $tmp; 
     472             $curSegment['id'] = $maxid; 
    463473             $alliances[$alliance]['segments'][] = $curSegment; 
    464474        } 
     
    472482        else 
    473483        { 
     484            $curSegment['id'] = ++$segGID; 
    474485            $alliances[$alliance]['segments'][] = $curSegment; 
    475486        } 
     487 
     488        // set start x for this line/segment 
     489        if (!isset($alliances[$alliance]['lasty'][$y][$curSegment['id']])) 
     490        { 
     491            $alliances[$alliance]['lasty'][$y][$curSegment['id']] = $curSegment['start']; 
     492        } 
     493        $alliances[$alliance]['lasty'][$y][$curSegment['id']] = min($alliances[$alliance]['lasty'][$y][$curSegment['id']], $curSegment['start']); 
     494        if (!isset($alliances[$alliance]['lastyend'][$y][$curSegment['id']])) 
     495        { 
     496            $alliances[$alliance]['lastyend'][$y][$curSegment['id']] = $curSegment['end']; 
     497        } 
     498        $alliances[$alliance]['lastyend'][$y][$curSegment['id']] = max($alliances[$alliance]['lastyend'][$y][$curSegment['id']], $curSegment['end']); 
    476499    } 
    477500 
     
    497520            $array[$segment['id']]['count'] += $segment['count']; 
    498521            $array[$segment['id']]['Tcount'] += $segment['Tcount']; 
    499             $array[$segment['id']]['lstart'] = $segment['start']; 
    500             $array[$segment['id']]['lend'] = $segment['end']; 
     522            $array[$segment['id']]['lend'] = $alliances[$alliance]['lastyend'][$y][$segment['id']]; 
     523            $array[$segment['id']]['lstart'] = $alliances[$alliance]['lasty'][$y][$segment['id']]; 
    501524 
    502525            if (!isset($segment['firsty'])) 
    503526            { 
    504527                $segment['firsty'] = $segment['lasty']; 
     528            } 
     529            if (!$segment['lstart']) 
     530            { 
     531                $segment['lstart'] = $segment['start']; 
     532            } 
     533            if (!$segment['lend']) 
     534            { 
     535                $segment['lend'] = $segment['end']; 
    505536            } 
    506537            if (isset($array[$segment['id']]['start'])) 
     
    510541                $array[$segment['id']]['end'] = max($segment['end'], $array[$segment['id']]['end']); 
    511542                $array[$segment['id']]['firsty'] = min($segment['firsty'], $array[$segment['id']]['firsty']); 
     543                #echo 'segstrt::'.$segment['start'].' def::'.$array[$segment['id']]['lstart']."\n"; 
    512544            } 
    513545            else 
     
    656688function printSegments($alliance) 
    657689{ 
    658     global $image; 
    659     $red = imagecolorallocate($image, 255, 0, 0); 
     690    global $image, $opt; 
     691    #$red = imagecolorallocate($image, 255, 0, 0); 
    660692    foreach ($alliance['segments'] as $segment) 
    661693    { 
     
    664696        $x = round($segment['x']/$segment['count']); 
    665697        $y = round($segment['y']/$segment['count']); 
    666         imagefilledellipse($image, $x, $y, 10, 10, $color); 
    667         imagefilledellipse($image, $x, $y, 4, 4, $red); 
     698        #imagefilledellipse($image, $x, $y, 10, 10, $color); 
     699        #imagefilledellipse($image, $x, $y, 4, 4, $red); 
    668700        imagerectangle($image, $segment['start'], $segment['firsty'], $segment['end'], $segment['lasty'], $color); 
     701        imagettftext($image, 10, 0, $segment['start'], $segment['firsty'], $color, $opt['sov_font'], $segment['id']); 
    669702    } 
    670703} 
     
    709742    $white = imagecolorallocate($image, 255, 255, 255); 
    710743 
     744    if ($row['toAlliance'] == 0) 
     745    { 
     746        $toc = imagecolorallocate($image, 80, 80, 80); 
     747    } 
     748    else 
     749    { 
     750        $a = &$alliances[$allianceIDtoA[$row['toAlliance']]]['color']; 
     751        $toc = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 
     752    } 
     753 
     754    // normal system change, print the icon and a circle around the system on the map 
     755    if ($systems_id[$row['solarSystemID']]['outpost'] == null) 
     756    { 
     757        $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 
     758        $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 
     759        imageellipse($image, $systems_id[$row['solarSystemID']]['x'], $systems_id[$row['solarSystemID']]['y'], 7, 7, $color); 
     760 
     761        imagefilledellipse($image, $x, $y-5, 4, 3, $toc); 
     762    } 
     763    else 
     764    { 
     765        // this is an outpost change, print the outpost icon 
     766        imagefilledellipse($image, $x-1, $y-1-5, 2, 1, $toc); 
     767        imagerectangle($image, $x-2, $y-3-5, $x+2, $y+1-5, $toc); 
     768 
     769        $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 
     770        $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 
     771        imageellipse($image, $systems_id[$row['solarSystemID']]['x'], $systems_id[$row['solarSystemID']]['y']-1, 9, 9, $color); 
     772 
     773        // depending on the change 
     774        // display the box around it in the appropiate color 
     775        if ($row['toAlliance'] == 0) 
     776        { 
     777            $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 
     778            $color = imagecolorallocatealpha($image, $a['r'], $a['g'], $a['b'], 20); 
     779            imagerectangle($image, $x-7, $y-15, $sovRstart+80, $y, $color); 
     780        } 
     781        elseif ($row['fromAlliance'] == 0) 
     782        { 
     783            $a = &$alliances[$allianceIDtoA[$row['toAlliance']]]['color']; 
     784            $color = imagecolorallocatealpha($image, $a['r'], $a['g'], $a['b'], 20); 
     785            imagerectangle($image, $x-7, $y-13, $sovRstart+80, $y+2, $color); 
     786        } 
     787        else 
     788        { 
     789            $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 
     790            $color1 = imagecolorallocatealpha($image, $a['r'], $a['g'], $a['b'], 20); 
     791            $a = &$alliances[$allianceIDtoA[$row['toAlliance']]]['color']; 
     792            $color2 = imagecolorallocatealpha($image, $a['r'], $a['g'], $a['b'], 20); 
     793 
     794            imagesetstyle($image, array($color1, $color1, $color2, $color2, $color2)); 
     795            imagerectangle($image, $x-7, $y-13, $sovRstart+80, $y+2, IMG_COLOR_STYLED); 
     796        } 
     797    } 
     798 
    711799    $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 
    712800    $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 
     
    715803    $a = &$alliances[$allianceIDtoA[$row['toAlliance']]]['color']; 
    716804    $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 
    717     $toc = $color; 
    718805    imagettftext($image, $opt['sovSize'], 0, $sovGstart, $y, $color, $opt['sov_font'], $alliances[$allianceIDtoA[$row['toAlliance']]]['name']); 
    719806 
     
    721808    imagettftext($image, $opt['sovSize'], 0, $sovSstart, $y, $color, $opt['sov_font'], $row['solarSystemName']); 
    722809    imagettftext($image, $opt['sovSize'], 0, $sovRstart, $y, $white, $opt['sov_font'], $systems_id[$row['solarSystemID']]['regionName']); 
    723  
    724     if ($row['toAlliance'] == 0) 
    725     { 
    726         $toc = imagecolorallocate($image, 80, 80, 80); 
    727     } 
    728  
    729     if ($systems_id[$row['solarSystemID']]['outpost'] == null) 
    730     { 
    731         $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 
    732         $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 
    733         imageellipse($image, $systems_id[$row['solarSystemID']]['x'], $systems_id[$row['solarSystemID']]['y'], 7, 7, $color); 
    734  
    735         imagefilledellipse($image, $x, $y-5, 4, 3, $toc); 
    736     } 
    737     else 
    738     { 
    739         imagefilledellipse($image, $x-1, $y-1-5, 2, 1, $toc); 
    740         imagerectangle($image, $x-2, $y-3-5, $x+2, $y+1-5, $toc); 
    741  
    742         $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 
    743         $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 
    744         imageellipse($image, $systems_id[$row['solarSystemID']]['x'], $systems_id[$row['solarSystemID']]['y']-1, 9, 9, $color); 
    745     } 
    746810 
    747811    imageline($image, $x+7, $y-15, $x+7, $y, $white);