|
|
|
@ -139,7 +139,7 @@ function critere_distancefrom_dist($idb, &$boucles, $crit) {
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
($id_table == 'gis' or isset($boucle->join['gis'])) // Soit depuis une boucle (GIS) soit un autre objet mais avec {gis}
|
|
|
|
|
and count($crit->param) == 3 // Il faut aussi qu'il y ait 3 critères obligatoires
|
|
|
|
|
and (is_countable($crit->param) ? count($crit->param) : 0) == 3 // Il faut aussi qu'il y ait 3 critères obligatoires
|
|
|
|
|
) {
|
|
|
|
|
$point_reference = calculer_liste($crit->param[0], [], $boucles, $boucles[$idb]->id_parent);
|
|
|
|
|
$operateur = calculer_liste($crit->param[1], [], $boucles, $boucles[$idb]->id_parent);
|
|
|
|
@ -494,26 +494,26 @@ function gis_icon_properties($img = '') {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($icon) {
|
|
|
|
|
$props .= ",\n\t\t\t\"icon\": " . json_encode(url_absolue($icon)) . ',';
|
|
|
|
|
list($h,$w) = taille_image($icon);
|
|
|
|
|
$props .= "\n\t\t\t\"icon_size\": " . json_encode([$w,$h]) . ',';
|
|
|
|
|
$props .= ",\n\t\t\t\"icon\": " . json_encode(url_absolue($icon), JSON_THROW_ON_ERROR) . ',';
|
|
|
|
|
[$h, $w] = taille_image($icon);
|
|
|
|
|
$props .= "\n\t\t\t\"icon_size\": " . json_encode([$w,$h], JSON_THROW_ON_ERROR) . ',';
|
|
|
|
|
/**
|
|
|
|
|
* Si l'icone est carrée, on considère que c'est soit un point soit un carré qui pointe un lieu et non une "goutte"
|
|
|
|
|
* On centre donc au milieu de l'icone
|
|
|
|
|
*/
|
|
|
|
|
if ($w == $h) {
|
|
|
|
|
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode([$w / 2, $h / 2]) . ',';
|
|
|
|
|
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode([$w / 2, $h / 2], JSON_THROW_ON_ERROR) . ',';
|
|
|
|
|
$props .= "\n\t\t\t\"popup_anchor\": " . json_encode([0,0]);
|
|
|
|
|
} else {
|
|
|
|
|
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode([$w / 2, $h]) . ',';
|
|
|
|
|
$props .= "\n\t\t\t\"popup_anchor\": " . json_encode([1, -round($h / 1.2, 2)]);
|
|
|
|
|
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode([$w / 2, $h], JSON_THROW_ON_ERROR) . ',';
|
|
|
|
|
$props .= "\n\t\t\t\"popup_anchor\": " . json_encode([1, -round($h / 1.2, 2)], JSON_THROW_ON_ERROR);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($shadow = find_in_path('images/marker_defaut_shadow.png')) {
|
|
|
|
|
$props .= ",\n\t\t\t\"shadow\": " . json_encode(url_absolue($shadow));
|
|
|
|
|
list($h,$w) = taille_image($shadow);
|
|
|
|
|
$props .= ",\n\t\t\t\"shadow_size\": " . json_encode([$w,$h]);
|
|
|
|
|
$props .= ",\n\t\t\t\"shadow\": " . json_encode(url_absolue($shadow), JSON_THROW_ON_ERROR);
|
|
|
|
|
[$h, $w] = taille_image($shadow);
|
|
|
|
|
$props .= ",\n\t\t\t\"shadow_size\": " . json_encode([$w,$h], JSON_THROW_ON_ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $props;
|
|
|
|
@ -548,23 +548,24 @@ if (!defined('_TAILLE_MAX_GIS_STATIC')) {
|
|
|
|
|
**/
|
|
|
|
|
function gis_static_map($id_gis, $width, $height, $maptype = false, $zoom = null, $markers = null, $lat = 0, $lon = 0) {
|
|
|
|
|
|
|
|
|
|
$markers_ = [];
|
|
|
|
|
$gis = [];
|
|
|
|
|
|
|
|
|
|
if ($id_gis) {
|
|
|
|
|
$gis = sql_fetsel('lat,lon,zoom', 'spip_gis', 'id_gis=' . intval($id_gis));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$zoom = isset($zoom) ? $zoom : $gis['zoom'];
|
|
|
|
|
$zoom ??= $gis['zoom'];
|
|
|
|
|
|
|
|
|
|
$lat = isset($gis['lat']) ? $gis['lat'] : $lat;
|
|
|
|
|
$lon = isset($gis['lon']) ? $gis['lon'] : $lon;
|
|
|
|
|
$lat = $gis['lat'] ?? $lat;
|
|
|
|
|
$lon = $gis['lon'] ?? $lon;
|
|
|
|
|
|
|
|
|
|
if (intval($id_gis) and !$markers) {
|
|
|
|
|
$markers_[] = ['lat' => (float) $lat, 'lon' => (float) $lon];
|
|
|
|
|
} else {
|
|
|
|
|
$markers = explode('|', $markers);
|
|
|
|
|
foreach ($markers as $marker) {
|
|
|
|
|
list($markerLat, $markerLon, $markerUrl) = explode(';', $marker);
|
|
|
|
|
[$markerLat, $markerLon, $markerUrl] = explode(';', $marker);
|
|
|
|
|
$markers_[] = ['lat' => (float) $markerLat, 'lon' => (float) $markerLon, 'url' => $markerUrl];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|