/ src / lib / maps / models.ts
models.ts
  1  /**
  2   * Modelos y tipos centralizados para el sistema de mapas
  3   */
  4  
  5  // Interfaz para un lugar
  6  export interface Place {
  7    id: string;
  8    name: string;
  9    lat: number;
 10    lng: number;
 11    type?: string;
 12    importance?: number;
 13    address?: {
 14      street?: string;
 15      city?: string;
 16      state?: string;
 17      country?: string;
 18    };
 19    distance?: number; // Distancia al punto de referencia (opcional)
 20  }
 21  
 22  // Interfaces para la visualización de mapas
 23  export interface MapBounds {
 24    north: number;
 25    east: number;
 26    south: number;
 27    west: number;
 28  }
 29  
 30  export interface MapViewport {
 31    center: {
 32      lat: number;
 33      lng: number;
 34    };
 35    zoom: number;
 36    bounds?: MapBounds;
 37  }
 38  
 39  // Interfaces para marcadores
 40  export interface MapMarker {
 41    id: string;
 42    lat: number;
 43    lng: number;
 44    title?: string;
 45    type?: string;
 46    popup?: string;
 47  }
 48  
 49  // Interfaces para rutas
 50  export interface RoutePoint {
 51    lat: number;
 52    lng: number;
 53    name?: string;
 54  }
 55  
 56  export interface RouteStep {
 57    distance: number;      // Distancia en metros
 58    duration: number;      // Duración en segundos
 59    instruction: string;   // Instrucción de navegación
 60    name: string;          // Nombre de la calle o vía
 61    type: string;          // Tipo de maniobra
 62    startPoint: RoutePoint; // Punto de inicio del paso
 63    endPoint: RoutePoint;   // Punto final del paso
 64  }
 65  
 66  export interface Route {
 67    id: string;
 68    name: string;
 69    startPoint: RoutePoint;
 70    endPoint: RoutePoint;
 71    viaPoints: RoutePoint[];
 72    distance: number;
 73    duration: number;
 74    createdAt: number;
 75  }
 76  
 77  export interface RouteResult {
 78    distance: number;      // Distancia total en metros
 79    duration: number;      // Duración total en segundos
 80    startPoint: RoutePoint; // Punto de inicio
 81    endPoint: RoutePoint;   // Punto final
 82    viaPoints: RoutePoint[]; // Puntos intermedios
 83    steps: RouteStep[];     // Pasos detallados
 84    geometry: any;         // Geometría para representación (GeoJSON)
 85  }
 86  
 87  // Interfaces para regiones offline
 88  export interface OfflineRegion {
 89    name: string;
 90    bounds: MapBounds;
 91    minZoom: number;
 92    maxZoom: number;
 93    tileCount: number;
 94    lastUpdated: number;
 95  }
 96  
 97  // Opciones generales
 98  export interface MapOptions {
 99    offline: boolean;
100    showControls: boolean;
101    showSearch: boolean;
102    showRouting: boolean;
103  }