/** * Set coordinates of the marker. * * @param LatLng|array|string $latLng The new coordinates. * * @return $this */ public function setLatLng($latLng) { if (!$latLng instanceof LatLng) { $latLng = LatLng::fromNative($latLng); } $this->latLng = $latLng; return $this; }
/** * Set the center. * * @param LatLng|array $center The map center. * * @return $this * @see http://leafletjs.com/reference.html#map-center */ public function setCenter($center) { if (!$center instanceof LatLng) { $center = LatLng::fromNative($center); } Assertion::isInstanceOf($center, 'Netzmacht\\LeafletPHP\\Value\\LatLng'); return $this->setOption('center', $center); }
/** * Add a latitude longitude position. * * This method differs from the Leaflet JS API! Instead of passing the shape as second argument you can define * the index of the ring. * * @param LatLng|array|string $latLng LatLng coordinate. * @param int $ringIndex The index of the ring. * * @return $this */ public function addLatLng($latLng, $ringIndex = 0) { if (is_scalar($latLng)) { $latLng = LatLng::fromNative($latLng); } Assertion::isInstanceOf($latLng, 'Netzmacht\\LeafletPHP\\Value\\LatLng'); $ringIndex = (int) $ringIndex; $this->latLngs[$ringIndex][] = $latLng; return $this; }