/** * method puts scalebar onto map * * @param Layout $layout */ public function putOnMap($layout = null) { $this->setLogoLayout($layout); $worldMap = $this->_map->getWorldMap(); $widthPx = $worldMap->getWidth(); $equatorPixelsPerKm = $widthPx / self::$earthCircumference; $scale = $this->_calculateScale(); $label = $this->_findOutWhichLabel($scale, $equatorPixelsPerKm); $this->_layout->putImage($this->_map, $this->_createScaleBarMap($label, $this->_calculateLengthOfScaleBar($label, $scale, $equatorPixelsPerKm))); }
public function __construct(Map $map, Conf $conf) { $this->setImageHandler($map->getImageHandler()); $this->_logoLayout = LogoLayout::factory($conf->get('logo_layout')); $this->_logoFiles = $conf->get('logo_files'); $this->setWorldMap($map->getWorldMap()); $leftUpCorner = $map->getLeftUpCorner(); $this->setLeftUpCorner($leftUpCorner['lon'], $leftUpCorner['lat']); $rightDownCorner = $map->getRightDownCorner(); $this->setRightDownCorner($rightDownCorner['lon'], $rightDownCorner['lat']); parent::__construct($map->getImage()); }