@golemio/pid 2.11.1-dev.1128205761 → 2.11.1-rc.1131613021

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.
Files changed (53) hide show
  1. package/db/example/12_metro_line_A_gtfs_trips.sql +4 -4
  2. package/db/example/13_http-propagate-delay.sql +8 -8
  3. package/dist/integration-engine/ioc/Di.d.ts +2 -1
  4. package/dist/integration-engine/ioc/Di.js +5 -7
  5. package/dist/integration-engine/ioc/Di.js.map +1 -1
  6. package/dist/integration-engine/ioc/ModuleContainerToken.d.ts +0 -1
  7. package/dist/integration-engine/ioc/ModuleContainerToken.js +0 -1
  8. package/dist/integration-engine/ioc/ModuleContainerToken.js.map +1 -1
  9. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js +5 -4
  10. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js.map +1 -1
  11. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.d.ts +11 -9
  12. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.js +97 -33
  13. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.js.map +1 -1
  14. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +23 -28
  15. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
  16. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/ValidToCalculator.js +5 -4
  17. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/ValidToCalculator.js.map +1 -1
  18. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +22 -24
  19. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
  20. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/interfaces/VPInterfaces.d.ts +1 -1
  21. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js +0 -2
  22. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
  23. package/dist/output-gateway/public/ioc/Di.js +1 -5
  24. package/dist/output-gateway/public/ioc/Di.js.map +1 -1
  25. package/dist/output-gateway/public/ioc/OgModuleToken.d.ts +0 -2
  26. package/dist/output-gateway/public/ioc/OgModuleToken.js +0 -2
  27. package/dist/output-gateway/public/ioc/OgModuleToken.js.map +1 -1
  28. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.d.ts +1 -3
  29. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js +3 -3
  30. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js.map +1 -1
  31. package/dist/output-gateway/public/service/helpers/BoundingBoxHelper.d.ts +3 -6
  32. package/dist/output-gateway/public/service/helpers/BoundingBoxHelper.js +10 -26
  33. package/dist/output-gateway/public/service/helpers/BoundingBoxHelper.js.map +1 -1
  34. package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js +3 -11
  35. package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js.map +1 -1
  36. package/dist/schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces.d.ts +1 -2
  37. package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto.d.ts +0 -2
  38. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js +0 -24
  39. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js.map +1 -1
  40. package/docs/openapi-output.yaml +2 -10
  41. package/package.json +2 -2
  42. package/dist/helpers/geo/GeoMeasurementHelper.d.ts +0 -17
  43. package/dist/helpers/geo/GeoMeasurementHelper.js +0 -65
  44. package/dist/helpers/geo/GeoMeasurementHelper.js.map +0 -1
  45. package/dist/helpers/geo/interfaces/IGeoMeasurementHelper.d.ts +0 -8
  46. package/dist/helpers/geo/interfaces/IGeoMeasurementHelper.js +0 -3
  47. package/dist/helpers/geo/interfaces/IGeoMeasurementHelper.js.map +0 -1
  48. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.d.ts +0 -17
  49. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js +0 -76
  50. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js.map +0 -1
  51. package/dist/output-gateway/public/service/helpers/interfaces/IBoundingBoxHelper.d.ts +0 -4
  52. package/dist/output-gateway/public/service/helpers/interfaces/IBoundingBoxHelper.js +0 -3
  53. package/dist/output-gateway/public/service/helpers/interfaces/IBoundingBoxHelper.js.map +0 -1
@@ -4,8 +4,6 @@ export interface IPublicApiCacheDto {
4
4
  gtfs_trip_id: string;
5
5
  route_type: GTFSRouteTypeEnum;
6
6
  gtfs_route_short_name: string;
7
- run_number: number | null;
8
- vehicle_registration_number: number | null;
9
7
  lat: number;
10
8
  lng: number;
11
9
  bearing: number | null;
@@ -21,28 +21,6 @@ const publicApiCacheDtoSchema = {
21
21
  type: "string",
22
22
  },
23
23
  state_position: { type: "string" },
24
- run_number: {
25
- oneOf: [
26
- {
27
- type: "number",
28
- },
29
- {
30
- type: "null",
31
- nullable: true,
32
- },
33
- ],
34
- },
35
- vehicle_registration_number: {
36
- oneOf: [
37
- {
38
- type: "number",
39
- },
40
- {
41
- type: "null",
42
- nullable: true,
43
- },
44
- ],
45
- },
46
24
  lat: {
47
25
  type: "number",
48
26
  },
@@ -77,8 +55,6 @@ const publicApiCacheDtoSchema = {
77
55
  "gtfs_trip_id",
78
56
  "route_type",
79
57
  "gtfs_route_short_name",
80
- "run_number",
81
- "vehicle_registration_number",
82
58
  "lat",
83
59
  "lng",
84
60
  "bearing",
@@ -1 +1 @@
1
- {"version":3,"file":"PublicApiCacheDtoSchema.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.ts"],"names":[],"mappings":";;;AAGA,MAAM,uBAAuB,GAAyC;IAClE,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,YAAY,EAAE;gBACV,IAAI,EAAE,QAAQ;aACjB;YACD,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;aACjB;YACD,qBAAqB,EAAE;gBACnB,IAAI,EAAE,QAAQ;aACjB;YACD,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;aACjB;YACD,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAClC,UAAU,EAAE;gBACR,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;qBACjB;oBACD;wBACI,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,IAAI;qBACjB;iBACJ;aACJ;YACD,2BAA2B,EAAE;gBACzB,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;qBACjB;oBACD;wBACI,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,IAAI;qBACjB;iBACJ;aACJ;YACD,GAAG,EAAE;gBACD,IAAI,EAAE,QAAQ;aACjB;YACD,GAAG,EAAE;gBACD,IAAI,EAAE,QAAQ;aACjB;YACD,OAAO,EAAE;gBACL,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;qBACjB;oBACD;wBACI,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,IAAI;qBACjB;iBACJ;aACJ;YACD,KAAK,EAAE;gBACH,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;qBACjB;oBACD;wBACI,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,IAAI;qBACjB;iBACJ;aACJ;SACJ;QACD,QAAQ,EAAE;YACN,YAAY;YACZ,cAAc;YACd,YAAY;YACZ,uBAAuB;YACvB,YAAY;YACZ,6BAA6B;YAC7B,KAAK;YACL,KAAK;YACL,SAAS;YACT,OAAO;YACP,gBAAgB;SACnB;KACJ;CACJ,CAAC;AACkC,0DAAuB"}
1
+ {"version":3,"file":"PublicApiCacheDtoSchema.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.ts"],"names":[],"mappings":";;;AAGA,MAAM,uBAAuB,GAAyC;IAClE,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,YAAY,EAAE;gBACV,IAAI,EAAE,QAAQ;aACjB;YACD,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;aACjB;YACD,qBAAqB,EAAE;gBACnB,IAAI,EAAE,QAAQ;aACjB;YACD,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;aACjB;YACD,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAClC,GAAG,EAAE;gBACD,IAAI,EAAE,QAAQ;aACjB;YACD,GAAG,EAAE;gBACD,IAAI,EAAE,QAAQ;aACjB;YACD,OAAO,EAAE;gBACL,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;qBACjB;oBACD;wBACI,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,IAAI;qBACjB;iBACJ;aACJ;YACD,KAAK,EAAE;gBACH,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;qBACjB;oBACD;wBACI,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,IAAI;qBACjB;iBACJ;aACJ;SACJ;QACD,QAAQ,EAAE;YACN,YAAY;YACZ,cAAc;YACd,YAAY;YACZ,uBAAuB;YACvB,KAAK;YACL,KAAK;YACL,SAAS;YACT,OAAO;YACP,gBAAgB;SACnB;KACJ;CACJ,CAAC;AACkC,0DAAuB"}
@@ -1988,21 +1988,13 @@ components:
1988
1988
  properties:
1989
1989
  gtfs_trip_id:
1990
1990
  type: string
1991
- example: 705_735_231002
1991
+ example: "705_735_231002"
1992
1992
  route_type:
1993
1993
  type: string
