Les styles de poi du calque de tuiles pbf sont définis dans la structure php
This commit is contained in:
1 parent
9ba17b54a2
commit
2093a584bb
3 files changed
+26
-10
No files matched your search
@@ -38,6 +38,17 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
"default": "<?=$config['views_url']?>img/default.svg"
|
"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>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ $(document).ready(function() {
|
|||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
// Fonction qui génère le SVG du point pour les calques en pbf
|
// 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 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;
|
const inset = 2 + strokeWidth / 2, innerW = w - inset * 2, innerH = h - inset * 2;
|
||||||
let shapeSvg;
|
let shapeSvg;
|
||||||
@@ -74,18 +74,17 @@ $(document).ready(function() {
|
|||||||
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
var poiStyleMap = {
|
function getPoiStyle(type) {
|
||||||
"wilderness_hut": { color: "#d73a3a", size: 16, shape: "square" },
|
if (window.poi_style_map && window.poi_style_map[type]) {
|
||||||
"basic_hut": { color: "#d73a3a", size: 14, shape: "square" },
|
return window.poi_style_map[type];
|
||||||
"alpine_hut": { color: "#d73a3a", size: 18, shape: "square" },
|
}
|
||||||
"halt": { color: "#4caf50", size: 18, shape: "square" },
|
// Final hardcoded fallback (keeps previous defaults)
|
||||||
"bivouac": { color: "#d73a3a", size: 16, shape: "triangle" },
|
return { color: "#ef2929", size: 14, shape: "square" };
|
||||||
"campsite": { color: "#4caf50", size: 16, shape: "triangle" }
|
}
|
||||||
};
|
|
||||||
|
|
||||||
function buildPoiVectorIcon(properties) {
|
function buildPoiVectorIcon(properties) {
|
||||||
var type = (properties && (properties.type || properties.poi_type || properties.poiType)) || "default";
|
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);
|
var iconUrl = svgDataUriFor(style.color, style.size, style.shape);
|
||||||
|
|
||||||
return L.icon({
|
return L.icon({
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ $poi_types = array(
|
|||||||
'b_water' => "💧 Eau à proximité ?",
|
'b_water' => "💧 Eau à proximité ?",
|
||||||
'b_wood' => "🌲 Bois à proximité ?"
|
'b_wood' => "🌲 Bois à proximité ?"
|
||||||
)
|
)
|
||||||
|
, 14, "square"
|
||||||
),
|
),
|
||||||
|
|
||||||
"wilderness_hut" => array("Cabane non gardée", "Cabane", "#ef2929", "wilderness_hut",
|
"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_fireplace' => "🔥 Cheminée ou poêle à bois ?",
|
||||||
'b_toilet' => "🚽 Latrines ou toilettes ?"
|
'b_toilet' => "🚽 Latrines ou toilettes ?"
|
||||||
)
|
)
|
||||||
|
, 16, "square"
|
||||||
),
|
),
|
||||||
|
|
||||||
"alpine_hut" => array("Refuge gardé", "Refuge", "#ef2929", "alpine_hut",
|
"alpine_hut" => array("Refuge gardé", "Refuge", "#ef2929", "alpine_hut",
|
||||||
@@ -52,6 +54,7 @@ $poi_types = array(
|
|||||||
'b_toilet' => "🚽 Latrines ou toilettes ?",
|
'b_toilet' => "🚽 Latrines ou toilettes ?",
|
||||||
'l_water' => "URL du site web :"
|
'l_water' => "URL du site web :"
|
||||||
)
|
)
|
||||||
|
, 18, "square"
|
||||||
),
|
),
|
||||||
|
|
||||||
"halt" => array("Gîte d'étape", "Gîte", "#4e9a06", "halt",
|
"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 ?",
|
'b_water' => "💧 Possibilité de se ravitailler en eau ?",
|
||||||
'l_water' => "URL du site web :"
|
'l_water' => "URL du site web :"
|
||||||
)
|
)
|
||||||
|
, 16, "square"
|
||||||
),
|
),
|
||||||
|
|
||||||
"bivouac" => array("Zone de bivouac", "Bivouac", "#ef2929", "bivouac",
|
"bivouac" => array("Zone de bivouac", "Bivouac", "#ef2929", "bivouac",
|
||||||
@@ -77,6 +81,7 @@ $poi_types = array(
|
|||||||
'b_wood' => "🌲 Bois à proximité ?",
|
'b_wood' => "🌲 Bois à proximité ?",
|
||||||
'b_fireplace' => "🔥 Emplacement pour faire un feu ?"
|
'b_fireplace' => "🔥 Emplacement pour faire un feu ?"
|
||||||
)
|
)
|
||||||
|
, 18, "triangle"
|
||||||
),
|
),
|
||||||
|
|
||||||
"campsite" => array("Camping", "Camping", "#4e9a06", "campsite",
|
"campsite" => array("Camping", "Camping", "#4e9a06", "campsite",
|
||||||
@@ -89,6 +94,7 @@ $poi_types = array(
|
|||||||
'b_water' => "💧 Possibilité de se ravitailler en eau ?",
|
'b_water' => "💧 Possibilité de se ravitailler en eau ?",
|
||||||
'l_water' => "URL du site web :"
|
'l_water' => "URL du site web :"
|
||||||
)
|
)
|
||||||
|
, 18, "triangle"
|
||||||
)
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
Reference in new issue
Block a user