Beispiel #1
0
 /**
  * Sets the circle center.
  *
  * Available prototypes:
  *  - function setCenter(Ivory\GoogleMap\Base\Coordinate $center)
  *  - function setCenter(double $latitude, double $longitude, boolean $noWrap = true)
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the center is not valid (prototypes).
  */
 public function setCenter()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Coordinate) {
         $this->center = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         $this->center->setLatitude($args[0]);
         $this->center->setLongitude($args[1]);
         if (isset($args[2]) && is_bool($args[2])) {
             $this->center->setNoWrap($args[2]);
         }
     } else {
         throw OverlayException::invalidCircleCenter();
     }
 }
Beispiel #2
0
 /**
  * Sets the marker position.
  *
  * Available prototypes:
  * - function setPosition(Ivory\GoogleMap\Base\Coordinate $position = null)
  * - function setPosition(double $latitude, double $longitude, boolean $noWrap = true)
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the position is not valid.
  */
 public function setPosition()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Coordinate) {
         $this->position = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         $this->position->setLatitude($args[0]);
         $this->position->setLongitude($args[1]);
         if (isset($args[2]) && is_bool($args[2])) {
             $this->position->setNoWrap($args[2]);
         }
     } elseif (!isset($args[0])) {
         $this->position = null;
     } else {
         throw OverlayException::invalidMarkerPosition();
     }
 }
Beispiel #3
0
 /**
  * Sets the north east coordinate.
  *
  * Available prototypes:
  *  - function setNorthEast(Ivory\GoogleMap\Base\Coordinate $northEast = null)
  *  - function setNorthEast(double $latitude, double $longitude, boolean $noWrap = true)
  *
  * @throws \Ivory\GoogleMap\Exception\BaseException If the north east coordinate is not valid (prototypes).
  */
 public function setNorthEast()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Coordinate) {
         $this->northEast = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         if ($this->northEast === null) {
             $this->northEast = new Coordinate();
         }
         $this->northEast->setLatitude($args[0]);
         $this->northEast->setLongitude($args[1]);
         if (isset($args[2]) && is_bool($args[2])) {
             $this->northEast->setNoWrap($args[2]);
         }
     } elseif (!isset($args[0])) {
         $this->northEast = null;
     } else {
         throw BaseException::invalidBoundNorthEast();
     }
 }
 /**
  * Sets the geocoder request coordinate
  *
  * Available prototypes:
  *  - function setCoordinate(\Ivory\GoogleMap\Base\Coordinate $coordinate = null)
  *  - function setCoordinate(double $latitude, double $longitude, boolean $noWrap = true)
  *
  * @throws \Ivory\GoogleMap\Exception\GeocodingException If the coordinate is not valid (prototypes).
  */
 public function setCoordinate()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Coordinate) {
         $this->coordinate = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         if (!$this->hasCoordinate()) {
             $this->coordinate = new Coordinate();
         }
         $this->coordinate->setLatitude($args[0]);
         $this->coordinate->setLongitude($args[1]);
         if (isset($args[2]) && is_bool($args[2])) {
             $this->coordinate->setNoWrap($args[2]);
         }
     } elseif (!isset($args[0])) {
         $this->coordinate = null;
     } else {
         throw GeocodingException::invalidGeocoderRequestCoordinate();
     }
     return $this;
 }
 /**
  * Adds an origin to the request.
  *
  * Available prototypes:
  * - function addOrigin(string $destination)
  * - function addOrigin(Ivory\GoogleMap\Base\Coordinate $destination)
  * - function addOrigin(double $latitude, double $longitude, boolean $noWrap)
  *
  * @throws \Ivory\GoogleMap\Exception\DistanceMatrixException If the origin is not valid (prototypes).
  */
 public function addOrigin()
 {
     $args = func_get_args();
     if (isset($args[0]) && is_string($args[0])) {
         $this->origins[] = $args[0];
     } elseif (isset($args[0]) && $args[0] instanceof Coordinate) {
         $this->origins[] = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         $origin = new Coordinate();
         $origin->setLatitude($args[0]);
         $origin->setLongitude($args[1]);
         if (isset($args[2]) && is_bool($args[2])) {
             $origin->setNoWrap($args[2]);
         }
         $this->origins[] = $origin;
     } else {
         throw DistanceMatrixException::invalidDistanceMatrixRequestOrigin();
     }
 }
 /**
  * @expectedException \Ivory\GoogleMap\Exception\BaseException
  * @expectedExceptionMessage The longitude of a coordinate must be a numeric value.
  */
 public function testLongitudeWithInvalidLongitude()
 {
     $this->coordinate->setLongitude(true);
 }