509 lines
No EOL
13 KiB
JavaScript
509 lines
No EOL
13 KiB
JavaScript
import { MapFeature } from "./places.js"
|
|
|
|
export class MapSymbol {
|
|
|
|
/**
|
|
* Solid background color of this area (if any)
|
|
* @type {undefined|string}
|
|
*/
|
|
backgroundColor = undefined
|
|
|
|
/**
|
|
* Background raster tiled image to put on top of solid background (if any)
|
|
* @type {undefined|string|URL}
|
|
*/
|
|
backgroundUrl = undefined
|
|
|
|
/**
|
|
* Border color of area (if any)
|
|
* @type {undefined|string}
|
|
*/
|
|
borderColor = undefined
|
|
|
|
/**
|
|
* Marker URL to place on feature (if point) or on centroid (if area)
|
|
* @type {undefined|string|URL}
|
|
*/
|
|
markerUrl = undefined
|
|
|
|
/**
|
|
* Generic name of this feature if no more precise name is given
|
|
* @type {undefined|string}
|
|
*/
|
|
genericName = undefined
|
|
|
|
/**
|
|
* Boost features with this symbol up (or down if negative) in search if defined
|
|
*/
|
|
searchBoost = undefined
|
|
|
|
/**
|
|
* A list of sysnonyms for this feature for full text indexing
|
|
* @type {string[]}
|
|
*/
|
|
indexSynonyms = []
|
|
|
|
clone(){
|
|
let new_symb = new MapSymbol()
|
|
Object.assign(new_symb, this)
|
|
return new_symb
|
|
}
|
|
|
|
static fromFeature(feature){
|
|
return getSymbolForFeature(feature)
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get a map symbol from feature properties
|
|
* @param {MapFeature|Object} feature
|
|
*/
|
|
function getSymbolForFeature(feature){
|
|
let sym = getBaseSymbolForFeature(feature);
|
|
|
|
if(feature.properties["color"]){
|
|
sym = sym.clone()
|
|
sym.backgroundColor = feature.properties["color"]
|
|
sym.borderColor = feature.properties["color"]
|
|
}
|
|
|
|
return sym
|
|
}
|
|
|
|
function getBaseSymbolForFeature(feature){
|
|
|
|
if(feature.properties["scene"]){
|
|
return STAGE_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["bar"]){
|
|
return DRINKS_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["care"]){
|
|
return SOINSOIN_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["signaletique"]){
|
|
return SIGNALETIQUE_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["autogestion"] == "shifts"){
|
|
return SHIFTS_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["dons"]){
|
|
return MONEY_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["wifi"]){
|
|
return WIFI_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["zone-interdite"] || feature.properties["autorisee"] === false){
|
|
return VERBOTEN_AREA_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["piscine"]){
|
|
return SWIMMING_POOL_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["Parking"]){
|
|
return PARKING_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["n couchage"] > 0){
|
|
return SLEEPING_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["camping"]){
|
|
return CAMPING_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["toilettes"] && feature.properties["douches"]) {
|
|
return SHOWER_AND_TOILETS_SYMBOL
|
|
} else if(feature.properties["toilettes"]){
|
|
return TOILETS_SYMBOL
|
|
} else if(feature.properties["douches"]){
|
|
return SHOWER_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["eau potable"]){
|
|
return DRINKING_WATER_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["poubelle"]){
|
|
if(feature.properties["recyclage"]){
|
|
return RECYCLE_BIN_SYMBOL
|
|
}
|
|
if(feature.properties["compost vegetal"]){
|
|
return COMPOST_BIN_SYMBOL
|
|
}
|
|
if(feature.properties["compost caca"]){
|
|
return POOP_BIN_SYMBOL
|
|
}
|
|
return BIN_SYMBOL
|
|
}
|
|
|
|
if(feature.properties["brazero"]){
|
|
return BRAZERO_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["schedule"]){
|
|
return SCHEDULE_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["medic"]){
|
|
return MEDIC_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["badmington"]){
|
|
return BADMINGTON_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["kids friendly"]){
|
|
return CHILD_AREA_SYMBOL;
|
|
}
|
|
|
|
if(feature.properties["batiment"] || feature.properties["piece-batiment"]){
|
|
return BUILDING_SYMBOL
|
|
}
|
|
|
|
if(feature.parentFeature && feature.parentFeature.geometry.type != "Point"){
|
|
return DEFAULT_AREA_SYMBOL
|
|
} else if (feature.geometry.type != "Point") {
|
|
return DEFAULT_AREA_SYMBOL
|
|
} else {
|
|
return DEFAULT_SYMBOL
|
|
}
|
|
}
|
|
|
|
// PREDEFINED Symbols
|
|
|
|
export const DEFAULT_SYMBOL = new MapSymbol()
|
|
{
|
|
DEFAULT_SYMBOL.markerUrl = new URL("../icons/default-marker.svg", import.meta.url)
|
|
DEFAULT_SYMBOL.backgroundColor = "white"
|
|
DEFAULT_SYMBOL.borderColor = "white"
|
|
}
|
|
|
|
export const DEFAULT_AREA_SYMBOL = new MapSymbol()
|
|
{
|
|
DEFAULT_AREA_SYMBOL.backgroundColor = "white"
|
|
DEFAULT_AREA_SYMBOL.borderColor = "white"
|
|
}
|
|
|
|
export const SLEEPING_SYMBOL = new MapSymbol()
|
|
{
|
|
SLEEPING_SYMBOL.markerUrl = new URL("../icons/dortoir.svg", import.meta.url)
|
|
SLEEPING_SYMBOL.genericName = "Dortoir"
|
|
SLEEPING_SYMBOL.backgroundColor = "grey"
|
|
SLEEPING_SYMBOL.borderColor = "grey"
|
|
SLEEPING_SYMBOL.indexSynonyms = [
|
|
"dodo",
|
|
"dortoir",
|
|
"mimir",
|
|
"dormir",
|
|
"lit"
|
|
]
|
|
}
|
|
|
|
export const CAMPING_SYMBOL = new MapSymbol()
|
|
{
|
|
CAMPING_SYMBOL.markerUrl = new URL("../icons/camping.svg", import.meta.url)
|
|
CAMPING_SYMBOL.genericName = "Camping"
|
|
CAMPING_SYMBOL.backgroundColor = "grey"
|
|
CAMPING_SYMBOL.borderColor = "grey"
|
|
CAMPING_SYMBOL.indexSynonyms = [
|
|
"camper",
|
|
"tente",
|
|
"mimir",
|
|
"dormir",
|
|
"dodo"
|
|
]
|
|
}
|
|
|
|
export const DRINKING_WATER_SYMBOL = new MapSymbol()
|
|
{
|
|
DRINKING_WATER_SYMBOL.markerUrl = new URL("../icons/eau-potable.svg", import.meta.url)
|
|
DRINKING_WATER_SYMBOL.genericName = "Point d'eau potable"
|
|
}
|
|
|
|
export const PARKING_SYMBOL = new MapSymbol()
|
|
{
|
|
PARKING_SYMBOL.markerUrl = new URL("../icons/parking.svg", import.meta.url)
|
|
PARKING_SYMBOL.genericName = "Parking"
|
|
PARKING_SYMBOL.backgroundColor = "#2d2d2d"
|
|
PARKING_SYMBOL.borderColor = "#989898"
|
|
}
|
|
|
|
export const BADMINGTON_SYMBOL = new MapSymbol()
|
|
{
|
|
BADMINGTON_SYMBOL.genericName = "Terrain de badmington"
|
|
BADMINGTON_SYMBOL.backgroundColor = "white"
|
|
BADMINGTON_SYMBOL.borderColor = "white"
|
|
BADMINGTON_SYMBOL.indexSynonyms = [
|
|
"bad",
|
|
"badmington",
|
|
]
|
|
}
|
|
|
|
export const MEDIC_SYMBOL = new MapSymbol()
|
|
{
|
|
MEDIC_SYMBOL.markerUrl = new URL("../icons/medic.svg", import.meta.url)
|
|
MEDIC_SYMBOL.borderColor = "white"
|
|
MEDIC_SYMBOL.indexSynonyms = [
|
|
"medic",
|
|
"médic",
|
|
"infirmerie",
|
|
"urgence",
|
|
"bobo",
|
|
"malaise"
|
|
]
|
|
}
|
|
|
|
export const CHILD_AREA_SYMBOL = new MapSymbol()
|
|
{
|
|
CHILD_AREA_SYMBOL.genericName = "Espace pour enfants"
|
|
CHILD_AREA_SYMBOL.backgroundColor = "#ffbe3d"
|
|
CHILD_AREA_SYMBOL.borderColor = "#ffbe3d"
|
|
CHILD_AREA_SYMBOL.indexSynonyms = [
|
|
"enfant",
|
|
"jeux",
|
|
]
|
|
}
|
|
|
|
export const TOILETS_SYMBOL = new MapSymbol()
|
|
{
|
|
TOILETS_SYMBOL.markerUrl = new URL("../icons/toilettes.svg", import.meta.url)
|
|
TOILETS_SYMBOL.genericName = "Toilettes"
|
|
TOILETS_SYMBOL.backgroundColor = "#8800ff"
|
|
TOILETS_SYMBOL.borderColor = "#8800ff"
|
|
TOILETS_SYMBOL.indexSynonyms = [
|
|
"caca",
|
|
"pipi",
|
|
"cabinets",
|
|
"water-closet",
|
|
"latrines",
|
|
"🚽",
|
|
"double véssé",
|
|
"chaise percée",
|
|
"WC",
|
|
"waters",
|
|
"toilettes",
|
|
"toilette",
|
|
"chiotte",
|
|
"chiottes",
|
|
"le trône",
|
|
"le trones",
|
|
"pièce mystère",
|
|
"backroom",
|
|
"retailleau"
|
|
]
|
|
}
|
|
|
|
export const SHOWER_SYMBOL = new MapSymbol()
|
|
{
|
|
SHOWER_SYMBOL.markerUrl = new URL("../icons/douches.svg", import.meta.url)
|
|
SHOWER_SYMBOL.genericName = "Douches"
|
|
SHOWER_SYMBOL.backgroundColor = "#8800ff"
|
|
SHOWER_SYMBOL.borderColor = "#8800ff"
|
|
}
|
|
|
|
export const SHOWER_AND_TOILETS_SYMBOL = new MapSymbol();
|
|
{
|
|
SHOWER_AND_TOILETS_SYMBOL.markerUrl = [
|
|
TOILETS_SYMBOL.markerUrl,
|
|
SHOWER_SYMBOL.markerUrl
|
|
]
|
|
SHOWER_AND_TOILETS_SYMBOL.backgroundColor = "#8800ff"
|
|
SHOWER_AND_TOILETS_SYMBOL.borderColor = "#8800ff"
|
|
SHOWER_AND_TOILETS_SYMBOL.genericName = "Toilettes & douches"
|
|
SHOWER_AND_TOILETS_SYMBOL.indexSynonyms = [
|
|
...TOILETS_SYMBOL.indexSynonyms
|
|
]
|
|
}
|
|
|
|
export const SWIMMING_POOL_SYMBOL = new MapSymbol()
|
|
{
|
|
SWIMMING_POOL_SYMBOL.markerUrl = new URL("../icons/piscine.svg", import.meta.url)
|
|
SWIMMING_POOL_SYMBOL.genericName = "Piscine"
|
|
SWIMMING_POOL_SYMBOL.backgroundColor = "#366d73"
|
|
SWIMMING_POOL_SYMBOL.borderColor = "#366d73"
|
|
}
|
|
|
|
export const VERBOTEN_AREA_SYMBOL = new MapSymbol()
|
|
{
|
|
VERBOTEN_AREA_SYMBOL.genericName = "Zone interdite"
|
|
VERBOTEN_AREA_SYMBOL.backgroundColor = "#992700"
|
|
VERBOTEN_AREA_SYMBOL.borderColor = "#992700"
|
|
VERBOTEN_AREA_SYMBOL.searchBoost = -2;
|
|
}
|
|
|
|
export const BUILDING_SYMBOL = new MapSymbol()
|
|
{
|
|
BUILDING_SYMBOL.genericName = "Batiment"
|
|
BUILDING_SYMBOL.backgroundColor = "#5a5a5a"
|
|
BUILDING_SYMBOL.borderColor = "white"
|
|
}
|
|
|
|
export const WIFI_SYMBOL = new MapSymbol()
|
|
{
|
|
WIFI_SYMBOL.genericName = "Wifi"
|
|
WIFI_SYMBOL.markerUrl = new URL("../icons/wifi.svg", import.meta.url)
|
|
}
|
|
|
|
export const BIN_SYMBOL = new MapSymbol()
|
|
{
|
|
BIN_SYMBOL.genericName = "Poubelle"
|
|
BIN_SYMBOL.markerUrl = new URL("../icons/poubelle.svg", import.meta.url)
|
|
BIN_SYMBOL.indexSynonyms = [
|
|
"poubelle",
|
|
"dechet",
|
|
"déchet"
|
|
]
|
|
}
|
|
|
|
export const RECYCLE_BIN_SYMBOL = new MapSymbol()
|
|
{
|
|
RECYCLE_BIN_SYMBOL.genericName = "Poubelle recyclable"
|
|
RECYCLE_BIN_SYMBOL.markerUrl = new URL("../icons/poubelle-recyclable.svg", import.meta.url)
|
|
RECYCLE_BIN_SYMBOL.indexSynonyms = [
|
|
"poubelle",
|
|
"dechet",
|
|
"déchet",
|
|
"recyclable",
|
|
'recyclage'
|
|
]
|
|
}
|
|
|
|
export const COMPOST_BIN_SYMBOL = new MapSymbol()
|
|
{
|
|
COMPOST_BIN_SYMBOL.genericName = "Compost"
|
|
COMPOST_BIN_SYMBOL.markerUrl = new URL("../icons/poubelle-compost.svg", import.meta.url)
|
|
COMPOST_BIN_SYMBOL.indexSynonyms = [
|
|
"poubelle",
|
|
"dechet",
|
|
"déchet",
|
|
"compost",
|
|
"épluchures"
|
|
]
|
|
}
|
|
|
|
export const POOP_BIN_SYMBOL = new MapSymbol()
|
|
{
|
|
POOP_BIN_SYMBOL.genericName = "Compost des toilettes sèches"
|
|
POOP_BIN_SYMBOL.markerUrl = new URL("../icons/poubelle-caca.svg", import.meta.url)
|
|
POOP_BIN_SYMBOL.indexSynonyms = [
|
|
"poubelle",
|
|
"dechet",
|
|
"déchet",
|
|
"compost",
|
|
"épluchures",
|
|
"toilettes sèches",
|
|
"caca"
|
|
]
|
|
}
|
|
|
|
export const STAGE_SYMBOL = new MapSymbol()
|
|
{
|
|
STAGE_SYMBOL.genericName = "Scène"
|
|
STAGE_SYMBOL.markerUrl = new URL("../icons/scene.svg", import.meta.url)
|
|
STAGE_SYMBOL.backgroundColor = "#ffbf3e"
|
|
STAGE_SYMBOL.borderColor = "#ffbf3e"
|
|
STAGE_SYMBOL.indexSynonyms = [
|
|
"scène",
|
|
"musique",
|
|
"stage",
|
|
]
|
|
}
|
|
|
|
export const MONEY_SYMBOL = new MapSymbol()
|
|
{
|
|
MONEY_SYMBOL.markerUrl = new URL("../icons/dons.svg", import.meta.url)
|
|
MONEY_SYMBOL.indexSynonyms = [
|
|
"argent",
|
|
"thune",
|
|
"money",
|
|
"don",
|
|
"prix libre"
|
|
]
|
|
}
|
|
|
|
export const SHIFTS_SYMBOL = new MapSymbol()
|
|
{
|
|
SHIFTS_SYMBOL.genericName = "Tableau des shifts"
|
|
SHIFTS_SYMBOL.markerUrl = new URL("../icons/shifts.svg", import.meta.url)
|
|
SHIFTS_SYMBOL.indexSynonyms = [
|
|
"shift",
|
|
"taches",
|
|
"tableau",
|
|
]
|
|
}
|
|
|
|
export const SCHEDULE_SYMBOL = new MapSymbol()
|
|
{
|
|
SCHEDULE_SYMBOL.genericName = "Programmation"
|
|
SCHEDULE_SYMBOL.markerUrl = new URL("../icons/prog.svg", import.meta.url)
|
|
SCHEDULE_SYMBOL.indexSynonyms = [
|
|
"programmation",
|
|
"atelier",
|
|
"conference",
|
|
"programme",
|
|
]
|
|
}
|
|
|
|
export const BRAZERO_SYMBOL = new MapSymbol()
|
|
{
|
|
BRAZERO_SYMBOL.genericName = "Brazero"
|
|
BRAZERO_SYMBOL.markerUrl = new URL("../icons/fire.svg", import.meta.url)
|
|
BRAZERO_SYMBOL.indexSynonyms = [
|
|
"feu",
|
|
"brazero",
|
|
"flamme"
|
|
]
|
|
}
|
|
|
|
export const SOINSOIN_SYMBOL = new MapSymbol()
|
|
{
|
|
SOINSOIN_SYMBOL.genericName = "Soin²"
|
|
SOINSOIN_SYMBOL.markerUrl = new URL("../icons/care.svg", import.meta.url)
|
|
SOINSOIN_SYMBOL.indexSynonyms = [
|
|
"care",
|
|
"awareness",
|
|
"soin",
|
|
"soin sécu",
|
|
"soin secu",
|
|
"soin-sécu",
|
|
"soin-secu"
|
|
]
|
|
}
|
|
|
|
export const SIGNALETIQUE_SYMBOL = new MapSymbol()
|
|
{
|
|
SIGNALETIQUE_SYMBOL.genericName = "Signalétique"
|
|
SIGNALETIQUE_SYMBOL.markerUrl = new URL("../icons/signaletik.svg", import.meta.url)
|
|
SIGNALETIQUE_SYMBOL.indexSynonyms = [
|
|
"paneau",
|
|
"gaffer",
|
|
"scotch",
|
|
"posca",
|
|
"peinture",
|
|
"signaletik",
|
|
"signaletique"
|
|
]
|
|
}
|
|
|
|
export const DRINKS_SYMBOL = new MapSymbol()
|
|
{
|
|
DRINKS_SYMBOL.genericName = "Boissons"
|
|
DRINKS_SYMBOL.markerUrl = new URL("../icons/drinks.svg", import.meta.url)
|
|
DRINKS_SYMBOL.indexSynonyms = [
|
|
"tireuses",
|
|
"boissons",
|
|
"bière",
|
|
"softs",
|
|
"kefir",
|
|
"maté"
|
|
]
|
|
} |