Rename mapUrl to getMap
Rename multiMapUrl to getMultiMap
Rename multiMapZoom to getMultiZoom
const highStrokeWidth = 4;
/**
const highStrokeWidth = 4;
/**
+ const width = 640;
+
+ /**
+ * The map height
+ */
+ const height = 640;
/**
* The osm tile server
/**
* The osm tile server
*
* @param string $caption The caption
* @param int $updated The updated timestamp
*
* @param string $caption The caption
* @param int $updated The updated timestamp
* @param int $zoom The zoom
* @param int $width The width
* @param int $height The height
* @param int $zoom The zoom
* @param int $width The width
* @param int $height The height
+ * @return array The map data
- public function mapUrl(string $caption, int $updated, float $latitude, float $longitude, int $zoom = self::zoom, int $width = self::length, int $height = self::length): array {
+ public function getMap(string $caption, int $updated, float $latitude, float $longitude, int $zoom = self::zoom, int $width = self::width, int $height = self::height): array {
- $link = $this->slugger->serialize([$updated, $latitude, $longitude, $zoom + 1, $width * 2, $height * 2]);
+ $link = $this->slugger->hash([$updated, $latitude, $longitude, $zoom + 1, $width * 2, $height * 2]);
- $src = $this->slugger->serialize([$updated, $latitude, $longitude, $zoom, $width, $height]);
+ $src = $this->slugger->hash([$updated, $latitude, $longitude, $zoom, $width, $height]);
*
* @param string $caption The caption
* @param int $updated The updated timestamp
*
* @param string $caption The caption
* @param int $updated The updated timestamp
* @param int $zoom The zoom
* @param int $width The width
* @param int $height The height
* @param int $zoom The zoom
* @param int $width The width
* @param int $height The height
+ * @return array The multi map data
- public function multiMapUrl(string $caption, int $updated, float $latitude, float $longitude, $coordinates = [], int $zoom = self::zoom, int $width = self::length, int $height = self::length): array {
+ public function getMultiMap(string $caption, int $updated, float $latitude, float $longitude, $coordinates = [], int $zoom = self::zoom, int $width = self::width, int $height = self::height): array {
//Set coordinate
$coordinate = implode('-', array_map(function ($v) { return $v['latitude'].','.$v['longitude']; }, $coordinates));
//Set coordinate
$coordinate = implode('-', array_map(function ($v) { return $v['latitude'].','.$v['longitude']; }, $coordinates));
$hash = $this->slugger->hash($coordinate);
//Set link hash
$hash = $this->slugger->hash($coordinate);
//Set link hash
- $link = $this->slugger->serialize([$updated, $latitude, $longitude, $hash, $zoom + 1, $width * 2, $height * 2]);
+ $link = $this->slugger->hash([$updated, $latitude, $longitude, $hash, $zoom + 1, $width * 2, $height * 2]);
- $src = $this->slugger->serialize([$updated, $latitude, $longitude, $hash, $zoom, $width, $height]);
+ $src = $this->slugger->hash([$updated, $latitude, $longitude, $hash, $zoom, $width, $height]);
- * Return multi map zoom
*
* Compute a zoom to have all coordinates on multi map
* Multi map visible only from -($width / 2) until ($width / 2) and from -($height / 2) until ($height / 2)
*
* Compute a zoom to have all coordinates on multi map
* Multi map visible only from -($width / 2) until ($width / 2) and from -($height / 2) until ($height / 2)
* @param int $height The height
* @return int The zoom
*/
* @param int $height The height
* @return int The zoom
*/
- public function multiMapZoom(float $latitude, float $longitude, array $coordinates = [], int $zoom = self::zoom, int $width = self::length, int $height = self::length): int {
+ public function getMultiZoom(float $latitude, float $longitude, array $coordinates = [], int $zoom = self::zoom, int $width = self::width, int $height = self::height): int {
//Iterate on each zoom
for ($i = $zoom; $i >= 1; $i--) {
//Get tile xy
//Iterate on each zoom
for ($i = $zoom; $i >= 1; $i--) {
//Get tile xy