Implement as dynamic setting of the map bounds.

This commit is contained in:
David Molineus
2015-01-20 09:38:35 +01:00
parent 41eb0f7834
commit e83e2c5482
10 changed files with 148 additions and 5 deletions

View File

@@ -63,6 +63,7 @@ class MapMapper extends AbstractMapper
$this->buildCustomOptions($map, $model);
$this->buildControls($map, $model, $builder, $bounds);
$this->buildLayers($map, $model, $builder, $bounds);
$this->buildBoundsCalculation($map, $model);
}
}
@@ -150,4 +151,23 @@ class MapMapper extends AbstractMapper
}
}
}
/**
* Build map bounds calculations.
*
* @param Map $map The map being built.
* @param MapModel $model The map model.
*/
private function buildBoundsCalculation(Map $map, MapModel $model)
{
$adjustBounds = deserialize($model->adjustBounds, true);
if (in_array('deferred', $adjustBounds)) {
$map->setOption('adjustBounds', true);
}
if (in_array('load', $adjustBounds)) {
$map->calculateFeatureBounds();
}
}
}