/** * ThrillWiki Road Trip Planner - Multi-park Route Planning * * This module provides road trip planning functionality with multi-park selection, * route visualization, distance calculations, and export capabilities */ class RoadTripPlanner { constructor(containerId, options = {}) { this.containerId = containerId; this.options = { mapInstance: null, maxParks: 20, enableOptimization: true, enableExport: true, apiEndpoints: { parks: '/api/parks/', route: '/api/roadtrip/route/', optimize: '/api/roadtrip/optimize/', export: '/api/roadtrip/export/' }, routeOptions: { color: '#3B82F6', weight: 4, opacity: 0.8 }, ...options }; this.container = null; this.mapInstance = null; this.selectedParks = []; this.routeLayer = null; this.parkMarkers = new Map(); this.routePolyline = null; this.routeData = null; this.init(); } /** * Initialize the road trip planner */ init() { this.container = document.getElementById(this.containerId); if (!this.container) { console.error(`Road trip container with ID '${this.containerId}' not found`); return; } this.setupUI(); this.bindEvents(); // Connect to map instance if provided if (this.options.mapInstance) { this.connectToMap(this.options.mapInstance); } this.loadInitialData(); } /** * Setup the UI components */ setupUI() { const html = `
Search and select parks to build your road trip route
Search and select parks to build your road trip route
${park.formatted_location || ''}