protected function computeBounds(Map $map)
    {
        $bounds = array();

        if ($map->isAutoZoom() && !in_array($map->getBound(), $bounds)) {
            $bounds[] = $map->getBound();
        }

        foreach ($map->getGroundOverlays() as $groundOverlay) {
            if (!in_array($groundOverlay->getBound(), $bounds)) {
                $bounds[] = $groundOverlay->getBound();
            }
        }

        foreach ($map->getRectangles() as $rectangle) {
            if (!in_array($rectangle->getBound(), $bounds)) {
                $bounds[] = $rectangle->getBound();
            }
        }

        return $bounds;
    }