The map is working quite well now, including the legend. Next steps will be to add the sidemenu.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@36 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -79,7 +79,7 @@ class MapsController extends AppController {
|
||||
|
||||
// Get the overall site limits, and then compute the
|
||||
// actual boundary extents, adjusting for a border
|
||||
$boundary_adjustment = 5;
|
||||
$boundary_adjustment = 12;
|
||||
$bottom = 2*$boundary_adjustment + $map['Map']['depth'];
|
||||
$right = 2*$boundary_adjustment + $map['Map']['width'];
|
||||
|
||||
@@ -158,13 +158,15 @@ class MapsController extends AppController {
|
||||
$cols = 6;
|
||||
$rows = (int)((count($status) + $cols - 1) / $cols);
|
||||
|
||||
$info = array('units' => array(), 'legend' => array());
|
||||
$info = array('units' => array());
|
||||
|
||||
// Get the overall site limits, and then compute the
|
||||
// actual boundary extents, adjusting for a border
|
||||
$boundary_adjustment = 2;
|
||||
$bottom = 2*$boundary_adjustment + $cols*360;
|
||||
$right = 2*$boundary_adjustment + $rows*120;
|
||||
$boundary_adjustment = 1;
|
||||
$item_width = 40; // Absolute values are irrelevant, as they
|
||||
$item_depth = 10; // will be scaled in the end anyway.
|
||||
$bottom = 2*$boundary_adjustment + $rows*$item_depth;
|
||||
$right = 2*$boundary_adjustment + $cols*$item_width;
|
||||
|
||||
// Scale things according to desired display width
|
||||
$screen_adjustment_factor = $requested_width / $right;
|
||||
@@ -173,19 +175,28 @@ class MapsController extends AppController {
|
||||
$info['width'] = $right * $screen_adjustment_factor;
|
||||
$info['depth'] = $bottom * $screen_adjustment_factor;
|
||||
|
||||
// Get a starting point for our top left position.
|
||||
$top = $lft = $boundary_adjustment;
|
||||
|
||||
// Scale it appropriately.
|
||||
$top *= $screen_adjustment_factor;
|
||||
$lft *= $screen_adjustment_factor;
|
||||
$item_width *= $screen_adjustment_factor;
|
||||
$item_depth *= $screen_adjustment_factor;
|
||||
|
||||
foreach ($status AS $code => $color) {
|
||||
$info['units'][] = array('name' => $code,
|
||||
'status' => $code,
|
||||
'width' => $info['legend']['width'],
|
||||
'depth' => $info['legend']['depth'],
|
||||
'width' => $item_width,
|
||||
'depth' => $item_depth,
|
||||
'left' => $lft,
|
||||
'right' => $lft + $info['legend']['width'],
|
||||
'right' => $lft + $item_width,
|
||||
'top' => $top,
|
||||
'bottom' => $top + $info['legend']['depth']);
|
||||
$top += $info['legend']['depth'];
|
||||
if ($top >= $info['legend']['depth'] * $rows) {
|
||||
$top = $boundary_adjustment; $lft += $info['legend']['width'];
|
||||
'bottom' => $top + $item_depth);
|
||||
$top += $item_depth;
|
||||
if ($top >= $item_depth * $rows) {
|
||||
$top = $boundary_adjustment * $screen_adjustment_factor;
|
||||
$lft += $item_width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ foreach ($info['palate'] AS &$area) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($info['border']) {
|
||||
if (isset($info['border'])) {
|
||||
// Create border around image
|
||||
imageline($image,
|
||||
0, 0,
|
||||
@@ -68,14 +68,14 @@ foreach ($info['units'] AS $unit) {
|
||||
|
||||
// If the unit is wide enough, run the text horizontal,
|
||||
// otherwise, we'll have to run it vertical.
|
||||
if ($unit['width'] > 100) {
|
||||
imagestring($image, 1,
|
||||
if ($unit['width'] > 40 || ($unit['width'] >= $unit['depth'])) {
|
||||
imagestring($image, $unit['width']/25,
|
||||
$unit['left']+3, $unit['top']+3,
|
||||
$unit['name'],
|
||||
$info['palate']['unit'][$unit['status']]['fg']['color']);
|
||||
}
|
||||
else {
|
||||
imagestringup($image, 1,
|
||||
imagestringup($image, $unit['depth']/25,
|
||||
$unit['left']+3, $unit['bottom']-3,
|
||||
$unit['name'],
|
||||
$info['palate']['unit'][$unit['status']]['fg']['color']);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
$info['width']),
|
||||
array('alt' => 'Site Map',
|
||||
'class' => 'map',
|
||||
'border' => 0,
|
||||
'usemap' => '#mapzones'));
|
||||
?>
|
||||
|
||||
@@ -41,9 +42,9 @@
|
||||
echo $html->image(array('controller' => 'maps',
|
||||
'action' => 'legend',
|
||||
$info['map_id'],
|
||||
$info['width']),
|
||||
$info['width']/2),
|
||||
array('alt' => 'Site Map Legend',
|
||||
'class' => 'map'));
|
||||
'class' => 'legend'));
|
||||
?>
|
||||
</DIV>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user