/** * Sets the origin of the marker image * * Available prototypes: * - function setOrigin(Ivory\GoogleMap\Base\Point $origin = null) * - function setOrigin(double x, double y) * * @throws \Ivory\GoogleMap\Exception\OverlayException If the origin is not valid. */ public function setOrigin() { $args = func_get_args(); if (isset($args[0]) && $args[0] instanceof Point) { $this->origin = $args[0]; } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) { if ($this->origin === null) { $this->origin = new Point(); } $this->origin->setX($args[0]); $this->origin->setY($args[1]); } elseif (!isset($args[0])) { $this->origin = null; } else { throw OverlayException::invalidMarkerImageOrigin(); } }
public function testRender() { $point = new Point(1.1, 2.1); $point->setJavascriptVariable('foo'); $this->assertSame('foo = new google.maps.Point(1.1, 2.1);' . PHP_EOL, $this->pointHelper->render($point)); }
/** * Renders a point. * * @param \Ivory\GoogleMap\Base\Point $point The point. * * @return string The JS output. */ public function render(Point $point) { return sprintf('%s = new google.maps.Point(%s, %s);' . PHP_EOL, $point->getJavascriptVariable(), $point->getX(), $point->getY()); }
/** * @expectedException \Ivory\GoogleMap\Exception\BaseException * @expectedExceptionMessage The y coordinate of a point must be a numeric value. */ public function testYWithInvalidValue() { $this->point->setY(true); }