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:
abijah
2009-05-29 05:10:46 +00:00
parent 77c038e880
commit 50449205b4
3 changed files with 30 additions and 18 deletions

View File

@@ -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;
}
}