Skip to content

Commit

Permalink
feat(gpx): Add default icons for markers exported as GPX
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Aug 16, 2024
1 parent c94d8d7 commit b8f7434
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/pages/materials.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@
{
"mandatory": false,
"material": "écouteurs"
},
{
"mandatory": false,
"material": "stylo"
},
{
"mandatory": false,
"material": "carnet de notes"
}
],
"vêtements": [
Expand Down
14 changes: 12 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ const downloadPoi = ({ gpx, markers, meta }) => {
// Delete GPX track
const tracks = root.getElementsByTagName("trk");
while (tracks[0]) tracks[0].parentNode.removeChild(tracks[0]);
console.log(markers);
console.log(gpx);
for (let i = 0; i < markers.length; i++) {
const wpt = markers[i];
const node = source.createElementNS(
Expand All @@ -82,6 +80,18 @@ const downloadPoi = ({ gpx, markers, meta }) => {
desc.appendChild(source.createTextNode(wpt.name));
node.appendChild(desc);
}
if ((wpt?.category)) {
let sym = ""
if (wpt.category === "hébergement") sym = "friends-home";
if (wpt.category === "alimentation") sym = "stores-supermarket";
if (wpt.category === "sorties") sym = "restaurant-restaurant";
if (wpt.category === "eau") sym = "tourism-drinkingwater";
if (sym.length > 0) {
const sym = source.createElement("sym");
sym.appendChild(source.createTextNode(wpt.category));
node.appendChild(sym);
}
}
root.appendChild(node);
}
link.href = URL.createObjectURL(
Expand Down

0 comments on commit b8f7434

Please sign in to comment.