/**
  * Sets the encoded polyline value.
  *
  * @param string $value The encoded polyline value.
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the encoded polyline value is not valid.
  */
 public function setValue($value)
 {
     if (!is_string($value)) {
         throw OverlayException::invalidEncodedPolylineValue();
     }
     $this->value = $value;
 }
Esempio n. 2
0
 /**
  * Sets the rectangle bound.
  *
  * Available prototypes:
  *  - function setBound(Ivory\GoogleMap\Base\Bound $bound)
  *  - function setBount(Ivory\GoogleMap\Base\Coordinate $southWest, Ivory\GoogleMap\Base\Coordinate $northEast)
  *  - function setBound(
  *     double $southWestLatitude,
  *     double $southWestLongitude,
  *     double $northEastLatitude,
  *     double $northEastLongitude,
  *     boolean southWestNoWrap = true,
  *     boolean $northEastNoWrap = true
  * )
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the bound is not valid.
  */
 public function setBound()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Bound) {
         if (!$args[0]->hasCoordinates()) {
             throw OverlayException::invalidRectangleBoundCoordinates();
         }
         $this->bound = $args[0];
     } elseif (isset($args[0]) && $args[0] instanceof Coordinate && (isset($args[1]) && $args[1] instanceof Coordinate)) {
         $this->bound->setSouthWest($args[0]);
         $this->bound->setNorthEast($args[1]);
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1])) && (isset($args[2]) && is_numeric($args[2])) && (isset($args[3]) && is_numeric($args[3]))) {
         $this->bound->setSouthWest(new Coordinate($args[0], $args[1]));
         $this->bound->setNorthEast(new Coordinate($args[2], $args[3]));
         if (isset($args[4]) && is_bool($args[4])) {
             $this->bound->getSouthWest()->setNoWrap($args[4]);
         }
         if (isset($args[5]) && is_bool($args[5])) {
             $this->bound->getNorthEast()->setNoWrap($args[5]);
         }
     } else {
         throw OverlayException::invalidRectangleBound();
     }
 }
Esempio n. 3
0
 /**
  * Sets the auto close flag.
  *
  * @param boolean $autoClose TRUE if all opened info windows close when one is opened else FALSE.
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the auto close flag is not valid.
  */
 public function setAutoClose($autoClose)
 {
     if (!is_bool($autoClose)) {
         throw OverlayException::invalidInfoWindowAutoClose();
     }
     $this->autoClose = $autoClose;
 }
Esempio n. 4
0
 /**
  * Add a coordinate to the polyline.
  *
  * Available prototypes:
  *  - function addCoordinate(Ivory\GoogleMap\Base\Coordinate $coordinate)
  *  - function addCoordinate(double $latitude, double $longitude, boolean $noWrap = true)
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the coordinate is not valid.
  */
 public function addCoordinate()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Coordinate) {
         $this->coordinates[] = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         $coordinate = new Coordinate($args[0], $args[1]);
         if (isset($args[2]) && is_bool($args[2])) {
             $coordinate->setNoWrap($args[2]);
         }
         $this->coordinates[] = $coordinate;
     } else {
         throw OverlayException::invalidPolylineCoordinate();
     }
 }
Esempio n. 5
0
 /**
  * Sets the marker shape.
  *
  * Available prototypes:
  *  - function setShape(Ivory\GoogleMap\Overlays\MarkerShape $shape = null)
  *  - function setShape(string $type, array $coordinates)
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the shape is not valid.
  */
 public function setShape()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof MarkerShape) {
         if (!$args[0]->hasCoordinates()) {
             throw OverlayException::invalidMarkerShapeCoordinates();
         }
         $this->shape = $args[0];
     } elseif (isset($args[0]) && is_string($args[0]) && (isset($args[1]) && is_array($args[1]))) {
         if ($this->shape === null) {
             $this->shape = new MarkerShape();
         }
         $this->shape->setType($args[0]);
         $this->shape->setCoordinates($args[1]);
     } elseif (!isset($args[0])) {
         $this->shape = null;
     } else {
         throw OverlayException::invalidMarkerShape();
     }
 }
Esempio n. 6
0
 /**
  * Adds a coordinate to the marker shape if the type is poly.
  *
  * @param integer $x The X coordinate.
  * @param integer $y The Y coordinate.
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the type is not poly or if the poly coordinate is not
  *                                                     valid.
  */
 public function addPolyCoordinate($x, $y)
 {
     if ($this->type !== 'poly') {
         throw OverlayException::invalidMarkerShapeAddPolyCoordinateCall();
     }
     if (!is_numeric($x) || !is_numeric($y)) {
         throw OverlayException::invalidMarkerShapePolyCoordinate();
     }
     $this->coordinates[] = $x;
     $this->coordinates[] = $y;
 }
Esempio n. 7
0
 /**
  * Sets the size of the marker image.
  *
  * Available prototypes:
  *  - function setSize(Ivory\GoogleMap\Base\Size $size = null)
  *  - function setSize(double $width, double $height, string $widthUnit = null, string $heightUnit = null)
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the size is not valid.
  */
 public function setSize()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof Size) {
         $this->size = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         if ($this->size === null) {
             $this->size = new Size($args[0], $args[1]);
         }
         $this->size->setWidth($args[0]);
         $this->size->setHeight($args[1]);
         if (isset($args[2]) && is_string($args[2])) {
             $this->size->setWidthUnit($args[2]);
         }
         if (isset($args[3]) && is_string($args[3])) {
             $this->size->setHeightUnit($args[3]);
         }
     } elseif (!isset($args[0])) {
         $this->size = null;
     } else {
         throw OverlayException::invalidMarkerImageSize();
     }
 }
Esempio n. 8
0
 /**
  * Sets the circle radius.
  *
  * @param double $radius The circle radius.
  *
  * @throws \Ivory\GoogleMap\Exception\OverlayException If the radius is not valid.
  */
 public function setRadius($radius)
 {
     if (!is_numeric($radius)) {
         throw OverlayException::invalidCircleRadius();
     }
     $this->radius = $radius;
 }