expo-gaode-map-navigation 2.0.13 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,oBAAoB,GAErB,MAAM,wBAAwB,CAAC;AAEhC,gBAAgB;AAChB,cAAc,OAAO,CAAC;AACtB,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,GAEf,MAAM,SAAS,CAAC;AAmCjB,SAAS,aAAa,CAAC,QAAiB;IACtC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ;SACZ,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SAChC,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACtF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,QAAQ;YACR,SAAS;SACV,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,KAAK,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EACZ,SAAS,EACT,cAAc,GACf,CAAC;AAEF,WAAW;AACX,eAAe;IACb,MAAM;IACN,cAAc;IACd,qBAAqB;IAErB,OAAO;IACP,cAAc;IACd,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;IACnB,wBAAwB;IACxB,gCAAgC;IAChC,qBAAqB;IAErB,SAAS;IACT,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAE1B,UAAU;IACV,sBAAsB;IACtB,4BAA4B;IAC5B,oBAAoB;IACpB,qBAAqB;CACtB,CAAC;AAEF,OAAO,EACL,4BAA4B,GAC7B,CAAA","sourcesContent":["import ExpoGaodeMapNavigationModule from './ExpoGaodeMapNavigationModule';\nimport { ExpoGaodeMapModule } from './map';\nimport {\n ExpoGaodeMapNaviView,\n type ExpoGaodeMapNaviViewRef,\n} from './ExpoGaodeMapNaviView';\n\n// 重新导出地图模块的所有内容\nexport * from './map';\nimport {\n RouteType,\n DriveStrategy,\n WalkStrategy,\n RideStrategy,\n TruckSize,\n TravelStrategy,\n type TransitRouteOptions,\n} from './types';\nimport type {\n NaviPoint,\n RouteOptions,\n DriveRouteOptions,\n WalkRouteOptions,\n RideRouteOptions,\n EBikeRouteOptions,\n TransitRouteOptions as TransitRouteOptionsType,\n TruckRouteOptions,\n OfficialNaviPageOptions,\n RouteResult,\n DriveRouteResult,\n IndependentRouteResult,\n IndependentDriveRouteOptions,\n IndependentTruckRouteOptions,\n IndependentWalkRouteOptions,\n IndependentRideRouteOptions,\n SelectIndependentRouteOptions,\n StartNaviWithIndependentPathOptions,\n ClearIndependentRouteOptions,\n MotorcycleRouteOptions,\n IndependentMotorcycleRouteOptions,\n BuildAnchorWaypointsOptions,\n FollowWebPlannedRouteOptions,\n FollowWebPlannedRouteResult,\n FollowWebPlannedRouteCandidate,\n WebPlannedRoute,\n NaviInfoUpdateEvent,\n NaviLaneInfoEvent,\n NaviTrafficStatusesEvent,\n NaviVisualStateEvent,\n ExpoGaodeMapNaviViewProps,\n } from './types';\n\nfunction parsePolyline(polyline?: string): NaviPoint[] {\n if (!polyline?.trim()) {\n return [];\n }\n\n return polyline\n .split(';')\n .map((segment) => segment.trim())\n .filter(Boolean)\n .map((segment) => {\n const [longitude, latitude] = segment.split(',').map((value) => Number(value.trim()));\n if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {\n return null;\n }\n\n return {\n latitude,\n longitude,\n };\n })\n .filter((point): point is NaviPoint => point !== null);\n}\n\nfunction dedupeAdjacentPoints(points: NaviPoint[]): NaviPoint[] {\n return points.filter((point, index) => {\n if (index === 0) {\n return true;\n }\n\n const previous = points[index - 1];\n return (\n previous.latitude !== point.latitude ||\n previous.longitude !== point.longitude\n );\n });\n}\n\nfunction haversineDistance(pointA: NaviPoint, pointB: NaviPoint): number {\n const toRadians = (degrees: number) => (degrees * Math.PI) / 180;\n const earthRadiusMeters = 6371000;\n const latitudeDelta = toRadians(pointB.latitude - pointA.latitude);\n const longitudeDelta = toRadians(pointB.longitude - pointA.longitude);\n const latitudeA = toRadians(pointA.latitude);\n const latitudeB = toRadians(pointB.latitude);\n\n const a =\n Math.sin(latitudeDelta / 2) ** 2 +\n Math.cos(latitudeA) * Math.cos(latitudeB) * Math.sin(longitudeDelta / 2) ** 2;\n\n return 2 * earthRadiusMeters * Math.asin(Math.sqrt(a));\n}\n\nfunction distanceBetweenCoordinatesSafe(pointA: NaviPoint, pointB: NaviPoint): number {\n try {\n return ExpoGaodeMapModule.distanceBetweenCoordinates(pointA, pointB);\n } catch {\n return haversineDistance(pointA, pointB);\n }\n}\n\nfunction calculatePathLengthSafe(points: NaviPoint[]): number {\n try {\n return ExpoGaodeMapModule.calculatePathLength(points);\n } catch {\n let total = 0;\n for (let index = 1; index < points.length; index += 1) {\n total += distanceBetweenCoordinatesSafe(points[index - 1], points[index]);\n }\n return total;\n }\n}\n\nfunction simplifyPolylineSafe(points: NaviPoint[], tolerance: number): NaviPoint[] {\n if (points.length <= 2) {\n return points;\n }\n\n try {\n const simplified = ExpoGaodeMapModule.simplifyPolyline(points, tolerance);\n return simplified.length >= 2 ? simplified : points;\n } catch {\n return points;\n }\n}\n\nfunction getDistanceToPathSafe(path: NaviPoint[], target: NaviPoint): number {\n if (path.length === 0) {\n return Number.POSITIVE_INFINITY;\n }\n\n try {\n const nearest = ExpoGaodeMapModule.getNearestPointOnPath(path, target);\n if (nearest) {\n return nearest.distanceMeters;\n }\n } catch {\n // ignore and fallback to point-to-point scan\n }\n\n return path.reduce((minimum, point) => {\n const distance = distanceBetweenCoordinatesSafe(point, target);\n return distance < minimum ? distance : minimum;\n }, Number.POSITIVE_INFINITY);\n}\n\nfunction samplePolyline(points: NaviPoint[], targetSamples = 36): NaviPoint[] {\n if (points.length <= targetSamples) {\n return points;\n }\n\n const step = Math.max(1, Math.floor(points.length / targetSamples));\n const samples = points.filter((_, index) => index % step === 0);\n const lastPoint = points[points.length - 1];\n const lastSample = samples[samples.length - 1];\n if (\n !lastSample ||\n lastSample.latitude !== lastPoint.latitude ||\n lastSample.longitude !== lastPoint.longitude\n ) {\n samples.push(lastPoint);\n }\n return samples;\n}\n\nfunction selectEvenlySpacedPoints(points: NaviPoint[], count: number): NaviPoint[] {\n if (count <= 0 || points.length <= count) {\n return points;\n }\n\n return Array.from({ length: count }, (_, index) => {\n const rawIndex = Math.round(((index + 1) * (points.length + 1)) / (count + 1)) - 1;\n const boundedIndex = Math.min(points.length - 1, Math.max(0, rawIndex));\n return points[boundedIndex];\n });\n}\n\nfunction normalizeWebRoutePolyline(webRoute: WebPlannedRoute): NaviPoint[] {\n const directPolyline = dedupeAdjacentPoints(webRoute.polyline ?? []);\n if (directPolyline.length > 1) {\n return directPolyline;\n }\n\n const stepPolyline = dedupeAdjacentPoints(\n (webRoute.steps ?? []).flatMap((step) => step.polyline ?? [])\n );\n return stepPolyline;\n}\n\nexport function buildAnchorWaypointsFromWebRoute(\n options: BuildAnchorWaypointsOptions\n): NaviPoint[] {\n const {\n webRoute,\n maxViaPoints = 8,\n simplifyTolerance = 80,\n minSpacingMeters = 800,\n } = options;\n\n const polyline = normalizeWebRoutePolyline(webRoute);\n if (polyline.length <= 2) {\n return [];\n }\n\n const simplified = dedupeAdjacentPoints(\n simplifyPolylineSafe(polyline, simplifyTolerance)\n );\n const candidatePoints = simplified.length > 2 ? simplified : polyline;\n const interiorPoints = candidatePoints.slice(1, -1);\n\n const spacedPoints: NaviPoint[] = [];\n let previousPoint = polyline[0];\n\n for (const point of interiorPoints) {\n if (distanceBetweenCoordinatesSafe(previousPoint, point) < minSpacingMeters) {\n continue;\n }\n spacedPoints.push(point);\n previousPoint = point;\n }\n\n const waypoints = spacedPoints.length > 0\n ? spacedPoints\n : candidatePoints.length > 2\n ? [candidatePoints[Math.floor(candidatePoints.length / 2)]]\n : [];\n\n return dedupeAdjacentPoints(selectEvenlySpacedPoints(waypoints, maxViaPoints));\n}\n\nasync function loadWebApiFallback(feature: '公交路径规划' | '规避路线预览') {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const webApi = require('expo-gaode-map-web-api');\n if (typeof webApi?.GaodeWebAPI !== 'function') {\n throw new Error('expo-gaode-map-web-api 未导出 GaodeWebAPI');\n }\n return webApi;\n } catch {\n throw new Error(\n `${feature}依赖 expo-gaode-map-web-api。请安装该包,并在 ExpoGaodeMapModule.initSDK 中提供 webKey。`\n );\n }\n}\n\nfunction normalizeAvoidPolygons(polygons?: DriveRouteOptions['avoidPolygons']): string | undefined {\n if (!polygons?.length) {\n return undefined;\n }\n\n const normalized = polygons\n .map((polygon) =>\n polygon\n .map((point) => `${point.longitude},${point.latitude}`)\n .join(';')\n )\n .filter(Boolean)\n .join('|');\n\n return normalized || undefined;\n}\n\nfunction normalizeDrivingStrategy(\n strategy?: DriveStrategy\n): number | undefined {\n // 导航 SDK 与 Web API 的策略枚举不完全一致。\n // 这里做“尽量等价”的映射,主要用于带规避参数时的路线预览。\n switch (strategy) {\n case DriveStrategy.FASTEST:\n return 38;\n case DriveStrategy.FEE_FIRST:\n return 1;\n case DriveStrategy.SHORTEST:\n return 2;\n case DriveStrategy.NO_EXPRESSWAYS:\n return 37;\n case DriveStrategy.AVOID_CONGESTION:\n return 33;\n case DriveStrategy.NO_HIGHWAY:\n return 35;\n case DriveStrategy.NO_HIGHWAY_AVOID_CONGESTION:\n return 40;\n case DriveStrategy.AVOID_COST_CONGESTION:\n case DriveStrategy.AVOID_CONGESTION_COST:\n return 41;\n case DriveStrategy.NO_HIGHWAY_AVOID_COST_CONGESTION:\n return 43;\n default:\n return undefined;\n }\n}\n\nfunction normalizeDrivingRouteResult(\n options: DriveRouteOptions,\n result: any\n): DriveRouteResult {\n const paths = result?.route?.paths ?? [];\n const routes = paths.map((path: any, index: number) => {\n const segments = (path?.steps ?? []).map((step: any) => ({\n instruction: step?.instruction ?? '',\n orientation: step?.orientation,\n road: step?.road_name,\n distance: Number(step?.step_distance ?? 0),\n duration: Number(step?.cost?.duration ?? 0),\n polyline: parsePolyline(step?.polyline),\n assistantAction: step?.assistant_action,\n tollDistance: step?.cost?.toll_distance ? Number(step.cost.toll_distance) : undefined,\n tollCost: step?.cost?.tolls ? Number(step.cost.tolls) : undefined,\n }));\n\n const restrictionCode = path?.restriction != null ? Number(path.restriction) : undefined;\n\n return {\n id: index,\n start: options.from,\n end: options.to,\n distance: Number(path?.distance ?? 0),\n duration: Number(path?.cost?.duration ?? path?.duration ?? 0),\n segments,\n polyline: segments.flatMap((segment: { polyline: NaviPoint[] }) => segment.polyline),\n tollDistance: path?.cost?.toll_distance ? Number(path.cost.toll_distance) : undefined,\n tollCost: path?.cost?.tolls ? Number(path.cost.tolls) : undefined,\n trafficLightCount: path?.cost?.traffic_lights ? Number(path.cost.traffic_lights) : undefined,\n restrictionCode,\n restrictionInfo:\n restrictionCode === 0\n ? '限行已规避或未限行'\n : restrictionCode === 1\n ? '限行无法规避'\n : undefined,\n strategy: options.strategy,\n };\n });\n\n return {\n count: Number(result?.count ?? routes.length),\n mainPathIndex: 0,\n routeIds: routes.map((route: RouteResult) => route.id),\n routes,\n taxiCost: result?.route?.taxi_cost ? Number(result.route.taxi_cost) : undefined,\n };\n}\n\nfunction shouldUseAvoidPreviewFallback(options: DriveRouteOptions): boolean {\n return Boolean(options.avoidRoad?.trim() || options.avoidPolygons?.length);\n}\n\ntype RouteLike = RouteResult & {\n routeId?: number;\n steps?: Array<{ polyline?: NaviPoint[] }>;\n};\n\nfunction extractRoutePolyline(route: RouteLike): NaviPoint[] {\n if (Array.isArray(route.polyline) && route.polyline.length > 0) {\n return route.polyline;\n }\n\n const segments = Array.isArray(route.segments) ? route.segments : [];\n if (segments.length > 0) {\n return dedupeAdjacentPoints(\n segments.flatMap((segment) => segment.polyline ?? [])\n );\n }\n\n const steps = Array.isArray(route.steps) ? route.steps : [];\n if (steps.length > 0) {\n return dedupeAdjacentPoints(\n steps.flatMap((step) => step.polyline ?? [])\n );\n }\n\n return [];\n}\n\nfunction resolveIndependentRouteId(\n result: IndependentRouteResult,\n route: RouteLike,\n routeIndex: number\n): number | undefined {\n if (typeof route.id === 'number') {\n return route.id;\n }\n if (typeof route.routeId === 'number') {\n return route.routeId;\n }\n return result.routeIds?.[routeIndex];\n}\n\nfunction scoreIndependentRouteAgainstWebPolyline(\n result: IndependentRouteResult,\n route: RouteLike,\n routeIndex: number,\n webPolyline: NaviPoint[],\n anchorWaypoints: NaviPoint[],\n thresholdMeters: number\n): FollowWebPlannedRouteCandidate | null {\n const nativePolyline = extractRoutePolyline(route);\n if (nativePolyline.length === 0 || webPolyline.length === 0) {\n return null;\n }\n\n const sampledNativePoints = samplePolyline(nativePolyline);\n const pointDistances = sampledNativePoints.map((point) =>\n getDistanceToPathSafe(webPolyline, point)\n );\n const averageDeviationMeters =\n pointDistances.reduce((total, distance) => total + distance, 0) / pointDistances.length;\n const maxDeviationMeters = Math.max(...pointDistances);\n\n const missedAnchorCount = anchorWaypoints.reduce((count, point) => (\n getDistanceToPathSafe(nativePolyline, point) > thresholdMeters ? count + 1 : count\n ), 0);\n\n return {\n routeId: resolveIndependentRouteId(result, route, routeIndex),\n routeIndex,\n averageDeviationMeters,\n maxDeviationMeters,\n missedAnchorCount,\n score:\n averageDeviationMeters +\n maxDeviationMeters * 0.35 +\n missedAnchorCount * thresholdMeters * 0.5,\n };\n}\n\nfunction evaluateIndependentResultAgainstWebRoute(\n independentResult: IndependentRouteResult,\n webPolyline: NaviPoint[],\n anchorWaypoints: NaviPoint[],\n maxDeviationMeters: number\n) {\n const candidateMatches = independentResult.routes\n .map((route, routeIndex) =>\n scoreIndependentRouteAgainstWebPolyline(\n independentResult,\n route as RouteLike,\n routeIndex,\n webPolyline,\n anchorWaypoints,\n maxDeviationMeters\n )\n )\n .filter((candidate): candidate is FollowWebPlannedRouteCandidate => candidate !== null)\n .sort((routeA, routeB) => routeA.score - routeB.score);\n\n const bestMatch = candidateMatches[0];\n const selectedRoute = bestMatch\n ? independentResult.routes[bestMatch.routeIndex] as RouteLike\n : undefined;\n const nativePolyline = selectedRoute ? extractRoutePolyline(selectedRoute) : [];\n\n let mode: FollowWebPlannedRouteResult['mode'] = 'preview_only';\n let reason = '未找到足够接近 Web 规划线的原生路线';\n\n if (bestMatch) {\n if (\n bestMatch.averageDeviationMeters <= maxDeviationMeters / 2 &&\n bestMatch.maxDeviationMeters <= maxDeviationMeters &&\n bestMatch.missedAnchorCount === 0\n ) {\n mode = 'matched';\n reason = '原生路线与 Web 规划线高度接近,可直接按近似结果导航';\n } else if (\n bestMatch.averageDeviationMeters <= maxDeviationMeters &&\n bestMatch.maxDeviationMeters <= maxDeviationMeters * 2\n ) {\n mode = 'approximate';\n reason = '原生路线与 Web 规划线接近,但仍存在可见偏差';\n }\n }\n\n return {\n candidateMatches,\n bestMatch,\n selectedRoute,\n nativePolyline,\n mode,\n reason,\n };\n}\n\nexport async function followWebPlannedRoute(\n options: FollowWebPlannedRouteOptions\n): Promise<FollowWebPlannedRouteResult> {\n const {\n from,\n to,\n webRoute,\n strategy,\n carNumber,\n restriction,\n maxDeviationMeters = 120,\n startNavigation = false,\n naviType = 0,\n } = options;\n\n const webPolyline = normalizeWebRoutePolyline(webRoute);\n if (webPolyline.length < 2) {\n throw new Error('webRoute.polyline 至少需要 2 个点');\n }\n\n const anchorWaypoints = buildAnchorWaypointsFromWebRoute(options);\n const anchoredIndependentResult = await independentDriveRoute({\n from,\n to,\n strategy,\n carNumber,\n restriction,\n waypoints: anchorWaypoints,\n });\n\n let independentResult = anchoredIndependentResult;\n let evaluation = evaluateIndependentResultAgainstWebRoute(\n anchoredIndependentResult,\n webPolyline,\n anchorWaypoints,\n maxDeviationMeters\n );\n let navigationUsesAnchorWaypoints = anchorWaypoints.length > 0;\n\n if (evaluation.bestMatch && evaluation.mode !== 'preview_only' && anchorWaypoints.length > 0) {\n try {\n const directIndependentResult = await independentDriveRoute({\n from,\n to,\n strategy,\n carNumber,\n restriction,\n });\n\n const directEvaluation = evaluateIndependentResultAgainstWebRoute(\n directIndependentResult,\n webPolyline,\n [],\n maxDeviationMeters\n );\n const anchoredBest = evaluation.bestMatch;\n const directBest = directEvaluation.bestMatch;\n\n const canSwitchToDirectNavigation =\n Boolean(directBest) &&\n directEvaluation.mode !== 'preview_only' &&\n directBest!.averageDeviationMeters <= Math.max(\n anchoredBest.averageDeviationMeters + 45,\n anchoredBest.averageDeviationMeters * 1.45\n ) &&\n directBest!.maxDeviationMeters <= Math.max(\n anchoredBest.maxDeviationMeters + 90,\n anchoredBest.maxDeviationMeters * 1.45\n );\n\n if (canSwitchToDirectNavigation) {\n ExpoGaodeMapNavigationModule.clearIndependentRoute({\n token: anchoredIndependentResult.token,\n }).catch(() => {});\n independentResult = directIndependentResult;\n evaluation = directEvaluation;\n navigationUsesAnchorWaypoints = false;\n evaluation.reason =\n directEvaluation.mode === 'matched'\n ? '已切换为无途经点导航结果,且与 Web 规划线高度接近'\n : '已切换为无途经点导航结果,但与 Web 规划线仍存在轻微偏差';\n } else {\n ExpoGaodeMapNavigationModule.clearIndependentRoute({\n token: directIndependentResult.token,\n }).catch(() => {});\n evaluation.reason = `${evaluation.reason};最终导航仍需依赖锚点途经点逼近 Web 线路`;\n }\n } catch {\n evaluation.reason = `${evaluation.reason};无途经点重算失败,最终导航仍需依赖锚点途经点`;\n }\n }\n\n let navigationStarted = false;\n if (startNavigation && evaluation.bestMatch && evaluation.mode !== 'preview_only') {\n navigationStarted = await startNaviWithIndependentPath({\n token: independentResult.token,\n naviType,\n routeId: evaluation.bestMatch.routeId,\n routeIndex:\n evaluation.bestMatch.routeId == null ? evaluation.bestMatch.routeIndex : undefined,\n });\n }\n\n return {\n mode: evaluation.mode,\n token: independentResult.token,\n anchorWaypoints,\n webDistance: calculatePathLengthSafe(webPolyline),\n nativeDistance:\n evaluation.nativePolyline.length > 1\n ? calculatePathLengthSafe(evaluation.nativePolyline)\n : undefined,\n selectedRouteId: evaluation.bestMatch?.routeId,\n selectedRouteIndex: evaluation.bestMatch?.routeIndex,\n averageDeviationMeters: evaluation.bestMatch?.averageDeviationMeters,\n maxDeviationMeters: evaluation.bestMatch?.maxDeviationMeters,\n navigationStarted,\n navigationUsesAnchorWaypoints,\n independentResult,\n candidateMatches: evaluation.candidateMatches,\n reason: evaluation.reason,\n };\n}\n\nasync function calculateDriveRouteWithAvoidPreview(\n options: DriveRouteOptions\n): Promise<DriveRouteResult> {\n const { GaodeWebAPI } = await loadWebApiFallback('规避路线预览');\n const api = new GaodeWebAPI();\n const result = await api.route.driving(\n `${options.from.longitude},${options.from.latitude}`,\n `${options.to.longitude},${options.to.latitude}`,\n {\n strategy: normalizeDrivingStrategy(options.strategy),\n waypoints: options.waypoints?.map(\n (point) => `${point.longitude},${point.latitude}`\n ),\n avoidpolygons: normalizeAvoidPolygons(options.avoidPolygons),\n avoidroad: options.avoidRoad?.trim() || undefined,\n plate: options.carNumber,\n show_fields: 'cost,navi,polyline',\n }\n );\n\n return normalizeDrivingRouteResult(options, result);\n}\n\nfunction normalizeTransitRouteResult(\n options: TransitRouteOptions,\n result: any\n): DriveRouteResult {\n // 导航包内部仍保持独立实现;\n // 这里只是在“公交无法由导航 SDK 直算”时,把 Web API 结果映射成现有 RouteResult 形状。\n const routes = (result?.route?.transits ?? []).map((transit: any, index: number) => {\n const polyline = (transit?.segments ?? []).flatMap((segment: any) => [\n ...(segment.walking?.steps?.flatMap((step: any) => parsePolyline(step.polyline)) ?? []),\n ...(segment.bus?.buslines?.flatMap((line: any) => parsePolyline(line.polyline)) ?? []),\n ...(segment.railway?.buslines?.flatMap((line: any) => parsePolyline(line.polyline)) ?? []),\n ]);\n\n return {\n id: index,\n start: options.from,\n end: options.to,\n distance: Number(transit?.distance ?? 0),\n duration: Number(transit?.cost?.duration ?? 0),\n segments: [],\n polyline,\n tollDistance: 0,\n tollCost: Number(transit?.cost?.transit_fee ?? 0),\n strategy: options.strategy,\n };\n });\n\n return {\n count: routes.length,\n mainPathIndex: 0,\n routes,\n };\n}\n\nfunction hasStrategyOption(\n options: RouteOptions\n): options is WalkRouteOptions | RideRouteOptions {\n return 'strategy' in options;\n}\n\nfunction isMotorcycleRouteOptions(\n options: RouteOptions | MotorcycleRouteOptions\n): options is MotorcycleRouteOptions {\n return 'motorcycleCC' in options;\n}\n\n// 导出官方导航界面组件\nexport { ExpoGaodeMapNaviView, type ExpoGaodeMapNaviViewRef };\n\n/**\n * @deprecated 请使用 `ExpoGaodeMapNaviView`\n */\nexport const NaviView = ExpoGaodeMapNaviView;\n\n/**\n * @deprecated 请使用 `ExpoGaodeMapNaviViewRef`\n */\nexport type NaviViewRef = ExpoGaodeMapNaviViewRef;\n\n/**\n * 初始化导航模块(可选)\n */\nexport const initNavigation = () => ExpoGaodeMapNavigationModule.initNavigation();\n\n/**\n * 销毁所有路径计算器实例\n * 用于页面切换时释放资源,避免\"Another route calculation is in progress\"错误\n */\nexport const destroyAllCalculators = () => ExpoGaodeMapNavigationModule.destroyAllCalculators();\n\n/**\n * 路径规划(通用方法)\n */\nexport async function calculateRoute(\n options: RouteOptions\n): Promise<RouteResult | DriveRouteResult> {\n if ('type' in options && options.type === RouteType.TRANSIT) {\n return calculateTransitRoute(options as TransitRouteOptions);\n }\n\n // 1. 货车\n if ('size' in options) {\n return calculateTruckRoute(options as TruckRouteOptions);\n }\n \n // 2. 步行、骑行、电动车\n if ('multiple' in options || 'travelStrategy' in options) {\n if ('usePoi' in options) return calculateEBikeRoute(options as EBikeRouteOptions);\n \n // 策略判断:0 或 1 通常为骑行策略,其余默认步行\n const strategy = hasStrategyOption(options) ? options.strategy : undefined;\n if (strategy === 0 || strategy === 1) {\n return calculateRideRoute(options as RideRouteOptions);\n }\n return calculateWalkRoute(options as WalkRouteOptions);\n }\n\n // 3. 摩托车 (通过 carType 或 motorcycleCC 判断)\n if (isMotorcycleRouteOptions(options)) {\n return calculateMotorcycleRoute(options as MotorcycleRouteOptions);\n }\n\n // 4. 默认驾车\n return calculateDriveRoute(options as DriveRouteOptions);\n}\n\n/**\n * 驾车路径规划\n */\nexport async function calculateDriveRoute(\n options: DriveRouteOptions\n): Promise<DriveRouteResult> {\n if (shouldUseAvoidPreviewFallback(options)) {\n try {\n return await calculateDriveRouteWithAvoidPreview(options);\n } catch {\n // 若未安装 Web API 包,则保持现有原生逻辑不变。\n // 这样不会破坏当前依赖 Android 反射重载的项目。\n }\n }\n\n return ExpoGaodeMapNavigationModule.calculateDriveRoute(options);\n}\n\n/**\n * 步行路径规划\n */\nexport const calculateWalkRoute = (options: WalkRouteOptions) => \n ExpoGaodeMapNavigationModule.calculateWalkRoute(options);\n\n/**\n * 骑行路径规划\n */\nexport const calculateRideRoute = (options: RideRouteOptions) => \n ExpoGaodeMapNavigationModule.calculateRideRoute(options);\n\n/**\n * 骑行电动车路径规划\n */\nexport const calculateEBikeRoute = (options: EBikeRouteOptions) => \n ExpoGaodeMapNavigationModule.calculateEBikeRoute(options);\n\n/**\n * 货车路径规划\n */\nexport const calculateTruckRoute = (options: TruckRouteOptions) => \n ExpoGaodeMapNavigationModule.calculateTruckRoute(options);\n\n/**\n * 摩托车路径规划(车类型为 11,支持传入排量)\n */\nexport const calculateMotorcycleRoute = (options: MotorcycleRouteOptions) => \n ExpoGaodeMapNavigationModule.calculateMotorcycleRoute(options);\n\n/**\n * 公交换乘路径规划(运行时 fallback 到 Web API)\n */\nexport async function calculateTransitRoute(options: TransitRouteOptions): Promise<DriveRouteResult> {\n // 运行时按需加载,避免把 navigation 包和 web-api 包在构建期强绑定。\n const { GaodeWebAPI, TransitStrategy } = await loadWebApiFallback('公交路径规划');\n const api = new GaodeWebAPI();\n const result = await api.route.transit(\n `${options.from.longitude},${options.from.latitude}`,\n `${options.to.longitude},${options.to.latitude}`,\n options.city1,\n options.city2,\n {\n strategy: options.strategy ?? TransitStrategy.RECOMMENDED,\n AlternativeRoute: options.alternativeRoute,\n show_fields: 'cost,polyline',\n }\n );\n\n return normalizeTransitRouteResult(options, result);\n}\n\n/**\n * 独立驾车路径规划\n *\n * - 只负责生成独立路径组,不会自动开始导航\n * - 适合路线预览、行前选路、自定义路线选择页\n * - 后续可配合 selectIndependentRoute / startNaviWithIndependentPath 使用\n */\nexport const independentDriveRoute = (options: IndependentDriveRouteOptions) => \n ExpoGaodeMapNavigationModule.independentDriveRoute(options);\n/**\n * 独立货车路径规划\n *\n * - 只负责生成独立路径组,不会自动开始导航\n * - 适合路线预览、行前选路\n */\nexport const independentTruckRoute = (options: IndependentTruckRouteOptions) => \n ExpoGaodeMapNavigationModule.independentTruckRoute(options);\n/**\n * 独立步行路径规划\n *\n * - 只负责生成独立路径组,不会自动开始导航\n * - 适合路线预览、行前选路\n */\nexport const independentWalkRoute = (options: IndependentWalkRouteOptions) => \n ExpoGaodeMapNavigationModule.independentWalkRoute(options);\n\n/**\n * 独立骑行路径规划\n *\n * - 只负责生成独立路径组,不会自动开始导航\n * - 适合路线预览、行前选路\n */\nexport const independentRideRoute = (options: IndependentRideRouteOptions) => \n ExpoGaodeMapNavigationModule.independentRideRoute(options);\n\n/**\n * 独立摩托车路径规划\n *\n * - 只负责生成独立路径组,不会自动开始导航\n * - 适合路线预览、行前选路\n */\nexport const independentMotorcycleRoute = (options: IndependentMotorcycleRouteOptions) => \n ExpoGaodeMapNavigationModule.independentMotorcycleRoute(options);\n\n/**\n * 独立路径组:选主路线\n *\n * - 仅切换 token 对应路径组里的当前主路线\n * - 本身不会开始导航\n */\nexport const selectIndependentRoute = (options: SelectIndependentRouteOptions) => \n ExpoGaodeMapNavigationModule.selectIndependentRoute(options);\n\n/**\n * 独立路径组:使用指定路线启动导航\n *\n * - 这是模块级启动入口,不依赖 ExpoGaodeMapNaviView ref\n * - 适合工具函数、流程封装、非嵌入式页面场景\n * - 若你已经持有嵌入式导航视图 ref,更适合调用 ref.startNavigationWithIndependentPath(...)\n */\nexport const startNaviWithIndependentPath = (options: StartNaviWithIndependentPathOptions) => \n ExpoGaodeMapNavigationModule.startNaviWithIndependentPath(options);\n\n/**\n * 打开高德官方导航页(Android 原生 AmapNaviPage)\n */\nexport const openOfficialNaviPage = (options: OfficialNaviPageOptions) =>\n ExpoGaodeMapNavigationModule.openOfficialNaviPage(options);\n\n/**\n * 独立路径组:清理\n *\n * - 释放 independentXXXRoute 生成的 token 对应缓存\n * - 当页面只保留路线预览、不再需要后续选路/导航时,建议主动清理\n */\nexport const clearIndependentRoute = (options: ClearIndependentRouteOptions) => \n ExpoGaodeMapNavigationModule.clearIndependentRoute(options);\n\n// 导出导航相关类型与枚举(Coordinates 从 map 模块导出)\nexport type {\n NaviPoint,\n RouteOptions,\n DriveRouteOptions,\n WalkRouteOptions,\n RideRouteOptions,\n EBikeRouteOptions,\n TransitRouteOptionsType as TransitRouteOptions,\n TruckRouteOptions,\n RouteResult,\n DriveRouteResult,\n IndependentRouteResult,\n IndependentDriveRouteOptions,\n IndependentTruckRouteOptions,\n IndependentWalkRouteOptions,\n IndependentRideRouteOptions,\n SelectIndependentRouteOptions,\n StartNaviWithIndependentPathOptions,\n OfficialNaviPageOptions,\n ClearIndependentRouteOptions,\n MotorcycleRouteOptions,\n IndependentMotorcycleRouteOptions,\n BuildAnchorWaypointsOptions,\n FollowWebPlannedRouteOptions,\n FollowWebPlannedRouteResult,\n FollowWebPlannedRouteCandidate,\n WebPlannedRoute,\n NaviInfoUpdateEvent,\n NaviLaneInfoEvent,\n NaviTrafficStatusesEvent,\n NaviVisualStateEvent,\n ExpoGaodeMapNaviViewProps,\n};\n\nexport {\n RouteType,\n DriveStrategy,\n WalkStrategy,\n RideStrategy,\n TruckSize,\n TravelStrategy,\n};\n\n// 精简后的默认导出\nexport default {\n // 初始化\n initNavigation,\n destroyAllCalculators,\n\n // 路径规划\n calculateRoute,\n calculateDriveRoute,\n calculateWalkRoute,\n calculateRideRoute,\n calculateEBikeRoute,\n calculateTransitRoute,\n calculateTruckRoute,\n calculateMotorcycleRoute,\n buildAnchorWaypointsFromWebRoute,\n followWebPlannedRoute,\n\n // 独立路径规划\n independentDriveRoute,\n independentTruckRoute,\n independentWalkRoute,\n independentRideRoute,\n independentMotorcycleRoute,\n\n // 独立路径组操作\n selectIndependentRoute,\n startNaviWithIndependentPath,\n openOfficialNaviPage,\n clearIndependentRoute,\n};\n\nexport {\n ExpoGaodeMapNavigationModule,\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EACL,oBAAoB,GAErB,MAAM,wBAAwB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB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AAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import ExpoGaodeMapNavigationModule from './ExpoGaodeMapNavigationModule';\nimport {\n ExpoGaodeMapNaviView,\n type ExpoGaodeMapNaviViewRef,\n} from './ExpoGaodeMapNaviView';\nexport * from './map';\nimport {\n DriveStrategy,\n RouteType,\n WalkStrategy,\n RideStrategy,\n TruckSize,\n TravelStrategy,\n} from './types';\nimport {\n calculateRoute,\n calculateDriveRoute,\n calculateWalkRoute,\n calculateRideRoute,\n calculateEBikeRoute,\n calculateTransitRoute,\n calculateTruckRoute,\n calculateMotorcycleRoute,\n initNavigation,\n destroyAllCalculators,\n independentDriveRoute,\n independentTruckRoute,\n independentWalkRoute,\n independentRideRoute,\n independentMotorcycleRoute,\n selectIndependentRoute,\n startNaviWithIndependentPath,\n openOfficialNaviPage,\n clearIndependentRoute,\n} from './route-planning';\nimport { buildAnchorWaypointsFromWebRoute } from './route-geometry';\nimport {\n followWebPlannedRoute,\n} from './web-route-following';\n\nexport {\n calculateRoute,\n calculateDriveRoute,\n calculateWalkRoute,\n calculateRideRoute,\n calculateEBikeRoute,\n calculateTransitRoute,\n calculateTruckRoute,\n calculateMotorcycleRoute,\n initNavigation,\n destroyAllCalculators,\n independentDriveRoute,\n independentTruckRoute,\n independentWalkRoute,\n independentRideRoute,\n independentMotorcycleRoute,\n selectIndependentRoute,\n startNaviWithIndependentPath,\n openOfficialNaviPage,\n clearIndependentRoute,\n};\nexport { buildAnchorWaypointsFromWebRoute };\nexport { followWebPlannedRoute };\n\nexport { ExpoGaodeMapNavigationModule };\n\n// 导出官方导航界面组件\nexport { ExpoGaodeMapNaviView, type ExpoGaodeMapNaviViewRef };\n\n/**\n * @deprecated 请使用 `ExpoGaodeMapNaviView`\n */\nexport const NaviView = ExpoGaodeMapNaviView;\n\n/**\n * @deprecated 请使用 `ExpoGaodeMapNaviViewRef`\n */\nexport type NaviViewRef = ExpoGaodeMapNaviViewRef;\n\n// 导出导航相关类型与枚举(Coordinates 从 map 模块导出)\nexport type {\n NaviPoint,\n RouteOptions,\n DriveRouteOptions,\n WalkRouteOptions,\n RideRouteOptions,\n EBikeRouteOptions,\n TransitRouteOptions,\n TruckRouteOptions,\n RouteResult,\n DriveRouteResult,\n IndependentRouteResult,\n IndependentDriveRouteOptions,\n IndependentTruckRouteOptions,\n IndependentWalkRouteOptions,\n IndependentRideRouteOptions,\n SelectIndependentRouteOptions,\n StartNaviWithIndependentPathOptions,\n OfficialNaviPageOptions,\n ClearIndependentRouteOptions,\n MotorcycleRouteOptions,\n IndependentMotorcycleRouteOptions,\n BuildAnchorWaypointsOptions,\n FollowWebPlannedRouteOptions,\n FollowWebPlannedRouteResult,\n FollowWebPlannedRouteCandidate,\n WebPlannedRoute,\n NaviInfoUpdateEvent,\n NaviLaneInfoEvent,\n NaviTrafficStatusesEvent,\n NaviVisualStateEvent,\n ExpoGaodeMapNaviViewProps,\n} from './types';\n\nexport {\n RouteType,\n DriveStrategy,\n WalkStrategy,\n RideStrategy,\n TruckSize,\n TravelStrategy,\n};\n\n// 默认导出保留为兼容层,方便老代码一次性挂载整个导航 API。\nconst ExpoGaodeMapNavigation = {\n // 初始化\n initNavigation,\n destroyAllCalculators,\n\n // 路径规划\n calculateRoute,\n calculateDriveRoute,\n calculateWalkRoute,\n calculateRideRoute,\n calculateEBikeRoute,\n calculateTransitRoute,\n calculateTruckRoute,\n calculateMotorcycleRoute,\n buildAnchorWaypointsFromWebRoute,\n followWebPlannedRoute,\n\n // 独立路径规划\n independentDriveRoute,\n independentTruckRoute,\n independentWalkRoute,\n independentRideRoute,\n independentMotorcycleRoute,\n\n // 独立路径组操作\n selectIndependentRoute,\n startNaviWithIndependentPath,\n openOfficialNaviPage,\n clearIndependentRoute,\n};\n\nexport default ExpoGaodeMapNavigation;\n"]}
@@ -0,0 +1,13 @@
1
+ import type { BuildAnchorWaypointsOptions, NaviPoint, WebPlannedRoute } from './types';
2
+ export declare function parsePolyline(polyline?: string): NaviPoint[];
3
+ export declare function dedupeAdjacentPoints(points: NaviPoint[]): NaviPoint[];
4
+ export declare function haversineDistance(pointA: NaviPoint, pointB: NaviPoint): number;
5
+ export declare function distanceBetweenCoordinatesSafe(pointA: NaviPoint, pointB: NaviPoint): number;
6
+ export declare function calculatePathLengthSafe(points: NaviPoint[]): number;
7
+ export declare function simplifyPolylineSafe(points: NaviPoint[], tolerance: number): NaviPoint[];
8
+ export declare function getDistanceToPathSafe(path: NaviPoint[], target: NaviPoint): number;
9
+ export declare function samplePolyline(points: NaviPoint[], targetSamples?: number): NaviPoint[];
10
+ export declare function selectEvenlySpacedPoints(points: NaviPoint[], count: number): NaviPoint[];
11
+ export declare function normalizeWebRoutePolyline(webRoute: WebPlannedRoute): NaviPoint[];
12
+ export declare function buildAnchorWaypointsFromWebRoute(options: BuildAnchorWaypointsOptions): NaviPoint[];
13
+ //# sourceMappingURL=route-geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-geometry.d.ts","sourceRoot":"","sources":["../src/route-geometry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,2BAA2B,EAC3B,SAAS,EACT,eAAe,EAChB,MAAM,SAAS,CAAC;AAGjB,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAqB5D;AAGD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAYrE;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CAa9E;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CAM3F;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAUnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,CAWxF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CAkBlF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,aAAa,SAAK,GAAG,SAAS,EAAE,CAiBnF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CAUxF;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,EAAE,CAUhF;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,2BAA2B,GACnC,SAAS,EAAE,CAwCb"}
@@ -0,0 +1,154 @@
1
+ import { ExpoGaodeMapModule } from './map';
2
+ export function parsePolyline(polyline) {
3
+ if (!polyline?.trim()) {
4
+ return [];
5
+ }
6
+ return polyline
7
+ .split(';')
8
+ .map((segment) => segment.trim())
9
+ .filter(Boolean)
10
+ .map((segment) => {
11
+ const [longitude, latitude] = segment.split(',').map((value) => Number(value.trim()));
12
+ if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {
13
+ return null;
14
+ }
15
+ return {
16
+ latitude,
17
+ longitude,
18
+ };
19
+ })
20
+ .filter((point) => point !== null);
21
+ }
22
+ export function dedupeAdjacentPoints(points) {
23
+ return points.filter((point, index) => {
24
+ if (index === 0) {
25
+ return true;
26
+ }
27
+ const previous = points[index - 1];
28
+ return (previous.latitude !== point.latitude ||
29
+ previous.longitude !== point.longitude);
30
+ });
31
+ }
32
+ export function haversineDistance(pointA, pointB) {
33
+ const toRadians = (degrees) => (degrees * Math.PI) / 180;
34
+ const earthRadiusMeters = 6371000;
35
+ const latitudeDelta = toRadians(pointB.latitude - pointA.latitude);
36
+ const longitudeDelta = toRadians(pointB.longitude - pointA.longitude);
37
+ const latitudeA = toRadians(pointA.latitude);
38
+ const latitudeB = toRadians(pointB.latitude);
39
+ const a = Math.sin(latitudeDelta / 2) ** 2 +
40
+ Math.cos(latitudeA) * Math.cos(latitudeB) * Math.sin(longitudeDelta / 2) ** 2;
41
+ return 2 * earthRadiusMeters * Math.asin(Math.sqrt(a));
42
+ }
43
+ export function distanceBetweenCoordinatesSafe(pointA, pointB) {
44
+ try {
45
+ return ExpoGaodeMapModule.distanceBetweenCoordinates(pointA, pointB);
46
+ }
47
+ catch {
48
+ return haversineDistance(pointA, pointB);
49
+ }
50
+ }
51
+ export function calculatePathLengthSafe(points) {
52
+ try {
53
+ return ExpoGaodeMapModule.calculatePathLength(points);
54
+ }
55
+ catch {
56
+ let total = 0;
57
+ for (let index = 1; index < points.length; index += 1) {
58
+ total += distanceBetweenCoordinatesSafe(points[index - 1], points[index]);
59
+ }
60
+ return total;
61
+ }
62
+ }
63
+ export function simplifyPolylineSafe(points, tolerance) {
64
+ if (points.length <= 2) {
65
+ return points;
66
+ }
67
+ try {
68
+ const simplified = ExpoGaodeMapModule.simplifyPolyline(points, tolerance);
69
+ return simplified.length >= 2 ? simplified : points;
70
+ }
71
+ catch {
72
+ return points;
73
+ }
74
+ }
75
+ export function getDistanceToPathSafe(path, target) {
76
+ if (path.length === 0) {
77
+ return Number.POSITIVE_INFINITY;
78
+ }
79
+ try {
80
+ const nearest = ExpoGaodeMapModule.getNearestPointOnPath(path, target);
81
+ if (nearest) {
82
+ return nearest.distanceMeters;
83
+ }
84
+ }
85
+ catch {
86
+ // ignore and fallback to point-to-point scan
87
+ }
88
+ return path.reduce((minimum, point) => {
89
+ const distance = distanceBetweenCoordinatesSafe(point, target);
90
+ return distance < minimum ? distance : minimum;
91
+ }, Number.POSITIVE_INFINITY);
92
+ }
93
+ export function samplePolyline(points, targetSamples = 36) {
94
+ if (points.length <= targetSamples) {
95
+ return points;
96
+ }
97
+ const step = Math.max(1, Math.floor(points.length / targetSamples));
98
+ const samples = points.filter((_, index) => index % step === 0);
99
+ const lastPoint = points[points.length - 1];
100
+ const lastSample = samples[samples.length - 1];
101
+ if (!lastSample ||
102
+ lastSample.latitude !== lastPoint.latitude ||
103
+ lastSample.longitude !== lastPoint.longitude) {
104
+ samples.push(lastPoint);
105
+ }
106
+ return samples;
107
+ }
108
+ export function selectEvenlySpacedPoints(points, count) {
109
+ if (count <= 0 || points.length <= count) {
110
+ return points;
111
+ }
112
+ return Array.from({ length: count }, (_, index) => {
113
+ const rawIndex = Math.round(((index + 1) * (points.length + 1)) / (count + 1)) - 1;
114
+ const boundedIndex = Math.min(points.length - 1, Math.max(0, rawIndex));
115
+ return points[boundedIndex];
116
+ });
117
+ }
118
+ export function normalizeWebRoutePolyline(webRoute) {
119
+ const directPolyline = dedupeAdjacentPoints(webRoute.polyline ?? []);
120
+ if (directPolyline.length > 1) {
121
+ return directPolyline;
122
+ }
123
+ const stepPolyline = dedupeAdjacentPoints((webRoute.steps ?? []).flatMap((step) => step.polyline ?? []));
124
+ return stepPolyline;
125
+ }
126
+ export function buildAnchorWaypointsFromWebRoute(options) {
127
+ // 这一步的目标不是“还原原始 Web 线路”,而是从 Web 线路里抽出
128
+ // 少量、间距足够大的中间锚点,方便原生独立算路尽量贴近它。
129
+ const { webRoute, maxViaPoints = 8, simplifyTolerance = 80, minSpacingMeters = 800, } = options;
130
+ const polyline = normalizeWebRoutePolyline(webRoute);
131
+ if (polyline.length <= 2) {
132
+ return [];
133
+ }
134
+ const simplified = dedupeAdjacentPoints(simplifyPolylineSafe(polyline, simplifyTolerance));
135
+ const candidatePoints = simplified.length > 2 ? simplified : polyline;
136
+ const interiorPoints = candidatePoints.slice(1, -1);
137
+ // 优先用离前一个锚点足够远的点,避免途经点过密导致原生算路失真。
138
+ const spacedPoints = [];
139
+ let previousPoint = polyline[0];
140
+ for (const point of interiorPoints) {
141
+ if (distanceBetweenCoordinatesSafe(previousPoint, point) < minSpacingMeters) {
142
+ continue;
143
+ }
144
+ spacedPoints.push(point);
145
+ previousPoint = point;
146
+ }
147
+ const waypoints = spacedPoints.length > 0
148
+ ? spacedPoints
149
+ : candidatePoints.length > 2
150
+ ? [candidatePoints[Math.floor(candidatePoints.length / 2)]]
151
+ : [];
152
+ return dedupeAdjacentPoints(selectEvenlySpacedPoints(waypoints, maxViaPoints));
153
+ }
154
+ //# sourceMappingURL=route-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-geometry.js","sourceRoot":"","sources":["../src/route-geometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAQ3C,MAAM,UAAU,aAAa,CAAC,QAAiB;IAC7C,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ;SACZ,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SAChC,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACtF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,QAAQ;YACR,SAAS;SACV,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,KAAK,EAAsB,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;AAC3D,CAAC;AAGD,MAAM,UAAU,oBAAoB,CAAC,MAAmB;IACtD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACpC,IAAI,KAAK,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CAAC,wBAAwB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AACjF,CAAC","sourcesContent":["import { ExpoGaodeMapModule } from './map';\nimport type {\n BuildAnchorWaypointsOptions,\n NaviPoint,\n WebPlannedRoute,\n} from './types';\n\n\nexport function parsePolyline(polyline?: string): NaviPoint[] {\n if (!polyline?.trim()) {\n return [];\n }\n\n return polyline\n .split(';')\n .map((segment) => segment.trim())\n .filter(Boolean)\n .map((segment) => {\n const [longitude, latitude] = segment.split(',').map((value) => Number(value.trim()));\n if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {\n return null;\n }\n\n return {\n latitude,\n longitude,\n };\n })\n .filter((point): point is NaviPoint => point !== null);\n}\n\n\nexport function dedupeAdjacentPoints(points: NaviPoint[]): NaviPoint[] {\n return points.filter((point, index) => {\n if (index === 0) {\n return true;\n }\n\n const previous = points[index - 1];\n return (\n previous.latitude !== point.latitude ||\n previous.longitude !== point.longitude\n );\n });\n}\n\n\nexport function haversineDistance(pointA: NaviPoint, pointB: NaviPoint): number {\n const toRadians = (degrees: number) => (degrees * Math.PI) / 180;\n const earthRadiusMeters = 6371000;\n const latitudeDelta = toRadians(pointB.latitude - pointA.latitude);\n const longitudeDelta = toRadians(pointB.longitude - pointA.longitude);\n const latitudeA = toRadians(pointA.latitude);\n const latitudeB = toRadians(pointB.latitude);\n\n const a =\n Math.sin(latitudeDelta / 2) ** 2 +\n Math.cos(latitudeA) * Math.cos(latitudeB) * Math.sin(longitudeDelta / 2) ** 2;\n\n return 2 * earthRadiusMeters * Math.asin(Math.sqrt(a));\n}\n\nexport function distanceBetweenCoordinatesSafe(pointA: NaviPoint, pointB: NaviPoint): number {\n try {\n return ExpoGaodeMapModule.distanceBetweenCoordinates(pointA, pointB);\n } catch {\n return haversineDistance(pointA, pointB);\n }\n}\n\nexport function calculatePathLengthSafe(points: NaviPoint[]): number {\n try {\n return ExpoGaodeMapModule.calculatePathLength(points);\n } catch {\n let total = 0;\n for (let index = 1; index < points.length; index += 1) {\n total += distanceBetweenCoordinatesSafe(points[index - 1], points[index]);\n }\n return total;\n }\n}\n\nexport function simplifyPolylineSafe(points: NaviPoint[], tolerance: number): NaviPoint[] {\n if (points.length <= 2) {\n return points;\n }\n\n try {\n const simplified = ExpoGaodeMapModule.simplifyPolyline(points, tolerance);\n return simplified.length >= 2 ? simplified : points;\n } catch {\n return points;\n }\n}\n\nexport function getDistanceToPathSafe(path: NaviPoint[], target: NaviPoint): number {\n if (path.length === 0) {\n return Number.POSITIVE_INFINITY;\n }\n\n try {\n const nearest = ExpoGaodeMapModule.getNearestPointOnPath(path, target);\n if (nearest) {\n return nearest.distanceMeters;\n }\n } catch {\n // ignore and fallback to point-to-point scan\n }\n\n return path.reduce((minimum, point) => {\n const distance = distanceBetweenCoordinatesSafe(point, target);\n return distance < minimum ? distance : minimum;\n }, Number.POSITIVE_INFINITY);\n}\n\nexport function samplePolyline(points: NaviPoint[], targetSamples = 36): NaviPoint[] {\n if (points.length <= targetSamples) {\n return points;\n }\n\n const step = Math.max(1, Math.floor(points.length / targetSamples));\n const samples = points.filter((_, index) => index % step === 0);\n const lastPoint = points[points.length - 1];\n const lastSample = samples[samples.length - 1];\n if (\n !lastSample ||\n lastSample.latitude !== lastPoint.latitude ||\n lastSample.longitude !== lastPoint.longitude\n ) {\n samples.push(lastPoint);\n }\n return samples;\n}\n\nexport function selectEvenlySpacedPoints(points: NaviPoint[], count: number): NaviPoint[] {\n if (count <= 0 || points.length <= count) {\n return points;\n }\n\n return Array.from({ length: count }, (_, index) => {\n const rawIndex = Math.round(((index + 1) * (points.length + 1)) / (count + 1)) - 1;\n const boundedIndex = Math.min(points.length - 1, Math.max(0, rawIndex));\n return points[boundedIndex];\n });\n}\n\nexport function normalizeWebRoutePolyline(webRoute: WebPlannedRoute): NaviPoint[] {\n const directPolyline = dedupeAdjacentPoints(webRoute.polyline ?? []);\n if (directPolyline.length > 1) {\n return directPolyline;\n }\n\n const stepPolyline = dedupeAdjacentPoints(\n (webRoute.steps ?? []).flatMap((step) => step.polyline ?? [])\n );\n return stepPolyline;\n}\n\nexport function buildAnchorWaypointsFromWebRoute(\n options: BuildAnchorWaypointsOptions\n): NaviPoint[] {\n // 这一步的目标不是“还原原始 Web 线路”,而是从 Web 线路里抽出\n // 少量、间距足够大的中间锚点,方便原生独立算路尽量贴近它。\n const {\n webRoute,\n maxViaPoints = 8,\n simplifyTolerance = 80,\n minSpacingMeters = 800,\n } = options;\n\n const polyline = normalizeWebRoutePolyline(webRoute);\n if (polyline.length <= 2) {\n return [];\n }\n\n const simplified = dedupeAdjacentPoints(\n simplifyPolylineSafe(polyline, simplifyTolerance)\n );\n const candidatePoints = simplified.length > 2 ? simplified : polyline;\n const interiorPoints = candidatePoints.slice(1, -1);\n\n // 优先用离前一个锚点足够远的点,避免途经点过密导致原生算路失真。\n const spacedPoints: NaviPoint[] = [];\n let previousPoint = polyline[0];\n\n for (const point of interiorPoints) {\n if (distanceBetweenCoordinatesSafe(previousPoint, point) < minSpacingMeters) {\n continue;\n }\n spacedPoints.push(point);\n previousPoint = point;\n }\n\n const waypoints = spacedPoints.length > 0\n ? spacedPoints\n : candidatePoints.length > 2\n ? [candidatePoints[Math.floor(candidatePoints.length / 2)]]\n : [];\n\n return dedupeAdjacentPoints(selectEvenlySpacedPoints(waypoints, maxViaPoints));\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { ClearIndependentRouteOptions, DriveRouteOptions, DriveRouteResult, EBikeRouteOptions, IndependentDriveRouteOptions, IndependentMotorcycleRouteOptions, IndependentRideRouteOptions, IndependentTruckRouteOptions, IndependentWalkRouteOptions, MotorcycleRouteOptions, OfficialNaviPageOptions, RouteOptions, RouteResult, SelectIndependentRouteOptions, StartNaviWithIndependentPathOptions, TransitRouteOptions, TruckRouteOptions, WalkRouteOptions, RideRouteOptions } from './types';
2
+ export declare const initNavigation: () => void;
3
+ export declare const destroyAllCalculators: () => void;
4
+ export declare function calculateDriveRoute(options: DriveRouteOptions): Promise<DriveRouteResult>;
5
+ export declare const calculateWalkRoute: (options: WalkRouteOptions) => Promise<RouteResult>;
6
+ export declare const calculateRideRoute: (options: RideRouteOptions) => Promise<RouteResult>;
7
+ export declare const calculateEBikeRoute: (options: EBikeRouteOptions) => Promise<RouteResult>;
8
+ export declare const calculateTruckRoute: (options: TruckRouteOptions) => Promise<DriveRouteResult>;
9
+ export declare const calculateMotorcycleRoute: (options: MotorcycleRouteOptions) => Promise<DriveRouteResult>;
10
+ export declare function calculateTransitRoute(options: TransitRouteOptions): Promise<DriveRouteResult>;
11
+ export declare function calculateRoute(options: RouteOptions): Promise<RouteResult | DriveRouteResult>;
12
+ export declare const independentDriveRoute: (options: IndependentDriveRouteOptions) => Promise<import("./types").IndependentRouteResult>;
13
+ export declare const independentTruckRoute: (options: IndependentTruckRouteOptions) => Promise<import("./types").IndependentRouteResult>;
14
+ export declare const independentWalkRoute: (options: IndependentWalkRouteOptions) => Promise<import("./types").IndependentRouteResult>;
15
+ export declare const independentRideRoute: (options: IndependentRideRouteOptions) => Promise<import("./types").IndependentRouteResult>;
16
+ export declare const independentMotorcycleRoute: (options: IndependentMotorcycleRouteOptions) => Promise<import("./types").IndependentRouteResult>;
17
+ export declare const selectIndependentRoute: (options: SelectIndependentRouteOptions) => Promise<boolean>;
18
+ export declare const startNaviWithIndependentPath: (options: StartNaviWithIndependentPathOptions) => Promise<boolean>;
19
+ export declare const openOfficialNaviPage: (options: OfficialNaviPageOptions) => Promise<boolean>;
20
+ export declare const clearIndependentRoute: (options: ClearIndependentRouteOptions) => Promise<boolean>;
21
+ //# sourceMappingURL=route-planning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-planning.d.ts","sourceRoot":"","sources":["../src/route-planning.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5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AAmC,qBACrB,CAAC;AAErE,eAAO,MAAM,oBAAoB,GAAI,SAAS,uBAAuB,qBACT,CAAC;AAE7D,eAAO,MAAM,qBAAqB,GAAI,SAAS,4BAA4B,qBACd,CAAC"}
@@ -0,0 +1,67 @@
1
+ import ExpoGaodeMapNavigationModule from './ExpoGaodeMapNavigationModule';
2
+ import { calculateDriveRouteWithAvoidPreview, calculateTransitRouteWithWebApi, shouldUseAvoidPreviewFallback, } from './web-api-fallback';
3
+ import { RouteType } from './types';
4
+ export const initNavigation = () => ExpoGaodeMapNavigationModule.initNavigation();
5
+ export const destroyAllCalculators = () => ExpoGaodeMapNavigationModule.destroyAllCalculators();
6
+ export async function calculateDriveRoute(options) {
7
+ // 驾车算路先检查是否需要规避预览;只有在这类场景下才临时回退 Web API。
8
+ if (shouldUseAvoidPreviewFallback(options)) {
9
+ try {
10
+ return await calculateDriveRouteWithAvoidPreview(options);
11
+ }
12
+ catch {
13
+ // 若未安装 Web API 包,则保持现有原生逻辑不变。
14
+ // 这样不会破坏当前依赖 Android 反射重载的项目。
15
+ }
16
+ }
17
+ return ExpoGaodeMapNavigationModule.calculateDriveRoute(options);
18
+ }
19
+ export const calculateWalkRoute = (options) => ExpoGaodeMapNavigationModule.calculateWalkRoute(options);
20
+ export const calculateRideRoute = (options) => ExpoGaodeMapNavigationModule.calculateRideRoute(options);
21
+ export const calculateEBikeRoute = (options) => ExpoGaodeMapNavigationModule.calculateEBikeRoute(options);
22
+ export const calculateTruckRoute = (options) => ExpoGaodeMapNavigationModule.calculateTruckRoute(options);
23
+ export const calculateMotorcycleRoute = (options) => ExpoGaodeMapNavigationModule.calculateMotorcycleRoute(options);
24
+ export async function calculateTransitRoute(options) {
25
+ return calculateTransitRouteWithWebApi(options);
26
+ }
27
+ function hasStrategyOption(options) {
28
+ return 'strategy' in options;
29
+ }
30
+ function isMotorcycleRouteOptions(options) {
31
+ return 'motorcycleCC' in options;
32
+ }
33
+ export async function calculateRoute(options) {
34
+ // 这里是统一入口,按“最明确的类型特征”逐层分流。
35
+ // 顺序很重要:先看显式 type,再看货车 / 步骑 / 摩托车,最后才回到默认驾车。
36
+ if ('type' in options && options.type === RouteType.TRANSIT) {
37
+ return calculateTransitRoute(options);
38
+ }
39
+ if ('size' in options) {
40
+ return calculateTruckRoute(options);
41
+ }
42
+ if ('multiple' in options || 'travelStrategy' in options) {
43
+ // 电动车 / 步行 / 骑行这几类在 JS 层会共享部分字段,先用 usePoi 做电动车识别。
44
+ if ('usePoi' in options)
45
+ return ExpoGaodeMapNavigationModule.calculateEBikeRoute(options);
46
+ // 骑行和步行的区分主要看 strategy 值;其余情况默认按步行处理。
47
+ const strategy = hasStrategyOption(options) ? options.strategy : undefined;
48
+ if (strategy === 0 || strategy === 1) {
49
+ return calculateRideRoute(options);
50
+ }
51
+ return calculateWalkRoute(options);
52
+ }
53
+ if (isMotorcycleRouteOptions(options)) {
54
+ return calculateMotorcycleRoute(options);
55
+ }
56
+ return calculateDriveRoute(options);
57
+ }
58
+ export const independentDriveRoute = (options) => ExpoGaodeMapNavigationModule.independentDriveRoute(options);
59
+ export const independentTruckRoute = (options) => ExpoGaodeMapNavigationModule.independentTruckRoute(options);
60
+ export const independentWalkRoute = (options) => ExpoGaodeMapNavigationModule.independentWalkRoute(options);
61
+ export const independentRideRoute = (options) => ExpoGaodeMapNavigationModule.independentRideRoute(options);
62
+ export const independentMotorcycleRoute = (options) => ExpoGaodeMapNavigationModule.independentMotorcycleRoute(options);
63
+ export const selectIndependentRoute = (options) => ExpoGaodeMapNavigationModule.selectIndependentRoute(options);
64
+ export const startNaviWithIndependentPath = (options) => ExpoGaodeMapNavigationModule.startNaviWithIndependentPath(options);
65
+ export const openOfficialNaviPage = (options) => ExpoGaodeMapNavigationModule.openOfficialNaviPage(options);
66
+ export const clearIndependentRoute = (options) => ExpoGaodeMapNavigationModule.clearIndependentRoute(options);
67
+ //# sourceMappingURL=route-planning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-planning.js","s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eMapNavigationModule';\nimport {\n calculateDriveRouteWithAvoidPreview,\n calculateTransitRouteWithWebApi,\n shouldUseAvoidPreviewFallback,\n} from './web-api-fallback';\nimport type {\n ClearIndependentRouteOptions,\n DriveRouteOptions,\n DriveRouteResult,\n EBikeRouteOptions,\n IndependentDriveRouteOptions,\n IndependentMotorcycleRouteOptions,\n IndependentRideRouteOptions,\n IndependentTruckRouteOptions,\n IndependentWalkRouteOptions,\n MotorcycleRouteOptions,\n OfficialNaviPageOptions,\n RouteOptions,\n RouteResult,\n SelectIndependentRouteOptions,\n StartNaviWithIndependentPathOptions,\n TransitRouteOptions,\n TruckRouteOptions,\n WalkRouteOptions,\n RideRouteOptions,\n} from './types';\nimport { RouteType } from './types';\n\nexport const initNavigation = () => ExpoGaodeMapNavigationModule.initNavigation();\n\nexport const destroyAllCalculators = () => ExpoGaodeMapNavigationModule.destroyAllCalculators();\n\nexport async function calculateDriveRoute(\n options: DriveRouteOptions\n): Promise<DriveRouteResult> {\n // 驾车算路先检查是否需要规避预览;只有在这类场景下才临时回退 Web API。\n if (shouldUseAvoidPreviewFallback(options)) {\n try {\n return await calculateDriveRouteWithAvoidPreview(options);\n } catch {\n // 若未安装 Web API 包,则保持现有原生逻辑不变。\n // 这样不会破坏当前依赖 Android 反射重载的项目。\n }\n }\n\n return ExpoGaodeMapNavigationModule.calculateDriveRoute(options);\n}\n\nexport const calculateWalkRoute = (options: WalkRouteOptions) =>\n ExpoGaodeMapNavigationModule.calculateWalkRoute(options);\n\nexport const calculateRideRoute = (options: RideRouteOptions) =>\n ExpoGaodeMapNavigationModule.calculateRideRoute(options);\n\nexport const calculateEBikeRoute = (options: EBikeRouteOptions) =>\n ExpoGaodeMapNavigationModule.calculateEBikeRoute(options);\n\nexport const calculateTruckRoute = (options: TruckRouteOptions) =>\n ExpoGaodeMapNavigationModule.calculateTruckRoute(options);\n\nexport const calculateMotorcycleRoute = (options: MotorcycleRouteOptions) =>\n ExpoGaodeMapNavigationModule.calculateMotorcycleRoute(options);\n\nexport async function calculateTransitRoute(options: TransitRouteOptions): Promise<DriveRouteResult> {\n return calculateTransitRouteWithWebApi(options);\n}\n\nfunction hasStrategyOption(\n options: RouteOptions\n): options is WalkRouteOptions | RideRouteOptions {\n return 'strategy' in options;\n}\n\nfunction isMotorcycleRouteOptions(\n options: RouteOptions | MotorcycleRouteOptions\n): options is MotorcycleRouteOptions {\n return 'motorcycleCC' in options;\n}\n\nexport async function calculateRoute(\n options: RouteOptions\n): Promise<RouteResult | DriveRouteResult> {\n // 这里是统一入口,按“最明确的类型特征”逐层分流。\n // 顺序很重要:先看显式 type,再看货车 / 步骑 / 摩托车,最后才回到默认驾车。\n if ('type' in options && options.type === RouteType.TRANSIT) {\n return calculateTransitRoute(options as TransitRouteOptions);\n }\n\n if ('size' in options) {\n return calculateTruckRoute(options as TruckRouteOptions);\n }\n\n if ('multiple' in options || 'travelStrategy' in options) {\n // 电动车 / 步行 / 骑行这几类在 JS 层会共享部分字段,先用 usePoi 做电动车识别。\n if ('usePoi' in options) return ExpoGaodeMapNavigationModule.calculateEBikeRoute(options as EBikeRouteOptions);\n\n // 骑行和步行的区分主要看 strategy 值;其余情况默认按步行处理。\n const strategy = hasStrategyOption(options) ? options.strategy : undefined;\n if (strategy === 0 || strategy === 1) {\n return calculateRideRoute(options as RideRouteOptions);\n }\n return calculateWalkRoute(options as WalkRouteOptions);\n }\n\n if (isMotorcycleRouteOptions(options)) {\n return calculateMotorcycleRoute(options as MotorcycleRouteOptions);\n }\n\n return calculateDriveRoute(options as DriveRouteOptions);\n}\n\nexport const independentDriveRoute = (options: IndependentDriveRouteOptions) =>\n ExpoGaodeMapNavigationModule.independentDriveRoute(options);\n\nexport const independentTruckRoute = (options: IndependentTruckRouteOptions) =>\n ExpoGaodeMapNavigationModule.independentTruckRoute(options);\n\nexport const independentWalkRoute = (options: IndependentWalkRouteOptions) =>\n ExpoGaodeMapNavigationModule.independentWalkRoute(options);\n\nexport const independentRideRoute = (options: IndependentRideRouteOptions) =>\n ExpoGaodeMapNavigationModule.independentRideRoute(options);\n\nexport const independentMotorcycleRoute = (options: IndependentMotorcycleRouteOptions) =>\n ExpoGaodeMapNavigationModule.independentMotorcycleRoute(options);\n\nexport const selectIndependentRoute = (options: SelectIndependentRouteOptions) =>\n ExpoGaodeMapNavigationModule.selectIndependentRoute(options);\n\nexport const startNaviWithIndependentPath = (options: StartNaviWithIndependentPathOptions) =>\n ExpoGaodeMapNavigationModule.startNaviWithIndependentPath(options);\n\nexport const openOfficialNaviPage = (options: OfficialNaviPageOptions) =>\n ExpoGaodeMapNavigationModule.openOfficialNaviPage(options);\n\nexport const clearIndependentRoute = (options: ClearIndependentRouteOptions) =>\n ExpoGaodeMapNavigationModule.clearIndependentRoute(options);\n"]}
@@ -0,0 +1,5 @@
1
+ import type { DriveRouteOptions, DriveRouteResult, TransitRouteOptions } from './types';
2
+ export declare function shouldUseAvoidPreviewFallback(options: DriveRouteOptions): boolean;
3
+ export declare function calculateDriveRouteWithAvoidPreview(options: DriveRouteOptions): Promise<DriveRouteResult>;
4
+ export declare function calculateTransitRouteWithWebApi(options: TransitRouteOptions): Promise<DriveRouteResult>;
5
+ //# sourceMappingURL=web-api-fallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-api-fallback.d.ts","sourceRoot":"","sources":["../src/web-api-fallback.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAe,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAsHrG,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAIjF;AAED,wBAAsB,mCAAmC,CACvD,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAqB3B;AAoCD,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAkB3B"}
@@ -0,0 +1,160 @@
1
+ import { DriveStrategy } from './types';
2
+ import { parsePolyline } from './route-geometry';
3
+ async function loadWebApiFallback(feature) {
4
+ try {
5
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
6
+ const webApi = require('expo-gaode-map-web-api');
7
+ if (typeof webApi?.GaodeWebAPI !== 'function') {
8
+ throw new Error('expo-gaode-map-web-api 未导出 GaodeWebAPI');
9
+ }
10
+ return webApi;
11
+ }
12
+ catch {
13
+ throw new Error(`${feature}依赖 expo-gaode-map-web-api。请安装该包,并在 ExpoGaodeMapModule.initSDK 中提供 webKey。`);
14
+ }
15
+ }
16
+ function normalizeAvoidPolygons(polygons) {
17
+ if (!polygons?.length) {
18
+ return undefined;
19
+ }
20
+ const normalized = polygons
21
+ .map((polygon) => polygon
22
+ .map((point) => `${point.longitude},${point.latitude}`)
23
+ .join(';'))
24
+ .filter(Boolean)
25
+ .join('|');
26
+ return normalized || undefined;
27
+ }
28
+ function normalizeDrivingStrategy(strategy) {
29
+ // 导航 SDK 与 Web API 的策略枚举不完全一致。
30
+ // 这里做“尽量等价”的映射,主要用于带规避参数时的路线预览。
31
+ switch (strategy) {
32
+ case DriveStrategy.FASTEST:
33
+ return 38;
34
+ case DriveStrategy.FEE_FIRST:
35
+ return 1;
36
+ case DriveStrategy.SHORTEST:
37
+ return 2;
38
+ case DriveStrategy.NO_EXPRESSWAYS:
39
+ return 37;
40
+ case DriveStrategy.AVOID_CONGESTION:
41
+ return 33;
42
+ case DriveStrategy.NO_HIGHWAY:
43
+ return 35;
44
+ case DriveStrategy.NO_HIGHWAY_AVOID_CONGESTION:
45
+ return 40;
46
+ case DriveStrategy.AVOID_COST_CONGESTION:
47
+ case DriveStrategy.AVOID_CONGESTION_COST:
48
+ return 41;
49
+ case DriveStrategy.NO_HIGHWAY_AVOID_COST_CONGESTION:
50
+ return 43;
51
+ default:
52
+ return undefined;
53
+ }
54
+ }
55
+ function normalizeDrivingRouteResult(options, result) {
56
+ // 把 Web API 的原始字段翻译成导航包已经对外稳定的 RouteResult 结构。
57
+ // 这样上层代码不需要知道 Web API 的字段名,也不用为 fallback 单独写分支。
58
+ const paths = result?.route?.paths ?? [];
59
+ const routes = paths.map((path, index) => {
60
+ const segments = (path?.steps ?? []).map((step) => ({
61
+ instruction: step?.instruction ?? '',
62
+ orientation: step?.orientation,
63
+ road: step?.road_name,
64
+ distance: Number(step?.step_distance ?? 0),
65
+ duration: Number(step?.cost?.duration ?? 0),
66
+ polyline: parsePolyline(step?.polyline),
67
+ assistantAction: step?.assistant_action,
68
+ tollDistance: step?.cost?.toll_distance ? Number(step.cost.toll_distance) : undefined,
69
+ tollCost: step?.cost?.tolls ? Number(step.cost.tolls) : undefined,
70
+ }));
71
+ const restrictionCode = path?.restriction != null ? Number(path.restriction) : undefined;
72
+ return {
73
+ id: index,
74
+ start: options.from,
75
+ end: options.to,
76
+ distance: Number(path?.distance ?? 0),
77
+ duration: Number(path?.cost?.duration ?? path?.duration ?? 0),
78
+ segments,
79
+ polyline: segments.flatMap((segment) => segment.polyline),
80
+ tollDistance: path?.cost?.toll_distance ? Number(path.cost.toll_distance) : undefined,
81
+ tollCost: path?.cost?.tolls ? Number(path.cost.tolls) : undefined,
82
+ trafficLightCount: path?.cost?.traffic_lights ? Number(path.cost.traffic_lights) : undefined,
83
+ restrictionCode,
84
+ restrictionInfo: restrictionCode === 0
85
+ ? '限行已规避或未限行'
86
+ : restrictionCode === 1
87
+ ? '限行无法规避'
88
+ : undefined,
89
+ strategy: options.strategy,
90
+ };
91
+ });
92
+ return {
93
+ count: Number(result?.count ?? routes.length),
94
+ mainPathIndex: 0,
95
+ routeIds: routes.map((route) => route.id),
96
+ routes,
97
+ taxiCost: result?.route?.taxi_cost ? Number(result.route.taxi_cost) : undefined,
98
+ };
99
+ }
100
+ export function shouldUseAvoidPreviewFallback(options) {
101
+ // 只有出现“规避道路 / 规避区域”时才需要走 Web API 预览。
102
+ // 普通驾车算路仍然优先走原生能力。
103
+ return Boolean(options.avoidRoad?.trim() || options.avoidPolygons?.length);
104
+ }
105
+ export async function calculateDriveRouteWithAvoidPreview(options) {
106
+ // Web API 只负责“预览规避后的路线”,不是替代原生导航 SDK。
107
+ // 失败时让调用方回退到原生实现,避免把可用路径规划直接变成报错。
108
+ const { GaodeWebAPI } = await loadWebApiFallback('规避路线预览');
109
+ const api = new GaodeWebAPI();
110
+ const result = await api.route.driving(`${options.from.longitude},${options.from.latitude}`, `${options.to.longitude},${options.to.latitude}`, {
111
+ strategy: normalizeDrivingStrategy(options.strategy),
112
+ waypoints: options.waypoints?.map((point) => `${point.longitude},${point.latitude}`),
113
+ avoidpolygons: normalizeAvoidPolygons(options.avoidPolygons),
114
+ avoidroad: options.avoidRoad?.trim() || undefined,
115
+ plate: options.carNumber,
116
+ show_fields: 'cost,navi,polyline',
117
+ });
118
+ return normalizeDrivingRouteResult(options, result);
119
+ }
120
+ function normalizeTransitRouteResult(options, result) {
121
+ // 导航包内部仍保持独立实现;
122
+ // 这里只是在“公交无法由导航 SDK 直算”时,把 Web API 结果映射成现有 RouteResult 形状。
123
+ const routes = (result?.route?.transits ?? []).map((transit, index) => {
124
+ const polyline = (transit?.segments ?? []).flatMap((segment) => [
125
+ ...(segment.walking?.steps?.flatMap((step) => parsePolyline(step.polyline)) ?? []),
126
+ ...(segment.bus?.buslines?.flatMap((line) => parsePolyline(line.polyline)) ?? []),
127
+ ...(segment.railway?.buslines?.flatMap((line) => parsePolyline(line.polyline)) ?? []),
128
+ ]);
129
+ return {
130
+ id: index,
131
+ start: options.from,
132
+ end: options.to,
133
+ distance: Number(transit?.distance ?? 0),
134
+ duration: Number(transit?.cost?.duration ?? 0),
135
+ segments: [],
136
+ polyline,
137
+ tollDistance: 0,
138
+ tollCost: Number(transit?.cost?.transit_fee ?? 0),
139
+ strategy: options.strategy,
140
+ };
141
+ });
142
+ return {
143
+ count: routes.length,
144
+ mainPathIndex: 0,
145
+ routes,
146
+ };
147
+ }
148
+ export async function calculateTransitRouteWithWebApi(options) {
149
+ // 公交换乘在当前 SDK 能力下统一回退到 Web API,再映射成同一份路线结构。
150
+ // 运行时按需加载,避免把 navigation 包和 web-api 包在构建期强绑定。
151
+ const { GaodeWebAPI, TransitStrategy } = await loadWebApiFallback('公交路径规划');
152
+ const api = new GaodeWebAPI();
153
+ const result = await api.route.transit(`${options.from.longitude},${options.from.latitude}`, `${options.to.longitude},${options.to.latitude}`, options.city1, options.city2, {
154
+ strategy: options.strategy ?? TransitStrategy.RECOMMENDED,
155
+ AlternativeRoute: options.alternativeRoute,
156
+ show_fields: 'cost,polyline',
157
+ });
158
+ return normalizeTransitRouteResult(options, result);
159
+ }
160
+ //# sourceMappingURL=web-api-fallback.js.map