Ajout des textures du terrain de basket et de la piscine
This commit is contained in:
parent
251cfa9a8a
commit
fd968a9305
16 changed files with 142 additions and 51 deletions
50
js/map.js
50
js/map.js
|
|
@ -78,25 +78,15 @@ export async function init(){
|
|||
})
|
||||
}
|
||||
|
||||
const HIGHLIGHT_LAYER = Symbol("Hilight map layer")
|
||||
const HIGHLIGHT_LAYER = Symbol("Highlight map layer")
|
||||
const AMENITY_MARKER_LAYER = Symbol("Amenity marker layer")
|
||||
const PARENT_FEATURE = Symbol("Parent feature")
|
||||
const HIGHLIGHT_MARKER_ICON = L.divIcon({
|
||||
className: "highlight-point-icon"
|
||||
})
|
||||
|
||||
export async function init_places(places_db){
|
||||
places = places_db
|
||||
|
||||
// La couche des zones disponibles
|
||||
const area_highlight = L.geoJSON(null, {
|
||||
style: function(feature){
|
||||
return {
|
||||
className: "map-hilight-area",
|
||||
fill: false,
|
||||
stroke: false
|
||||
}
|
||||
},
|
||||
onEachFeature: function(feature, layer){
|
||||
feature[HIGHLIGHT_LAYER] = layer
|
||||
}
|
||||
}).addTo(map)
|
||||
|
||||
// La couche des zones disponibles
|
||||
const amenities = L.geoJSON(null, {
|
||||
|
|
@ -139,6 +129,36 @@ export async function init_places(places_db){
|
|||
return L.marker(latlng, {
|
||||
icon: icon
|
||||
})
|
||||
},
|
||||
onEachFeature: function(feature, layer){
|
||||
if(feature[PARENT_FEATURE]){
|
||||
feature[PARENT_FEATURE][AMENITY_MARKER_LAYER] = layer
|
||||
} else {
|
||||
feature[AMENITY_MARKER_LAYER] = layer
|
||||
}
|
||||
}
|
||||
}).addTo(map)
|
||||
|
||||
// La couche des zones disponibles
|
||||
const area_highlight = L.geoJSON(null, {
|
||||
pointToLayer: function(feature, latlng) {
|
||||
return L.marker(latlng, {
|
||||
icon: HIGHLIGHT_MARKER_ICON
|
||||
})
|
||||
},
|
||||
style: function(feature){
|
||||
return {
|
||||
className: "map-hilight-area",
|
||||
fill: false,
|
||||
stroke: false
|
||||
}
|
||||
},
|
||||
onEachFeature: function(feature, layer){
|
||||
if(feature[PARENT_FEATURE]){
|
||||
feature[PARENT_FEATURE][HIGHLIGHT_LAYER] = layer
|
||||
} else {
|
||||
feature[HIGHLIGHT_LAYER] = layer
|
||||
}
|
||||
}
|
||||
}).addTo(map)
|
||||
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ export class PlaceDatabase extends EventTarget {
|
|||
default_database.loadGeojson(new URL("../couches/terrain-de-basket.geojson", import.meta.url), {batch: true}),
|
||||
default_database.loadGeojson(new URL("../couches/pieces-batiments.geojson", import.meta.url), {batch: true}),
|
||||
default_database.loadGeojson(new URL("../couches/camping.geojson", import.meta.url), {batch: true}),
|
||||
default_database.loadGeojson(new URL("../couches/eau-potable.geojson", import.meta.url), {batch: true}),
|
||||
])
|
||||
|
||||
default_database.buildIndex()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue