react-native-brouter 0.0.1
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.
- package/LICENSE +20 -0
- package/README.md +125 -0
- package/android/build.gradle +110 -0
- package/android/generated/java/com/jhotadhari/reactnative/brouter/NativeBRouterSpec.java +39 -0
- package/android/generated/jni/CMakeLists.txt +28 -0
- package/android/generated/jni/RNBRouterSpec-generated.cpp +32 -0
- package/android/generated/jni/RNBRouterSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNBRouterSpec/RNBRouterSpecJSI.h +38 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/aidl/btools/routingapp/IBRouterService.aidl +47 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterClient.java +205 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterError.java +38 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterModule.java +135 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterPackage.kt +33 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterServiceConnection.java +54 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/ParamMapper.java +174 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/BRouterClientTest.java +247 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/BRouterErrorTest.java +48 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/BRouterModuleTest.java +137 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/ParamMapperTest.java +279 -0
- package/lib/module/NativeBRouter.js +5 -0
- package/lib/module/NativeBRouter.js.map +1 -0
- package/lib/module/geojson/index.js +235 -0
- package/lib/module/geojson/index.js.map +1 -0
- package/lib/module/index.js +297 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/release.config.d.ts +11 -0
- package/lib/typescript/release.config.d.ts.map +1 -0
- package/lib/typescript/src/NativeBRouter.d.ts +9 -0
- package/lib/typescript/src/NativeBRouter.d.ts.map +1 -0
- package/lib/typescript/src/geojson/index.d.ts +122 -0
- package/lib/typescript/src/geojson/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +13 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +93 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +159 -0
- package/react-native.config.js +12 -0
- package/src/NativeBRouter.ts +8 -0
- package/src/geojson/index.ts +371 -0
- package/src/index.tsx +344 -0
- package/src/types.ts +112 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeBRouter.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAMlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GeoJSON-friendly API for react-native-brouter.
|
|
5
|
+
*
|
|
6
|
+
* This layer accepts GeoJSON {@link Position} arrays for waypoints and
|
|
7
|
+
* nogo areas, and returns results that integrate naturally with
|
|
8
|
+
* `@turf/turf` and other GeoJSON tooling.
|
|
9
|
+
*
|
|
10
|
+
* ## Usage
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { getRoute } from 'react-native-brouter/geojson';
|
|
14
|
+
*
|
|
15
|
+
* const result = await getRoute({
|
|
16
|
+
* waypoints: [[-71.04, -13.95], [-70.90, -13.79]],
|
|
17
|
+
* vehicle: 'bicycle',
|
|
18
|
+
* format: 'json',
|
|
19
|
+
* });
|
|
20
|
+
* // result.parsed.track → GeoJSON FeatureCollection
|
|
21
|
+
* // result.parsed.waypoints → FeatureCollection of waypoint points
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @module geojson
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { getRoute as coreGetRoute } from "../index.js";
|
|
28
|
+
|
|
29
|
+
// Re-export GeoJSON Position so consumers don't need their own @types/geojson
|
|
30
|
+
|
|
31
|
+
// ── GeoJSON-specific types ──────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
// ── Helpers ─────────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Parse a BRouter JSON track result into a typed GeoJSON structure.
|
|
37
|
+
*
|
|
38
|
+
* BRouter's JSON output format is a plain array of feature objects
|
|
39
|
+
* (not a proper FeatureCollection). This normalizes it.
|
|
40
|
+
*/
|
|
41
|
+
function parseJsonTrack(raw, waypoints) {
|
|
42
|
+
const parsed = JSON.parse(raw);
|
|
43
|
+
|
|
44
|
+
// BRouter may return a bare array of features or a FeatureCollection
|
|
45
|
+
// wrapper. Handle both shapes.
|
|
46
|
+
let features;
|
|
47
|
+
if (Array.isArray(parsed)) {
|
|
48
|
+
features = parsed;
|
|
49
|
+
} else if (parsed != null && typeof parsed === 'object' && 'features' in parsed && Array.isArray(parsed.features)) {
|
|
50
|
+
features = parsed.features;
|
|
51
|
+
} else {
|
|
52
|
+
throw new Error('Unexpected BRouter JSON shape: ' + typeof parsed);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Separate track features from waypoint features
|
|
56
|
+
const trackFeatures = [];
|
|
57
|
+
let totalDistanceMeters;
|
|
58
|
+
let totalDurationSeconds;
|
|
59
|
+
let ascentMeters;
|
|
60
|
+
let descentMeters;
|
|
61
|
+
let trackPointCount = 0;
|
|
62
|
+
for (let fi = 0; fi < features.length; fi++) {
|
|
63
|
+
const feature = features[fi];
|
|
64
|
+
if (feature.geometry.type === 'LineString') {
|
|
65
|
+
const coords = feature.geometry.coordinates;
|
|
66
|
+
trackFeatures.push({
|
|
67
|
+
type: 'Feature',
|
|
68
|
+
geometry: {
|
|
69
|
+
type: 'LineString',
|
|
70
|
+
coordinates: coords
|
|
71
|
+
},
|
|
72
|
+
properties: feature.properties
|
|
73
|
+
});
|
|
74
|
+
trackPointCount += coords.length;
|
|
75
|
+
|
|
76
|
+
// Extract summary from feature properties
|
|
77
|
+
if (feature.properties['track-length'] != null) {
|
|
78
|
+
totalDistanceMeters = Number(feature.properties['track-length']);
|
|
79
|
+
}
|
|
80
|
+
if (feature.properties['total-time'] != null) {
|
|
81
|
+
totalDurationSeconds = Number(feature.properties['total-time']);
|
|
82
|
+
}
|
|
83
|
+
if (feature.properties['filtered ascend'] != null) {
|
|
84
|
+
ascentMeters = Number(feature.properties['filtered ascend']);
|
|
85
|
+
}
|
|
86
|
+
if (feature.properties['plain-descent'] != null) {
|
|
87
|
+
descentMeters = Number(feature.properties['plain-descent']);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const waypointFeatures = waypoints.map((pos, i) => ({
|
|
92
|
+
type: 'Feature',
|
|
93
|
+
geometry: {
|
|
94
|
+
type: 'Point',
|
|
95
|
+
coordinates: pos
|
|
96
|
+
},
|
|
97
|
+
properties: {
|
|
98
|
+
index: i
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
return {
|
|
102
|
+
track: {
|
|
103
|
+
type: 'FeatureCollection',
|
|
104
|
+
features: trackFeatures
|
|
105
|
+
},
|
|
106
|
+
waypoints: {
|
|
107
|
+
type: 'FeatureCollection',
|
|
108
|
+
features: waypointFeatures
|
|
109
|
+
},
|
|
110
|
+
summary: {
|
|
111
|
+
totalDistanceMeters,
|
|
112
|
+
totalDurationSeconds,
|
|
113
|
+
ascentMeters,
|
|
114
|
+
descentMeters,
|
|
115
|
+
trackPointCount
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ── Public API ──────────────────────────────────────────────────────
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Request a route from the BRouter Android app using GeoJSON types.
|
|
124
|
+
*
|
|
125
|
+
* Converts GeoJSON {@link Position} arrays to the internal format,
|
|
126
|
+
* calls the native BRouter service, and returns a result that
|
|
127
|
+
* includes parsed GeoJSON structures when `format` is `'json'`.
|
|
128
|
+
*
|
|
129
|
+
* @throws {BRouterError} if the request is invalid or BRouter fails.
|
|
130
|
+
*/
|
|
131
|
+
export async function getRoute(request) {
|
|
132
|
+
// Convert GeoJSON positions to core Waypoint[]
|
|
133
|
+
const coreWaypoints = request.waypoints.map(pos => ({
|
|
134
|
+
position: [pos[0], pos[1]]
|
|
135
|
+
}));
|
|
136
|
+
const coreRequest = {
|
|
137
|
+
waypoints: coreWaypoints,
|
|
138
|
+
profile: request.profile,
|
|
139
|
+
remoteProfile: request.remoteProfile,
|
|
140
|
+
vehicle: request.vehicle,
|
|
141
|
+
fast: request.fast,
|
|
142
|
+
format: request.format,
|
|
143
|
+
alternativeIndex: request.alternativeIndex,
|
|
144
|
+
nogos: request.nogos,
|
|
145
|
+
exportWaypoints: request.exportWaypoints,
|
|
146
|
+
heading: request.heading,
|
|
147
|
+
direction: request.direction,
|
|
148
|
+
elevation: request.elevation,
|
|
149
|
+
maxRunningTime: request.maxRunningTime,
|
|
150
|
+
connectTimeout: request.connectTimeout,
|
|
151
|
+
pathToFileResult: request.pathToFileResult,
|
|
152
|
+
acceptCompressedResult: request.acceptCompressedResult,
|
|
153
|
+
extraParams: request.extraParams
|
|
154
|
+
};
|
|
155
|
+
const result = await coreGetRoute(coreRequest);
|
|
156
|
+
const geoResult = {
|
|
157
|
+
raw: result.raw,
|
|
158
|
+
format: result.format
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// Parse JSON result into typed GeoJSON
|
|
162
|
+
if (result.format === 'json') {
|
|
163
|
+
try {
|
|
164
|
+
geoResult.parsed = parseJsonTrack(result.raw, request.waypoints);
|
|
165
|
+
} catch (e) {
|
|
166
|
+
console.warn('Failed to parse BRouter JSON track:', e instanceof Error ? e.message : String(e));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return geoResult;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Convert a GeoJSON {@link Polygon} or {@link MultiPolygon} into an array
|
|
174
|
+
* of {@link NogoArea} entries suitable for use in
|
|
175
|
+
* {@link GeoJSONRouteRequest.nogos}.
|
|
176
|
+
*
|
|
177
|
+
* Uses a bounding-circle approximation: the polygon's centroid becomes
|
|
178
|
+
* the nogo center, and the farthest vertex distance becomes the radius.
|
|
179
|
+
*
|
|
180
|
+
* This is a utility for consumers — it is not called automatically.
|
|
181
|
+
*
|
|
182
|
+
* ## Usage with turf
|
|
183
|
+
*
|
|
184
|
+
* ```ts
|
|
185
|
+
* import { polygonToNogoAreas } from 'react-native-brouter/geojson';
|
|
186
|
+
* import turfBboxPolygon from '@turf/bbox-polygon';
|
|
187
|
+
*
|
|
188
|
+
* const bboxPoly = turfBboxPolygon([lng1, lat1, lng2, lat2]);
|
|
189
|
+
* const nogos = polygonToNogoAreas(bboxPoly.geometry);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export function polygonToNogoAreas(geometry, weight) {
|
|
193
|
+
const result = [];
|
|
194
|
+
|
|
195
|
+
// Normalize to an array of polygon rings
|
|
196
|
+
const polygons = geometry.type === 'Polygon' ? [geometry.coordinates] : geometry.coordinates;
|
|
197
|
+
for (let pi = 0; pi < polygons.length; pi++) {
|
|
198
|
+
const rings = polygons[pi];
|
|
199
|
+
const outerRing = rings[0];
|
|
200
|
+
if (!outerRing || outerRing.length === 0) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Compute centroid (average of all vertices)
|
|
205
|
+
let sumLng = 0;
|
|
206
|
+
let sumLat = 0;
|
|
207
|
+
for (let oi = 0; oi < outerRing.length; oi++) {
|
|
208
|
+
const pos = outerRing[oi];
|
|
209
|
+
sumLng += pos[0];
|
|
210
|
+
sumLat += pos[1];
|
|
211
|
+
}
|
|
212
|
+
const centerLng = sumLng / outerRing.length;
|
|
213
|
+
const centerLat = sumLat / outerRing.length;
|
|
214
|
+
|
|
215
|
+
// Compute max distance from centroid to any vertex as radius
|
|
216
|
+
let maxDist = 0;
|
|
217
|
+
for (let oi = 0; oi < outerRing.length; oi++) {
|
|
218
|
+
const pos = outerRing[oi];
|
|
219
|
+
const dLng = (pos[0] - centerLng) * Math.cos(centerLat * Math.PI / 180);
|
|
220
|
+
const dLat = pos[1] - centerLat;
|
|
221
|
+
// Approximate distance in meters (1 degree ≈ 111,320 m)
|
|
222
|
+
const distMeters = Math.sqrt(dLng * dLng + dLat * dLat) * 111320;
|
|
223
|
+
if (distMeters > maxDist) {
|
|
224
|
+
maxDist = distMeters;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
result.push({
|
|
228
|
+
position: [centerLng, centerLat],
|
|
229
|
+
radiusMeters: Math.ceil(maxDist),
|
|
230
|
+
weight
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getRoute","coreGetRoute","parseJsonTrack","raw","waypoints","parsed","JSON","parse","features","Array","isArray","Error","trackFeatures","totalDistanceMeters","totalDurationSeconds","ascentMeters","descentMeters","trackPointCount","fi","length","feature","geometry","type","coords","coordinates","push","properties","Number","waypointFeatures","map","pos","i","index","track","summary","request","coreWaypoints","position","coreRequest","profile","remoteProfile","vehicle","fast","format","alternativeIndex","nogos","exportWaypoints","heading","direction","elevation","maxRunningTime","connectTimeout","pathToFileResult","acceptCompressedResult","extraParams","result","geoResult","e","console","warn","message","String","polygonToNogoAreas","weight","polygons","pi","rings","outerRing","sumLng","sumLat","oi","centerLng","centerLat","maxDist","dLng","Math","cos","PI","dLat","distMeters","sqrt","radius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MAP = {
|
|
5
|
+
none: 0,
|
|
6
|
+
'auto-choose': 1,
|
|
7
|
+
locus: 2,
|
|
8
|
+
osmand: 3,
|
|
9
|
+
comment: 4,
|
|
10
|
+
gpsies: 5,
|
|
11
|
+
orux: 6,
|
|
12
|
+
'locus-old': 7
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Serialize waypoints into the BRouter wire format.
|
|
17
|
+
*
|
|
18
|
+
* Produces three AIDL keys:
|
|
19
|
+
* - `lonlats`: `lng,lat[,name][,d]|...` pipe-delimited string
|
|
20
|
+
* - `lats`: double[] of latitudes
|
|
21
|
+
* - `lons`: double[] of longitudes
|
|
22
|
+
* - `straight`: comma-separated indices of direct-routing waypoints (if any)
|
|
23
|
+
*/
|
|
24
|
+
function serializeWaypoints(waypoints) {
|
|
25
|
+
const parts = [];
|
|
26
|
+
const lats = [];
|
|
27
|
+
const lons = [];
|
|
28
|
+
const directIndices = [];
|
|
29
|
+
for (let i = 0; i < waypoints.length; i++) {
|
|
30
|
+
const wp = waypoints[i];
|
|
31
|
+
const lng = wp.position[0];
|
|
32
|
+
const lat = wp.position[1];
|
|
33
|
+
let part = `${lng},${lat}`;
|
|
34
|
+
if (wp.name) {
|
|
35
|
+
part += `,${wp.name}`;
|
|
36
|
+
}
|
|
37
|
+
if (wp.direct) {
|
|
38
|
+
part += ',d';
|
|
39
|
+
directIndices.push(i);
|
|
40
|
+
}
|
|
41
|
+
parts.push(part);
|
|
42
|
+
lats.push(lat);
|
|
43
|
+
lons.push(lng);
|
|
44
|
+
}
|
|
45
|
+
const result = {
|
|
46
|
+
lonlats: parts.join('|'),
|
|
47
|
+
lats,
|
|
48
|
+
lons
|
|
49
|
+
};
|
|
50
|
+
if (directIndices.length > 0) {
|
|
51
|
+
result.straight = directIndices.join(',');
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Serialize nogo areas into the BRouter wire format.
|
|
58
|
+
*
|
|
59
|
+
* Produces AIDL keys:
|
|
60
|
+
* - `nogos`: `lng,lat,radius[,weight]|...` pipe-delimited string
|
|
61
|
+
* - `nogoLats`: double[] of nogo center latitudes
|
|
62
|
+
* - `nogoLons`: double[] of nogo center longitudes
|
|
63
|
+
* - `nogoRadi`: double[] of nogo radii
|
|
64
|
+
*/
|
|
65
|
+
function serializeNogos(nogos) {
|
|
66
|
+
if (!nogos || nogos.length === 0) {
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
const parts = [];
|
|
70
|
+
const nogoLats = [];
|
|
71
|
+
const nogoLons = [];
|
|
72
|
+
const nogoRadi = [];
|
|
73
|
+
for (let ni = 0; ni < nogos.length; ni++) {
|
|
74
|
+
const nogo = nogos[ni];
|
|
75
|
+
const lng = nogo.position[0];
|
|
76
|
+
const lat = nogo.position[1];
|
|
77
|
+
let part = `${lng},${lat},${nogo.radiusMeters}`;
|
|
78
|
+
if (nogo.weight !== undefined) {
|
|
79
|
+
part += `,${nogo.weight}`;
|
|
80
|
+
}
|
|
81
|
+
parts.push(part);
|
|
82
|
+
nogoLats.push(lat);
|
|
83
|
+
nogoLons.push(lng);
|
|
84
|
+
nogoRadi.push(nogo.radiusMeters);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
nogos: parts.join('|'),
|
|
88
|
+
nogoLats,
|
|
89
|
+
nogoLons,
|
|
90
|
+
nogoRadi
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Serialize polylines into the BRouter wire format.
|
|
96
|
+
*
|
|
97
|
+
* Produces: `lng,lat,lng,lat,...,weight|lng,lat,...|...`
|
|
98
|
+
*/
|
|
99
|
+
function serializePolylines(polylines) {
|
|
100
|
+
if (!polylines || polylines.length === 0) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return polylines.map(pl => {
|
|
104
|
+
const coords = pl.positions.map(p => `${p[0]},${p[1]}`).join(',');
|
|
105
|
+
return pl.weight !== undefined ? `${coords},${pl.weight}` : coords;
|
|
106
|
+
}).join('|');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Serialize polygons into the BRouter wire format (same as polylines).
|
|
111
|
+
*/
|
|
112
|
+
function serializePolygons(polygons) {
|
|
113
|
+
if (!polygons || polygons.length === 0) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return polygons.map(pg => {
|
|
117
|
+
const coords = pg.positions.map(p => `${p[0]},${p[1]}`).join(',');
|
|
118
|
+
return pg.weight !== undefined ? `${coords},${pg.weight}` : coords;
|
|
119
|
+
}).join('|');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Serialize pois into the BRouter wire format.
|
|
124
|
+
*
|
|
125
|
+
* Produces: `lng,lat,name|lng,lat,name|...`
|
|
126
|
+
*/
|
|
127
|
+
function serializePois(pois) {
|
|
128
|
+
if (!pois || pois.length === 0) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
return pois.map(poi => `${poi.position[0]},${poi.position[1]},${poi.name}`).join('|');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Serialize a RouteRequest into the flat key-value map expected by the
|
|
136
|
+
* Android native module's ParamMapper.
|
|
137
|
+
*/
|
|
138
|
+
function serializeParams(request) {
|
|
139
|
+
const params = {};
|
|
140
|
+
|
|
141
|
+
// Waypoints (required, already validated)
|
|
142
|
+
Object.assign(params, serializeWaypoints(request.waypoints));
|
|
143
|
+
|
|
144
|
+
// Profile
|
|
145
|
+
if (request.profile) {
|
|
146
|
+
// Strip .brf extension if present
|
|
147
|
+
params.profile = request.profile.replace(/\.brf$/, '');
|
|
148
|
+
}
|
|
149
|
+
if (request.remoteProfile) {
|
|
150
|
+
params.remoteProfile = request.remoteProfile;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Vehicle mode
|
|
154
|
+
if (request.vehicle) {
|
|
155
|
+
params.v = request.vehicle;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Fast mode
|
|
159
|
+
if (request.fast !== undefined) {
|
|
160
|
+
params.fast = request.fast ? 1 : 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Track format
|
|
164
|
+
if (request.format) {
|
|
165
|
+
params.trackFormat = request.format;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Alternative index
|
|
169
|
+
if (request.alternativeIndex !== undefined) {
|
|
170
|
+
params.alternativeidx = request.alternativeIndex;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Export waypoints
|
|
174
|
+
if (request.exportWaypoints) {
|
|
175
|
+
params.exportWaypoints = 1;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Turn instruction format
|
|
179
|
+
if (request.turnInstructionFormat) {
|
|
180
|
+
params.turnInstructionFormat = request.turnInstructionFormat;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Turn instruction mode (enum → int)
|
|
184
|
+
if (request.turnInstructionMode) {
|
|
185
|
+
const mode = TURN_INSTRUCTION_MODE_MAP[request.turnInstructionMode];
|
|
186
|
+
if (mode !== undefined) {
|
|
187
|
+
params.timode = mode;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Heading / direction
|
|
192
|
+
if (request.heading !== undefined) {
|
|
193
|
+
params.heading = request.heading;
|
|
194
|
+
}
|
|
195
|
+
if (request.direction !== undefined) {
|
|
196
|
+
params.direction = request.direction;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Elevation (engineMode)
|
|
200
|
+
if (request.elevation) {
|
|
201
|
+
params.engineMode = 2;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Max running time
|
|
205
|
+
if (request.maxRunningTime !== undefined) {
|
|
206
|
+
params.maxRunningTime = request.maxRunningTime;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Connection timeout (not AIDL, used by BRouterClient)
|
|
210
|
+
if (request.connectTimeout !== undefined) {
|
|
211
|
+
params.connectTimeout = request.connectTimeout;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// File output
|
|
215
|
+
if (request.pathToFileResult) {
|
|
216
|
+
params.pathToFileResult = request.pathToFileResult;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Compression
|
|
220
|
+
if (request.acceptCompressedResult) {
|
|
221
|
+
params.acceptCompressedResult = true;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Extra params
|
|
225
|
+
if (request.extraParams) {
|
|
226
|
+
params.extraParams = request.extraParams;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Nogo areas
|
|
230
|
+
if (request.nogos && request.nogos.length > 0) {
|
|
231
|
+
Object.assign(params, serializeNogos(request.nogos));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Polylines
|
|
235
|
+
const polylinesStr = serializePolylines(request.polylines);
|
|
236
|
+
if (polylinesStr) {
|
|
237
|
+
params.polylines = polylinesStr;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Polygons
|
|
241
|
+
const polygonsStr = serializePolygons(request.polygons);
|
|
242
|
+
if (polygonsStr) {
|
|
243
|
+
params.polygons = polygonsStr;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// POIs
|
|
247
|
+
const poisStr = serializePois(request.pois);
|
|
248
|
+
if (poisStr) {
|
|
249
|
+
params.pois = poisStr;
|
|
250
|
+
}
|
|
251
|
+
return params;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Extract a structured error from a native module rejection.
|
|
256
|
+
*
|
|
257
|
+
* Native rejections come through as `{ code: string, message: string }`
|
|
258
|
+
* from {@code Promise.reject(code, message)}.
|
|
259
|
+
*/
|
|
260
|
+
function normalizeError(e) {
|
|
261
|
+
const err = e;
|
|
262
|
+
return {
|
|
263
|
+
code: err?.code ?? 'UNKNOWN',
|
|
264
|
+
message: err?.message ?? String(e)
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Request a route from the BRouter Android app.
|
|
270
|
+
*
|
|
271
|
+
* This is the core API entry point. It validates the request, serializes
|
|
272
|
+
* it into the AIDL wire format, calls the native module, and returns a
|
|
273
|
+
* typed {@link RouteResult}.
|
|
274
|
+
*
|
|
275
|
+
* @throws {BRouterError} if the request is invalid or BRouter fails.
|
|
276
|
+
*/
|
|
277
|
+
export async function getRoute(request) {
|
|
278
|
+
// Validate
|
|
279
|
+
if (!request.waypoints || request.waypoints.length < 2) {
|
|
280
|
+
throw {
|
|
281
|
+
code: 'INVALID_PARAMS',
|
|
282
|
+
message: 'At least 2 waypoints are required'
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const format = request.format ?? 'gpx';
|
|
286
|
+
const params = serializeParams(request);
|
|
287
|
+
try {
|
|
288
|
+
const raw = await NativeBRouter.getRoute(params);
|
|
289
|
+
return {
|
|
290
|
+
raw,
|
|
291
|
+
format
|
|
292
|
+
};
|
|
293
|
+
} catch (e) {
|
|
294
|
+
throw normalizeError(e);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeBRouter","TURN_INSTRUCTION_MODE_MAP","none","locus","osmand","comment","gpsies","orux","serializeWaypoints","waypoints","parts","lats","lons","directIndices","i","length","wp","lng","position","lat","part","name","direct","push","result","lonlats","join","straight","serializeNogos","nogos","nogoLats","nogoLons","nogoRadi","ni","nogo","radiusMeters","weight","undefined","serializePolylines","polylines","map","pl","coords","positions","p","serializePolygons","polygons","pg","serializePois","pois","poi","serializeParams","request","params","Object","assign","profile","replace","remoteProfile","vehicle","v","fast","format","trackFormat","alternativeIndex","alternativeidx","exportWaypoints","turnInstructionFormat","turnInstructionMode","mode","timode","heading","direction","elevation","engineMode","maxRunningTime","connectTimeout","pathToFileResult","acceptCompressedResult","extraParams","polylinesStr","polygonsStr","poisStr","normalizeError","e","err","code","message","String","getRoute","raw"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,oBAAiB;AAwB3C,MAAMC,yBAAiD,GAAG;EACzDC,IAAI,EAAE,CAAC;EACP,aAAa,EAAE,CAAC;EAChBC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE,CAAC;EACTC,IAAI,EAAE,CAAC;EACP,WAAW,EAAE;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAC1BC,SAAoC,EACV;EAC1B,MAAMC,KAAe,GAAG,EAAE;EAC1B,MAAMC,IAAc,GAAG,EAAE;EACzB,MAAMC,IAAc,GAAG,EAAE;EACzB,MAAMC,aAAuB,GAAG,EAAE;EAElC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,SAAS,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;IAC1C,MAAME,EAAE,GAAGP,SAAS,CAACK,CAAC,CAAE;IACxB,MAAMG,GAAG,GAAGD,EAAE,CAACE,QAAQ,CAAC,CAAC,CAAW;IACpC,MAAMC,GAAG,GAAGH,EAAE,CAACE,QAAQ,CAAC,CAAC,CAAW;IAEpC,IAAIE,IAAI,GAAG,GAAGH,GAAG,IAAIE,GAAG,EAAE;IAC1B,IAAIH,EAAE,CAACK,IAAI,EAAE;MACZD,IAAI,IAAI,IAAIJ,EAAE,CAACK,IAAI,EAAE;IACtB;IACA,IAAIL,EAAE,CAACM,MAAM,EAAE;MACdF,IAAI,IAAI,IAAI;MACZP,aAAa,CAACU,IAAI,CAACT,CAAC,CAAC;IACtB;IAEAJ,KAAK,CAACa,IAAI,CAACH,IAAI,CAAC;IAChBT,IAAI,CAACY,IAAI,C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C3E;EACA,IAAI,CAACA,OAAO,CAAC3C,SAAS,IAAI2C,OAAO,CAAC3C,SAAS,CAACM,MAAM,GAAG,CAAC,EAAE;IACvD,MAAM;MACLuE,IAAI,EAAE,gBAAgB;MACtBC,OAAO,EAAE;IACV,CAAC;EACF;EAEA,MAAMzB,MAAmB,GAAGV,OAAO,CAACU,MAAM,IAAI,KAAK;EACnD,MAAMT,MAAM,GAAGF,eAAe,CAACC,OAAO,CAAC;EAEvC,IAAI;IACH,MAAMsC,GAAG,GAAG,MAAM1F,aAAa,CAACyF,QAAQ,CAACpC,MAAM,CAAC;IAChD,OAAO;MAAEqC,GAAG;MAAE5B;IAAO,CAAC;EACvB,CAAC,CAAC,OAAOsB,CAAU,EAAE;IACpB,MAAMD,cAAc,CAACC,CAAC,CAAC;EACxB;AACD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release.config.d.ts","sourceRoot":"","sources":["../../release.config.ts"],"names":[],"mappings":";;;;;;;;;AAAA,wBAGE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
getRoute(params: {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: Spec;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=NativeBRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeBRouter.d.ts","sourceRoot":"","sources":["../../../src/NativeBRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACxC,QAAQ,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D;;AAED,wBAAiE"}
|