Members
(constant) REGIONS_CONFIG :Object
Configuration des régions (Europe et Amérique) pour centrer la carte.
Type:
- Object
(constant) ROUTING_SERVERS :Object.<string, string>
URLs de base pour l'API de routage OSRM selon le mode de transport.
Type:
- Object.<string, string>
(constant) TRANSPORT_STRATEGIES :Object.<string, string>
Correspondance entre les modes de transport de l'UI et ceux de l'API OSRM.
Type:
- Object.<string, string>
(constant) appConfig :Object
Global application configuration
Type:
- Object
(constant) colorsPalette :Array.<string>
Color palette for distinct trip paths
Type:
- Array.<string>
- Source:
currentCircle :L.Circle|null
Circle object visualizing the search radius
Type:
- L.Circle | null
currentCoords :Array.<number>
Current search position coordinates
Type:
- Array.<number>
(constant) defaultCoords :Array.<number>
Default coordinates (e.g., Lyon, FR)
Type:
- Array.<number>
map :L.Map
Leaflet map instance
Type:
- L.Map
(constant) poiFilters :Object.<string, POIFilter>
Dictionary of available POI filters
Type:
- Object.<string, POIFilter>
searchLayer :L.LayerGroup
Layer groups for markers
Type:
- L.LayerGroup
searchRadius :number
Search radius in meters
Type:
- number
(constant) state :Object
État global de l'application gérant les données de la carte et du trajet.
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
map |
L.Map | null | Instance de la carte Leaflet. |
currentStartCity |
string | Ville de départ. |
currentStartCoords |
Array.<number> | null | Coordonnées [lat, lon] du départ. |
segments |
Array.<Object> | Tableau contenant les étapes du trajet. |
polylineLayers |
Array.<L.Polyline> | Tableau des tracés affichés sur la carte. |
markers |
Object.<string, L.Marker> | Dictionnaire des marqueurs (clé = nom de la ville). |
currentSegmentIndex |
number | null | Index du segment actuellement édité. |
isCalculating |
boolean | Indicateur d'état pendant les calculs d'itinéraires. |
userFavorites |
Array.<Object> | Liste des lieux favoris de l'utilisateur. |
favoritesLayer |
L.FeatureGroup | null | Groupe Leaflet contenant les marqueurs de favoris. |
(constant) viewMapInstances :Object.<string, L.Map>
Stores instances of individual step maps indexed by ID
Type:
- Object.<string, L.Map>
- Source:
Methods
addTime(startTime, secondsToAdd) → {string}
Adds seconds to a time string.
Parameters:
| Name | Type | Description |
|---|---|---|
startTime |
string | Format "HH:mm" |
secondsToAdd |
number | Seconds to add |
- Source:
Returns:
New time string "HH:mm"
- Type
- string
applyPreferences() → {void}
Applies saved preferences from localStorage to the document.
- Source:
Returns:
- Type
- void
calculateAllSegments()
Iterates through all cards to calculate segment distances and times.
- Source:
checkToggleGlobalMap()
Checks if any trip cards are active and toggles the global map accordingly.
- Source:
closeAllRoadtripModals()
Closes all active modals and restores body scrolling.
closeRoadtripModal(id)
Closes a specific roadtrip modal by ID.
Restores body scrolling if no other modals are open.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The DOM ID of the modal to close |
createCustomIcon(emoji, color) → {L.DivIcon}
Creates a custom Leaflet DivIcon with an emoji and colored background.
Parameters:
| Name | Type | Description |
|---|---|---|
emoji |
string | The emoji to display |
color |
string | The background color (hex/css) |
Returns:
The created Leaflet icon
- Type
- L.DivIcon
createNumberedMarker(map, point, number, color, popupText, offset, cluster)
Creates a circular numbered marker for route steps.
Parameters:
| Name | Type | Description |
|---|---|---|
map |
L.Map | Leaflet map instance |
point |
Object | Latitude and Longitude object |
number |
number | Step number to display |
color |
string | Background color |
popupText |
string | HTML content for the popup |
offset |
string | null | CSS class for position offset |
cluster |
L.MarkerClusterGroup | null | Cluster group to add to |
- Source:
downloadExportPack(gpxUrl, pdfUrl)
Downloads both GPX and PDF files sequentially.
A slight delay is added to ensure the browser processes multiple downloads correctly.
* @function downloadExportPack
Parameters:
| Name | Type | Description |
|---|---|---|
gpxUrl |
string | The URL of the GPX file |
pdfUrl |
string | The URL of the PDF file |
- Source:
downloadFile(url)
Creates an invisible iframe to trigger a file download.
This technique prevents the browser from navigating away or opening a blank tab.
* @function downloadFile
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | The URL of the file to download |
- Source:
(async) drawRoute(map, data, color, fitBounds, clusterGroup) → {Promise.<void>}
Draws the route polyline and markers on a map using OSRM routing.
Falls back to straight lines if the API fails.
Parameters:
| Name | Type | Description |
|---|---|---|
map |
L.Map | Target Leaflet map |
data |
Object | Trip data |
color |
string | Polyline color |
fitBounds |
boolean | Whether to zoom into the route |
clusterGroup |
L.MarkerClusterGroup | null | Optional cluster group for markers |
- Source:
Returns:
- Type
- Promise.<void>
durationToSeconds(timeStr) → {number}
Converts a duration string (HH:mm:ss or HH:mm) to seconds.
Parameters:
| Name | Type | Description |
|---|---|---|
timeStr |
string | Time string |
- Source:
Returns:
Duration in seconds
- Type
- number
durationToSeconds(timeStr) → {number}
Converts a duration string (HH:mm:ss or HH:mm) to seconds.
Parameters:
| Name | Type | Description |
|---|---|---|
timeStr |
string | Time string |
- Source:
Returns:
Duration in seconds
- Type
- number
getTrajetData(id) → {Object|null}
Retrieves trip data from the global roadTripData array.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | number | The ID of the trip |
- Source:
Returns:
The trip data object or null
- Type
- Object | null
(async) handleGenerateAI() → {Promise.<void>}
Gère la génération de trajet via l'IA.
Returns:
- Type
- Promise.<void>
(async) handleSaveRoadtrip() → {Promise.<void>}
Enregistre le roadtrip actuel via une requête POST.
Returns:
- Type
- Promise.<void>
(async) init() → {Promise.<void>}
Point d'entrée principal initialisant la carte, les favoris et les événements.
Returns:
- Type
- Promise.<void>
(async) initGlobalMap() → {Promise.<void>}
Initializes the main global map showing all trips.
- Source:
Returns:
- Type
- Promise.<void>
(inner) initMap()
Initializes the map and layers.
Sets up geolocation and click listeners.
(async) initStepMap(id) → {Promise.<void>}
Initializes a specific map for a single trip step.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | number | Trip ID |
- Source:
Returns:
- Type
- Promise.<void>
(async, inner) loadPOI(filterType)
Calls the Overpass API to load POIs based on the selected category.
Parameters:
| Name | Type | Description |
|---|---|---|
filterType |
string | The category key from poiFilters |
openRoadtripModal(id)
Opens a specific roadtrip modal by ID.
Disables body scrolling.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The DOM ID of the modal to open |
previewImage(input, previewElement)
Generates a preview of the selected profile image.
Parameters:
| Name | Type | Description |
|---|---|---|
input |
HTMLInputElement | The file input element |
previewElement |
HTMLElement | The element where the background image will be applied |
(async) processCardTimes(card) → {Promise.<void>}
Processes OSRM routing data for a specific card to update UI with distances and times.
Parameters:
| Name | Type | Description |
|---|---|---|
card |
HTMLElement | The DOM element of the trip card |
- Source:
Returns:
- Type
- Promise.<void>
savePreferences(event) → {void}
Saves user preferences to localStorage when the form is submitted.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
SubmitEvent | The form submission event |
- Source:
Returns:
- Type
- void
toggleSidebar() → {void}
Handles the opening and closing of the filter sidebar.
Updates map size after transition.
Returns:
- Type
- void
toggleSidebar()
Toggles the visibility of the profile sidebar on mobile devices.
Accessible globally via onclick attributes.
toggleTrajet(id)
Toggles the visibility of trip details and local maps.
Hides global map when a specific trip is active.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | number | Trip ID |
- Source:
(async) updateRouteSegment(index, mode) → {Promise.<void>}
Met à jour un segment de route spécifique sur la carte.
Parameters:
| Name | Type | Description |
|---|---|---|
index |
number | L'index du segment à mettre à jour. |
mode |
string | Le mode de transport (Voiture, Velo, Marche). |
Returns:
- Type
- Promise.<void>
(inner) updateSearchPosition(lat, lng, zoomopt)
Updates the central marker position and search circle radius.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
lat |
number | Latitude | ||
lng |
number | Longitude | ||
zoom |
number | null |
<optional> |
null | Optional zoom level |
Type Definitions
POIFilter
Overpass filter configuration definition
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
query |
string | The Overpass QL query string |
icon |
string | Emoji character for the marker |
color |
string | Hex color for the marker background |
Events
DOMContentLoaded
Initializes the script when the DOM is fully loaded.
- Source: