Changeset 249
- Timestamp:
- 11/17/07 16:39:22 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
sovereignty/gen_map.php5
r246 r249 17 17 include('evedb.php'); 18 18 19 set_time_limit(3 30);19 set_time_limit(390); 20 20 error_reporting(E_ALL ^ E_NOTICE); 21 21 … … 364 364 function paintRow($y) 365 365 { 366 global $image, $alliances, $curBorder, $curRow, $prevRow, $opt, $nameStack, $segID ;366 global $image, $alliances, $curBorder, $curRow, $prevRow, $opt, $nameStack, $segID, $segGID; 367 367 368 368 $curA = -1; … … 435 435 { 436 436 // 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) 438 438 { 439 439 continue; 440 440 } 441 441 442 if (($segment['lstart']- 30 < $curSegment['start']) && ($segment['lend']+30 > $curSegment['end']))442 if (($segment['lstart']-10 < $curSegment['start']) && ($segment['lend']+10 > $curSegment['end'])) 443 443 { 444 444 // the current segment fits into this from the alliance 445 445 $validSegs[] = $id; 446 446 } 447 elseif (($segment['lstart']+ 30 > $curSegment['start']) && ($segment['lend']-30 < $curSegment['end']))447 elseif (($segment['lstart']+10 > $curSegment['start']) && ($segment['lend']-10 < $curSegment['end'])) 448 448 { 449 449 // the alliance segment fits into the current one … … 454 454 if (count($validSegs) > 1) 455 455 { 456 $tmp = array_shift($validSegs); 456 // get the biggest chunk and set the id to that parent 457 $max = 0; 457 458 foreach ($validSegs as $id) 458 459 { 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 { 459 469 // 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; 461 471 } 462 $curSegment['id'] = $ tmp;472 $curSegment['id'] = $maxid; 463 473 $alliances[$alliance]['segments'][] = $curSegment; 464 474 } … … 472 482 else 473 483 { 484 $curSegment['id'] = ++$segGID; 474 485 $alliances[$alliance]['segments'][] = $curSegment; 475 486 } 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']); 476 499 } 477 500 … … 497 520 $array[$segment['id']]['count'] += $segment['count']; 498 521 $array[$segment['id']]['Tcount'] += $segment['Tcount']; 499 $array[$segment['id']]['l start'] = $segment['start'];500 $array[$segment['id']]['l end'] = $segment['end'];522 $array[$segment['id']]['lend'] = $alliances[$alliance]['lastyend'][$y][$segment['id']]; 523 $array[$segment['id']]['lstart'] = $alliances[$alliance]['lasty'][$y][$segment['id']]; 501 524 502 525 if (!isset($segment['firsty'])) 503 526 { 504 527 $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']; 505 536 } 506 537 if (isset($array[$segment['id']]['start'])) … … 510 541 $array[$segment['id']]['end'] = max($segment['end'], $array[$segment['id']]['end']); 511 542 $array[$segment['id']]['firsty'] = min($segment['firsty'], $array[$segment['id']]['firsty']); 543 #echo 'segstrt::'.$segment['start'].' def::'.$array[$segment['id']]['lstart']."\n"; 512 544 } 513 545 else … … 656 688 function printSegments($alliance) 657 689 { 658 global $image ;659 $red = imagecolorallocate($image, 255, 0, 0);690 global $image, $opt; 691 #$red = imagecolorallocate($image, 255, 0, 0); 660 692 foreach ($alliance['segments'] as $segment) 661 693 { … … 664 696 $x = round($segment['x']/$segment['count']); 665 697 $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); 668 700 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']); 669 702 } 670 703 } … … 709 742 $white = imagecolorallocate($image, 255, 255, 255); 710 743 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 711 799 $a = &$alliances[$allianceIDtoA[$row['fromAlliance']]]['color']; 712 800 $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); … … 715 803 $a = &$alliances[$allianceIDtoA[$row['toAlliance']]]['color']; 716 804 $color = imagecolorallocate($image, $a['r'], $a['g'], $a['b']); 717 $toc = $color;718 805 imagettftext($image, $opt['sovSize'], 0, $sovGstart, $y, $color, $opt['sov_font'], $alliances[$allianceIDtoA[$row['toAlliance']]]['name']); 719 806 … … 721 808 imagettftext($image, $opt['sovSize'], 0, $sovSstart, $y, $color, $opt['sov_font'], $row['solarSystemName']); 722 809 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 else738 {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 }746 810 747 811 imageline($image, $x+7, $y-15, $x+7, $y, $white);