Les styles de poi du calque de tuiles pbf sont définis dans la structure php

This commit is contained in:
leosw committed 2026-10-18 19:16:39 +02:00
1 parent 9ba17b54a2
commit 2093a584bb
3 files changed
+26 -10

No files matched your search

+11
View File
@@ -38,6 +38,17 @@
<?php } ?>
"default": "<?=$config['views_url']?>img/default.svg"
};
window.poi_style_map = {
<?php foreach($poi_types as $k => $t) {
$color = isset($t[2]) ? $t[2] : '#ef2929';
// Read size/shape from structure if provided, else fallback to sensible defaults
$size = isset($t[6]) ? (int)$t[6] : 16;
$shape = isset($t[7]) ? $t[7] : 'square';
?>
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>" },
<?php } ?>
};
</script>
</body>
+9 -10
View File
@@ -52,7 +52,7 @@ $(document).ready(function() {
// ---------------------------------------------------------
// Fonction qui génère le SVG du point pour les calques en pbf
function svgDataUriFor(color, size, shape, strokeOpacity = 0.2) {
function svgDataUriFor(color, size, shape, strokeOpacity = 0.4) {
const w = size, h = size, strokeWidth = 1, r = Math.max(1, Math.round(size * 0.15));
const inset = 2 + strokeWidth / 2, innerW = w - inset * 2, innerH = h - inset * 2;
let shapeSvg;
@@ -74,18 +74,17 @@ $(document).ready(function() {
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
}
var poiStyleMap = {
"wilderness_hut": { color: "#d73a3a", size: 16, shape: "square" },
"basic_hut": { color: "#d73a3a", size: 14, shape: "square" },
"alpine_hut": { color: "#d73a3a", size: 18, shape: "square" },
"halt": { color: "#4caf50", size: 18, shape: "square" },
"bivouac": { color: "#d73a3a", size: 16, shape: "triangle" },
"campsite": { color: "#4caf50", size: 16, shape: "triangle" }
};
function getPoiStyle(type) {
if (window.poi_style_map && window.poi_style_map[type]) {
return window.poi_style_map[type];
}
// Final hardcoded fallback (keeps previous defaults)
return { color: "#ef2929", size: 14, shape: "square" };
}
function buildPoiVectorIcon(properties) {
var type = (properties && (properties.type || properties.poi_type || properties.poiType)) || "default";
var style = poiStyleMap[type] || { color: "#d73a3a", size: 14, shape: "square" };
var style = getPoiStyle(type);
var iconUrl = svgDataUriFor(style.color, style.size, style.shape);
return L.icon({
+6
View File
@@ -15,6 +15,7 @@ $poi_types = array(
'b_water' => "💧 Eau à proximité ?",
'b_wood' => "🌲 Bois à proximité ?"
)
, 14, "square"
),
"wilderness_hut" => array("Cabane non gardée", "Cabane", "#ef2929", "wilderness_hut",
@@ -33,6 +34,7 @@ $poi_types = array(
'b_fireplace' => "🔥 Cheminée ou poêle à bois ?",
'b_toilet' => "🚽 Latrines ou toilettes ?"
)
, 16, "square"
),
"alpine_hut" => array("Refuge gardé", "Refuge", "#ef2929", "alpine_hut",
@@ -52,6 +54,7 @@ $poi_types = array(
'b_toilet' => "🚽 Latrines ou toilettes ?",
'l_water' => "URL du site web :"
)
, 18, "square"
),
"halt" => array("Gîte d'étape", "Gîte", "#4e9a06", "halt",
@@ -65,6 +68,7 @@ $poi_types = array(
'b_water' => "💧 Possibilité de se ravitailler en eau ?",
'l_water' => "URL du site web :"
)
, 16, "square"
),
"bivouac" => array("Zone de bivouac", "Bivouac", "#ef2929", "bivouac",
@@ -77,6 +81,7 @@ $poi_types = array(
'b_wood' => "🌲 Bois à proximité ?",
'b_fireplace' => "🔥 Emplacement pour faire un feu ?"
)
, 18, "triangle"
),
"campsite" => array("Camping", "Camping", "#4e9a06", "campsite",
@@ -89,6 +94,7 @@ $poi_types = array(
'b_water' => "💧 Possibilité de se ravitailler en eau ?",
'l_water' => "URL du site web :"
)
, 18, "triangle"
)
);