1994
1994
  example: bus
1995
1995
  gtfs_route_short_name:
1996
1996
  type: string
1997
1997
  example: '705'
1998
- run_number:
1999
- type: number
2000
- nullable: true
2001
- example: 29
2002
- vehicle_registration_number:
2003
- type: number
2004
- nullable: true
2005
- example: 8585
2006
1998
  bearing:
2007
1999
  type: number
2008
2000
  nullable: true
@@ -2013,7 +2005,7 @@ components:
2013
2005
  example: 20
2014
2006
  vehicle_id:
2015
2007
  type: string
2016
- example: "metro-A-32"
2008
+ example: "service-3-8585"
2017
2009
  state_position:
2018
2010
  type: string
2019
2011
  example: "at_stop"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.11.1-dev.1128205761",
3
+ "version": "2.11.1-rc.1131613021",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -79,7 +79,7 @@
79
79
  "dependencies": {
80
80
  "@golemio/ovapi-gtfs-realtime-bindings": "1.2.1-dev.943774882",
81
81
  "@turf/turf": "^6.5.0",
82
- "cheap-ruler": "^3.0.2",
82
+ "cheap-ruler": "^2.5.1",
83
83
  "csv-parser": "^3.0.0",
84
84
  "csv-stringify": "^5.6.2",
85
85
  "html-entities": "^2.3.3",
@@ -1,17 +0,0 @@
1
- import { Position } from "@golemio/core/dist/shared/geojson";
2
- import { BBox, Point } from "cheap-ruler";
3
- import { IGeoMeasurementHelper } from "./interfaces/IGeoMeasurementHelper";
4
- export declare class GeoMeasurementHelper implements IGeoMeasurementHelper {
5
- private rulerInstanceDict;
6
- constructor();
7
- /** Get distance in kilometers between two points */
8
- getDistanceInKilometers(pointA: Point | Position, pointB: Point | Position): number;
9
- /** Get distance in meters between two points */
10
- getDistanceInMeters(pointA: Point | Position, pointB: Point | Position): number;
11
- /** Get buffered bounding box in kilometers */
12
- getBufferedBBoxInKilometers(point: Point | Position, bufferInKm: number): BBox;
13
- /** Check if point is inside bounding box */
14
- isPointInBBox(point: Point | Position, bbox: BBox): boolean;
15
- private getRulerInstance;
16
- private getValidPoint;
17
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.GeoMeasurementHelper = void 0;
16
- const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
17
- const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
18
- const cheap_ruler_1 = __importDefault(require("cheap-ruler"));
19
- const APPROXIMATION_LATITUDE = 50.0;
20
- let GeoMeasurementHelper = exports.GeoMeasurementHelper = class GeoMeasurementHelper {
21
- constructor() {
22
- this.rulerInstanceDict = new Map();
23
- }
24
- /** Get distance in kilometers between two points */
25
- getDistanceInKilometers(pointA, pointB) {
26
- const validPointA = this.getValidPoint(pointA);
27
- const validPointB = this.getValidPoint(pointB);
28
- return this.getRulerInstance("kilometers").distance(validPointA, validPointB);
29
- }
30
- /** Get distance in meters between two points */
31
- getDistanceInMeters(pointA, pointB) {
32
- const validPointA = this.getValidPoint(pointA);
33
- const validPointB = this.getValidPoint(pointB);
34
- return this.getRulerInstance("meters").distance(validPointA, validPointB);
35
- }
36
- /** Get buffered bounding box in kilometers */
37
- getBufferedBBoxInKilometers(point, bufferInKm) {
38
- const validPoint = this.getValidPoint(point);
39
- return this.getRulerInstance("kilometers").bufferPoint(validPoint, bufferInKm);
40
- }
41
- /** Check if point is inside bounding box */
42
- isPointInBBox(point, bbox) {
43
- const validPoint = this.getValidPoint(point);
44
- return this.getRulerInstance("kilometers").insideBBox(validPoint, bbox);
45
- }
46
- getRulerInstance(unit) {
47
- let ruler = this.rulerInstanceDict.get(unit);
48
- if (!ruler) {
49
- ruler = new cheap_ruler_1.default(APPROXIMATION_LATITUDE, unit);
50
- this.rulerInstanceDict.set(unit, ruler);
51
- }
52
- return ruler;
53
- }
54
- getValidPoint(point) {
55
- if (point.length !== 2) {
56
- throw new golemio_errors_1.GeneralError("getValidPoint: invalid point " + JSON.stringify(point), this.constructor.name, undefined, 422);
57
- }
58
- return point;
59
- }
60
- };
61
- exports.GeoMeasurementHelper = GeoMeasurementHelper = __decorate([
62
- (0, tsyringe_1.injectable)(),
63
- __metadata("design:paramtypes", [])
64
- ], GeoMeasurementHelper);
65
- //# sourceMappingURL=GeoMeasurementHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeoMeasurementHelper.js","sourceRoot":"","sources":["../../../src/helpers/geo/GeoMeasurementHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,6EAAwE;AACxE,iEAAgE;AAChE,8DAAsD;AAItD,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAG7B,IAAM,oBAAoB,kCAA1B,MAAM,oBAAoB;IAG7B;QACI,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;IACvC,CAAC;IAED,oDAAoD;IAC7C,uBAAuB,CAAC,MAAwB,EAAE,MAAwB;QAC7E,MAAM,WAAW,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AC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SAC3C;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,aAAa,CAAC,KAAuB;QACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACpB,MAAM,IAAI,6BAAY,CAClB,+BAA+B,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EACvD,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,SAAS,EACT,GAAG,CACN,CAAC;SACL;QAED,OAAO,KAAc,CAAC;IAC1B,CAAC;CACJ,CAAA;+BAvDY,oBAAoB;IADhC,IAAA,qBAAU,GAAE;;GACA,oBAAoB,CAuDhC"}
@@ -1,8 +0,0 @@
1
- import { Position } from "@golemio/core/dist/shared/geojson";
2
- import { BBox, Point } from "cheap-ruler";
3
- export interface IGeoMeasurementHelper {
4
- getDistanceInKilometers(pointA: Point | Position, pointB: Point | Position): number;
5
- getDistanceInMeters(pointA: Point | Position, pointB: Point | Position): number;
6
- getBufferedBBoxInKilometers(point: Point | Position, bufferInKm: number): BBox;
7
- isPointInBBox(point: Point | Position, bbox: BBox): boolean;
8
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IGeoMeasurementHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IGeoMeasurementHelper.js","sourceRoot":"","sources":["../../../../src/helpers/geo/interfaces/IGeoMeasurementHelper.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- import { Feature, Point } from "@turf/turf";
2
- import { ICurrentPositionProperties, IShapeAnchorPoint } from "../../interfaces/VPInterfaces";
3
- export declare class AnchorPointSegmenter {
4
- private geoHelper;
5
- private anchorPoints;
6
- private anchorPointSegments;
7
- private currentPosition;
8
- constructor(anchorPoints: IShapeAnchorPoint[], currentPosition: Feature<Point, ICurrentPositionProperties>);
9
- /**
10
- * Returns all anchor points in radius of current position
11
- * if lastStopSequence is provided, only anchor points from that segment are returned
12
- */
13
- getAnchorPointsInRadius(lastStopSequence: number | null, radiusInKm: number): IShapeAnchorPoint[][];
14
- /** Divides anchor points into segments by last stop sequence and this stop sequence if at stop */
15
- private computeAnchorPointSegments;
16
- private getSegment;
17
- }
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AnchorPointSegmenter = void 0;
4
- const ModuleContainerToken_1 = require("../../../../../ioc/ModuleContainerToken");
5
- const Di_1 = require("../../../../ioc/Di");
6
- class AnchorPointSegmenter {
7
- constructor(anchorPoints, currentPosition) {
8
- this.geoHelper = Di_1.VPContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.GeoMeasurementHelper);
9
- this.anchorPoints = anchorPoints;
10
- this.anchorPointSegments = this.computeAnchorPointSegments(anchorPoints);
11
- this.currentPosition = currentPosition;
12
- }
13
- /**
14
- * Returns all anchor points in radius of current position
15
- * if lastStopSequence is provided, only anchor points from that segment are returned
16
- */
17
- getAnchorPointsInRadius(lastStopSequence, radiusInKm) {
18
- var _a;
19
- const positionCoordinates = this.currentPosition.geometry.coordinates;
20
- const anchorPoints = lastStopSequence ? (_a = this.anchorPointSegments.get(lastStopSequence)) !== null && _a !== void 0 ? _a : [] : this.anchorPoints;
21
- const boundingBox = this.geoHelper.getBufferedBBoxInKilometers(positionCoordinates, radiusInKm);
22
- let ptsInRadius = [];
23
- let ptsIndex = 0;
24
- for (const anchorPoint of anchorPoints) {
25
- // Ignore anchor points outside bbox to avoid unnecessary distance calculations
26
- if (!this.geoHelper.isPointInBBox(anchorPoint.coordinates, boundingBox)) {
27
- continue;
28
- }
29
- const distanceInKm = this.geoHelper.getDistanceInKilometers(anchorPoint.coordinates, positionCoordinates);
30
- // Ignore anchor points on the periphery of the bbox
31
- // in addition, from now push to the next segment due to possible overlap of shapes (handled later)
32
- if (distanceInKm > radiusInKm) {
33
- if (ptsInRadius[ptsIndex] !== undefined) {
34
- ptsIndex++;
35
- }
36
- continue;
37
- }
38
- if (ptsInRadius[ptsIndex] === undefined) {
39
- ptsInRadius[ptsIndex] = [];
40
- }
41
- ptsInRadius[ptsIndex].push(anchorPoint);
42
- }
43
- // Edge case - if no points found, try again with all points
44
- // (vehicle may be too far ahead - e.g. when the vehicle/data provider stopped sending data for a while)
45
- // (we want to find at least one point on track so that the vehicle is not immediately considered off_track)
46
- if (lastStopSequence && ptsInRadius.flat().length === 0) {
47
- return this.getAnchorPointsInRadius(null, radiusInKm);
48
- }
49
- return ptsInRadius;
50
- }
51
- /** Divides anchor points into segments by last stop sequence and this stop sequence if at stop */
52
- computeAnchorPointSegments(anchorPoints) {
53
- let segments = new Map();
54
- for (const anchorPoint of anchorPoints) {
55
- let currentSegment = this.getSegment(segments, anchorPoint.last_stop_sequence);
56
- // Add anchor point to segment
57
- currentSegment.push(anchorPoint);
58
- // If at stop, also add anchor point to previous segment (except if first stop since there is no previous segment)
59
- if (anchorPoint.at_stop && anchorPoint.last_stop_sequence !== 1) {
60
- const previousSegment = this.getSegment(segments, anchorPoint.last_stop_sequence - 1);
61
- previousSegment.push(anchorPoint);
62
- }
63
- }
64
- return segments;
65
- }
66
- getSegment(segments, segmentIndex) {
67
- let segment = segments.get(segmentIndex);
68
- if (!segment) {
69
- segment = [];
70
- segments.set(segmentIndex, segment);
71
- }
72
- return segment;
73
- }
74
- }
75
- exports.AnchorPointSegmenter = AnchorPointSegmenter;
76
- //# sourceMappingURL=AnchorPointSegmenter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnchorPointSegmenter.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.ts"],"names":[],"mappings":";;;AACA,kFAAoE;AACpE,2CAA2D;AAM3D,MAAa,oBAAoB;IAM7B,YAAY,YAAiC,EAAE,eAA2D;QACtG,IAAI,CAAC,SAAS,GAAG,gBAAW,CAAC,OAAO,CAAwB,2CAAoB,CAAC,oBAA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ter } from "../../../domain/IBoudingBox";
2
- export interface IBoundingBoxHelper {
3
- mapToCenterFormat(boundingBox: IBoundingBox): IBoundingBoxWithCenter;
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IBoundingBoxHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IBoundingBoxHelper.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/public/service/helpers/interfaces/IBoundingBoxHelper.ts"],"names":[],"mappings":""}