/** {@inheritdoc} */ public function draw($canvas) { $zoom = $this->map->getZoom(); $proj = $this->map->getProjection(); $vp = $this->map->getViewport(); foreach ($this->features as $feature) { $feature->draw($proj, $canvas, -$vp->left, -$vp->top, $zoom); } }
/** * @param \Bmsite\Maps\StaticMap\StaticMapGenerator $map * @param int $maxZoom */ public function __construct(StaticMapGenerator $map, $maxZoom) { $this->map = $map; $this->proj = $map->getProjection(); $this->debug = $map->getDebug(); $this->mapname = $map->getMapName(); $this->maxZoom = $maxZoom; }
/** * Parse location x/y * * @param string $val * * @return mixed */ protected function parseLocation($val) { $ret = false; $pairs = explode(',', $val); if (count($pairs) == 2 && is_numeric($pairs[0]) && is_numeric($pairs[1])) { $x = (double) $pairs[0]; $y = (double) $pairs[1]; $proj = $this->map->getProjection(); try { $ret = $proj->project(new Point($x, $y)); } catch (\InvalidArgumentException $e) { // ignore point } } return $ret; }