165 lines
7.5 KiB
JavaScript
165 lines
7.5 KiB
JavaScript
// The app's icons as inline SVG strings (fill currentColor, so CSS
|
|
// colors them and gpx.js can recolor a copy for map markers).
|
|
// Material Design Icons (Apache-2.0, public/vendor/mdi/) for the UI;
|
|
// the National Park Service pictograms further down (CC0) for points.
|
|
// bin/vendor-sync.mjs vendors only the mdi* names used in public/js/.
|
|
import {
|
|
mdiBacteriaOutline,
|
|
mdiBugOutline,
|
|
mdiClockOutline,
|
|
mdiCloudDownloadOutline,
|
|
mdiContentSaveOutline,
|
|
mdiCrosshairsGps,
|
|
mdiDeleteSweepOutline,
|
|
mdiFolderPlusOutline,
|
|
mdiLayersOutline,
|
|
mdiLayersPlus,
|
|
mdiLock,
|
|
mdiLockOpenVariantOutline,
|
|
mdiMagnify,
|
|
mdiMapMarkerOutline,
|
|
mdiMapMarkerPath,
|
|
mdiMapMarkerPlusOutline,
|
|
mdiMapMarkerRadiusOutline,
|
|
mdiMapMarkerStarOutline,
|
|
mdiPuzzleOutline,
|
|
mdiRadar,
|
|
mdiRoutes,
|
|
mdiRuler,
|
|
mdiSunAngleOutline,
|
|
mdiSwapVertical,
|
|
mdiTrayArrowDown,
|
|
mdiTrayArrowUp,
|
|
mdiWeatherSunsetDown,
|
|
mdiWeatherSunsetUp,
|
|
mdiWikipedia,
|
|
} from "/vendor/mdi/mdi.mjs";
|
|
import { NPS_SYMBOLS } from "/vendor/nps-symbols/nps-symbols.mjs";
|
|
|
|
const mdi = (path) => `<svg viewBox="0 0 24 24"><path fill="currentColor" d="${path}"/></svg>`;
|
|
|
|
export const LAYERS_ICON = mdi(mdiLayersOutline);
|
|
export const OVERLAYS_ICON = mdi(mdiLayersPlus);
|
|
export const NOTE_PIN_ICON = mdi(mdiMapMarkerPlusOutline);
|
|
export const GPX_ICON = mdi(mdiMapMarkerPath);
|
|
export const GNSS_ICON = mdi(mdiCrosshairsGps);
|
|
export const RULER_ICON = mdi(mdiRuler);
|
|
export const SUNRISE_ICON = mdi(mdiWeatherSunsetUp);
|
|
export const SUNSET_ICON = mdi(mdiWeatherSunsetDown);
|
|
export const SEARCH_ICON = mdi(mdiMagnify);
|
|
export const NEW_FOLDER_ICON = mdi(mdiFolderPlusOutline);
|
|
export const UPLOAD_ICON = mdi(mdiTrayArrowUp);
|
|
export const PLUGIN_ICON = mdi(mdiPuzzleOutline);
|
|
export const WAYPOINT_ICON = mdi(mdiMapMarkerOutline);
|
|
export const PENDING_ICON = mdi(mdiClockOutline);
|
|
export const DOWNLOAD_ICON = mdi(mdiTrayArrowDown);
|
|
export const ROUTE_ICON = mdi(mdiRoutes);
|
|
export const RADAR_CLOUD_ICON = mdi(mdiRadar);
|
|
export const TERRAIN_SHADOW_ICON = mdi(mdiSunAngleOutline);
|
|
export const CONTOUR_ICON = mdi(mdiBacteriaOutline);
|
|
export const OFFLINE_DATA_ICON = mdi(mdiCloudDownloadOutline);
|
|
export const DEBUG_ICON = mdi(mdiBugOutline);
|
|
export const WIKI_ICON = mdi(mdiWikipedia);
|
|
export const LIVETRACK_ICON = mdi(mdiMapMarkerRadiusOutline);
|
|
export const POSITION_ICON = mdi(mdiCrosshairsGps);
|
|
export const SAVED_POINT_ICON = mdi(mdiMapMarkerStarOutline);
|
|
export const REVERSE_ICON = mdi(mdiSwapVertical);
|
|
export const CLEAR_ICON = mdi(mdiDeleteSweepOutline);
|
|
export const SAVE_ICON = mdi(mdiContentSaveOutline);
|
|
export const LOCK_ICON = mdi(mdiLock);
|
|
export const UNLOCK_ICON = mdi(mdiLockOpenVariantOutline);
|
|
export const TRACK_ICON = GPX_ICON;
|
|
|
|
// A rounded-square badge — used as the map marker for individual waypoints,
|
|
// tinted by category color via icon-color (see gpx.js). Not a plain dot,
|
|
// which blended in with a base map style's own small circular POI icons,
|
|
// and not a pin/teardrop either — a rounded square is the National Park
|
|
// Service's own convention for framing these exact category symbols
|
|
// (POI_ICONS below), so pairing the two looks native rather than like two
|
|
// mismatched icon styles. Centered on the coordinate (no tip to anchor at),
|
|
// which also means the category glyph on top needs no offset — both layers
|
|
// just share the same center anchor at [0, 0].
|
|
export const MAP_MARKER_ICON = `
|
|
<svg viewBox="0 0 24 24"><rect x="1" y="1" width="22" height="22" rx="5" fill="currentColor"/></svg>`;
|
|
|
|
// The National Park Service's map pictograms for points: every symbol of
|
|
// their symbol-library, vendored by bin/nps-symbols-sync.mjs (CC0, 22 px,
|
|
// filled shapes — they render at ~14px on the map, where a hairline stroke
|
|
// disappears). Rasterized for the map (non-SDF, see gpx.js's
|
|
// _registerCategoryGlyphs), so only the alpha shape matters there.
|
|
export { NPS_SYMBOLS };
|
|
const nps = (name) => NPS_SYMBOLS[name];
|
|
export const WILDERNESS_ICON = nps("wilderness"); // also the Overlays panel's Terrain shading glyph
|
|
export const WALKING_ICON = nps("walking"); // also the Overlays panel's Hiking trails glyph
|
|
|
|
// A point's `icon` property names its glyph: any NPS symbol name
|
|
// ("drinking-water", "campground", …), or one of these OsmAnd icon names a
|
|
// park4night/OsmAnd export (lib/maptool/gpx.rb's waypoint_style) and the
|
|
// Overpass POIs (lib/maptool/overpass_pois.rb) carry. These come first in
|
|
// the note icon picker.
|
|
export const POI_ICONS = {
|
|
amenity_parking: nps("parking"),
|
|
tourism_camp_site: nps("campground"),
|
|
leisure_picnic_table: nps("picnic-area"),
|
|
amenity_fuel: nps("gas-station"),
|
|
tourism_hotel: nps("lodging"),
|
|
forest: WILDERNESS_ICON,
|
|
sport_cycling: nps("bicycle-trail"),
|
|
amenity_drinking_water: nps("drinking-water"),
|
|
amenity_sanitary_dump_station: nps("sanitary-disposal-station"),
|
|
amenity_toilets: nps("restrooms"),
|
|
shop_gas: nps("propane"),
|
|
amenity_electricity: nps("electrical-hookup"),
|
|
shop_laundry: nps("laundry"),
|
|
leisure_playground: nps("playground"),
|
|
tourism_viewpoint: nps("scenic-viewpoint"),
|
|
leisure_swimming: nps("swimming"),
|
|
leisure_fishing: nps("fishing"),
|
|
sport_climbing: nps("climbing"),
|
|
route_hiking: WALKING_ICON,
|
|
shop_supermarket: nps("store"),
|
|
shop_convenience: nps("store"),
|
|
...NPS_SYMBOLS,
|
|
};
|
|
|
|
// park4night's fixed vocabulary of Services/Activities codes (the ones
|
|
// p4n2gpx exports actually use — not necessarily park4night's entire API),
|
|
// each with a human label (always shown) and an icon where the NPS set has
|
|
// a reasonable match. formatDescription (public/js/gpx.js) reads this;
|
|
// an unrecognized code just renders as its raw text, same as before this
|
|
// existed, so nothing p4n2gpx might add later is ever hidden.
|
|
export const PARK4NIGHT_TAGS = {
|
|
// Services
|
|
animaux: { icon: nps("pets-on-leash"), label: "Pets allowed" },
|
|
boulangerie: { label: "Bakery nearby" },
|
|
caravaneige: { icon: nps("winter-recreation-area"), label: "Winter/snow camping" },
|
|
donnees_mobile: { icon: nps("cellular-signal"), label: "Mobile data coverage" },
|
|
douche: { icon: nps("showers"), label: "Showers" },
|
|
eau_noire: { icon: nps("sanitary-disposal-station"), label: "Black water disposal" },
|
|
eau_usee: { icon: nps("sanitary-disposal-station"), label: "Grey water disposal" },
|
|
electricite: { icon: nps("electrical-hookup"), label: "Electricity" },
|
|
gaz: { icon: nps("propane"), label: "Gas/propane refill" },
|
|
gpl: { icon: nps("propane"), label: "LPG refill" },
|
|
lavage: { label: "Vehicle wash" },
|
|
laverie: { icon: nps("laundry"), label: "Laundry" },
|
|
piscine: { icon: nps("swimming"), label: "Swimming pool" },
|
|
point_eau: { icon: nps("drinking-water"), label: "Drinking water" },
|
|
poubelle: { icon: nps("trash-dumpster"), label: "Trash disposal" },
|
|
wc_public: { icon: nps("restrooms"), label: "Public toilet" },
|
|
wifi: { icon: nps("wifi"), label: "Wi-Fi" },
|
|
|
|
// Activities
|
|
baignade: { icon: nps("swimming"), label: "Swimming" },
|
|
eaux_vives: { icon: nps("river-rafting"), label: "Whitewater sports" },
|
|
escalade: { icon: nps("climbing"), label: "Climbing" },
|
|
jeux_enfants: { icon: nps("playground"), label: "Playground" },
|
|
moto: { icon: nps("motorbike-trail"), label: "Motorcycling" },
|
|
peche: { icon: nps("fishing"), label: "Fishing" },
|
|
peche_pied: { icon: nps("fishing"), label: "Shore fishing" },
|
|
point_de_vue: { icon: nps("scenic-viewpoint"), label: "Scenic viewpoint" },
|
|
rando: { icon: WALKING_ICON, label: "Hiking" },
|
|
visites: { icon: nps("guided-tours"), label: "Sightseeing" },
|
|
vtt: { icon: nps("bicycle-trail"), label: "Mountain biking" },
|
|
windsurf: { icon: nps("wind-surfing"), label: "Windsurfing" },
|
|
};
|