Skip to content

Commit 64f7bee

Browse files
wip
1 parent c074949 commit 64f7bee

19 files changed

+514
-392
lines changed

scripts/ci/build_arm64.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
set -e pipefail
3+

server/Format.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.Format = void 0;
4+
var Format;
5+
(function (Format) {
6+
Format["Json"] = "json";
7+
Format["Flatbuffers"] = "flatbuffers";
8+
})(Format = exports.Format || (exports.Format = {}));

server/Format.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export enum Format {
2+
Json = 'json',
3+
Flatbuffers = 'flatbuffers'
4+
}

server/MatchServiceHandler.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.MatchServiceHandler = void 0;
4+
const ServiceHandler_1 = require("./ServiceHandler");
5+
class MatchServiceHandler extends ServiceHandler_1.ServiceHandler {
6+
buildServiceOptions(options, query) {
7+
if (query.timestamps) {
8+
options.timestamps = query.timestamps;
9+
}
10+
if (query.waypoints) {
11+
options.waypoints = query.waypoints;
12+
}
13+
if (query.gaps) {
14+
options.gaps = query.gaps;
15+
}
16+
if (query.tidy) {
17+
options.tidy = query.tidy;
18+
}
19+
return options;
20+
}
21+
async callOSRM(options) {
22+
return this.osrm.match(options);
23+
}
24+
}
25+
exports.MatchServiceHandler = MatchServiceHandler;

server/MatchServiceHandler.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {ServiceHandler} from "./ServiceHandler";
2+
3+
export class MatchServiceHandler extends ServiceHandler {
4+
protected buildServiceOptions(options: any, query: any): any {
5+
6+
if (query.timestamps) {
7+
options.timestamps = query.timestamps;
8+
}
9+
10+
if (query.waypoints) {
11+
options.waypoints = query.waypoints;
12+
}
13+
14+
if (query.gaps) {
15+
options.gaps = query.gaps;
16+
}
17+
18+
if (query.tidy) {
19+
options.tidy = query.tidy;
20+
}
21+
return options;
22+
}
23+
24+
protected async callOSRM(options: any): Promise<any> {
25+
return this.osrm.match(options);
26+
}
27+
}

server/NearestServiceHandler.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.NearestServiceHandler = void 0;
4+
const ServiceHandler_1 = require("./ServiceHandler");
5+
class NearestServiceHandler extends ServiceHandler_1.ServiceHandler {
6+
buildServiceOptions(options, query) {
7+
if (query.number !== undefined) {
8+
options.number = query.number;
9+
}
10+
return options;
11+
}
12+
async callOSRM(options) {
13+
return this.osrm.nearest(options);
14+
}
15+
}
16+
exports.NearestServiceHandler = NearestServiceHandler;

server/NearestServiceHandler.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {ServiceHandler} from "./ServiceHandler";
2+
3+
export class NearestServiceHandler extends ServiceHandler {
4+
protected buildServiceOptions(options: any, query: any): any {
5+
if (query.number !== undefined) {
6+
options.number = query.number;
7+
}
8+
return options;
9+
}
10+
11+
protected async callOSRM(options: any): Promise<any> {
12+
return this.osrm.nearest(options);
13+
}
14+
}

server/OSRMWrapper.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.OSRMWrapper = void 0;
4+
const util = require('util');
5+
const OSRM = require('../lib/index.js');
6+
class OSRMWrapper {
7+
constructor(osrmOptions) {
8+
this.osrm = new OSRM(osrmOptions);
9+
}
10+
async tile(zxy) {
11+
return util.promisify(this.osrm.tile.bind(this.osrm))(zxy);
12+
}
13+
async route(options) {
14+
return util.promisify(this.osrm.route.bind(this.osrm))(options);
15+
}
16+
async nearest(options) {
17+
return util.promisify(this.osrm.nearest.bind(this.osrm))(options);
18+
}
19+
async table(options) {
20+
return util.promisify(this.osrm.table.bind(this.osrm))(options);
21+
}
22+
async trip(options) {
23+
return util.promisify(this.osrm.trip.bind(this.osrm))(options);
24+
}
25+
async match(options) {
26+
return util.promisify(this.osrm.match.bind(this.osrm))(options);
27+
}
28+
}
29+
exports.OSRMWrapper = OSRMWrapper;

server/OSRMWrapper.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const util = require('util');
2+
const OSRM = require('../lib/index.js')
3+
4+
export class OSRMWrapper {
5+
private readonly osrm: typeof OSRM;
6+
7+
constructor(osrmOptions: any) {
8+
this.osrm = new OSRM(osrmOptions);
9+
}
10+
11+
async tile(zxy: [number, number, number]): Promise<any> {
12+
return util.promisify(this.osrm.tile.bind(this.osrm))(zxy);
13+
}
14+
15+
async route(options: any): Promise<any> {
16+
return util.promisify(this.osrm.route.bind(this.osrm))(options);
17+
}
18+
19+
async nearest(options: any): Promise<any> {
20+
return util.promisify(this.osrm.nearest.bind(this.osrm))(options);
21+
}
22+
23+
async table(options: any): Promise<any> {
24+
return util.promisify(this.osrm.table.bind(this.osrm))(options);
25+
}
26+
27+
async trip(options: any): Promise<any> {
28+
return util.promisify(this.osrm.trip.bind(this.osrm))(options);
29+
}
30+
31+
async match(options: any): Promise<any> {
32+
return util.promisify(this.osrm.match.bind(this.osrm))(options);
33+
}
34+
}

server/RouteServiceHandler.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.RouteServiceHandler = void 0;
4+
const ServiceHandler_1 = require("./ServiceHandler");
5+
class RouteServiceHandler extends ServiceHandler_1.ServiceHandler {
6+
buildServiceOptions(options, query) {
7+
if (query.alternatives) {
8+
options.alternatives = query.alternatives;
9+
}
10+
if (query.approaches) {
11+
options.approaches = query.approaches;
12+
}
13+
if (query.waypoints) {
14+
options.waypoints = query.waypoints;
15+
}
16+
return options;
17+
}
18+
async callOSRM(options) {
19+
return this.osrm.route(options);
20+
}
21+
}
22+
exports.RouteServiceHandler = RouteServiceHandler;

0 commit comments

Comments
 (0)