/** * Sets the directions waypoint location * * Available prototypes: * - public function setLocation(string $destination) * - public function setLocation(double $latitude, double $longitude, boolean $noWrap) $ - public function setLocation(Ivory\GoogleMapBundle\Model\Base\Coordinate $destination) */ public function setLocation() { $args = func_get_args(); if (isset($args[0]) && is_string($args[0])) { $this->location = $args[0]; } else { if (isset($args[0]) && is_numeric($args[0]) && isset($args[1]) && is_numeric($args[1])) { if (is_null($this->location)) { $this->location = new Coordinate(); } $this->location->setLatitude($args[0]); $this->location->setLongitude($args[1]); if (isset($args[2]) && is_bool($args[2])) { $this->location->setNoWrap($args[2]); } } else { if (isset($args[0]) && $args[0] instanceof Coordinate) { $this->location = $args[0]; } else { throw new \InvalidArgumentException(sprintf('%s' . PHP_EOL . '%s' . PHP_EOL . '%s' . PHP_EOL . '%s' . PHP_EOL . '%s', 'The location setter arguments are invalid.', 'The available prototypes are :', ' - public function setLocation(string $destination)', ' - public function setLocation(double $latitude, double $longitude, boolean $noWrap)', ' - public function setLocation(Ivory\\GoogleMapBundle\\Model\\Base\\Coordinate $destination)')); } } } }
/** * Renders the coordinate * * @param Ivory\GoogleMapBundle\Model\Base\Coordinate $coordinate * @return string HTML output */ public function render(Coordinate $coordinate) { return sprintf('new google.maps.LatLng(%s, %s, %s)', $coordinate->getLatitude(), $coordinate->getLongitude(), json_encode($coordinate->isNoWrap())); }
/** * Create a coordinate * * @param integer $latitude The latitude * @param integer $longitue The longitude * @param boolean $noWrap No wrap flag */ public function __construct($latitude = 0, $longitude = 0, $noWrap = true) { parent::__construct($latitude, $longitude, $noWrap); }