@mappedin/events 6.0.1-beta.58 → 6.6.0-beta.0

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.
@@ -4097,17 +4097,49 @@ type DirectionProperties = {
4097
4097
  };
4098
4098
  type DirectionFeature = Feature$1<Point$1, DirectionProperties>;
4099
4099
  type DirectionsCollection = FeatureCollection$1<Point$1, DirectionProperties>;
4100
- type SimplifyDirectionsOptions = {
4100
+ interface DoorGeometry {
4101
+ geoJSON: {
4102
+ geometry: {
4103
+ coordinates: [
4104
+ [
4105
+ number,
4106
+ number
4107
+ ],
4108
+ [
4109
+ number,
4110
+ number
4111
+ ]
4112
+ ];
4113
+ };
4114
+ };
4115
+ }
4116
+ type BaseSimplifyOptions = {
4101
4117
  /**
4102
4118
  * Enable or disable simplifying.
4103
4119
  */
4104
4120
  enabled: boolean;
4105
4121
  /**
4106
4122
  * The radius of the buffer around the path to consider when simplifying, in meters.
4107
- * @default 0.7
4123
+ * @default 0.4
4108
4124
  */
4109
- bufferRadius?: number;
4125
+ radius?: number;
4126
+ };
4127
+ type GreedyLosOptions = BaseSimplifyOptions & {
4128
+ __EXPERIMENTAL_METHOD?: "greedy-los";
4110
4129
  };
4130
+ type RdpOptions = BaseSimplifyOptions & {
4131
+ __EXPERIMENTAL_METHOD: "rdp";
4132
+ };
4133
+ type DpOptimalOptions = BaseSimplifyOptions & {
4134
+ __EXPERIMENTAL_METHOD: "dp-optimal";
4135
+ /**
4136
+ * Whether to include door buffer nodes in DP simplification.
4137
+ * When true, predecessor and successor nodes of doors are marked with preventSmoothing.
4138
+ * @default false
4139
+ */
4140
+ includeDoorBufferNodes?: boolean;
4141
+ };
4142
+ type SimplifyDirectionsOptions = GreedyLosOptions | RdpOptions | DpOptimalOptions;
4111
4143
  type DirectionsZone = {
4112
4144
  geometry: Feature$1<MultiPolygon$1 | Polygon$1>;
4113
4145
  /**
@@ -4125,6 +4157,7 @@ declare class Navigator$1 {
4125
4157
  graph: NavigationGraph;
4126
4158
  private geometryEdgesByMapId;
4127
4159
  private flagDeclarations;
4160
+ private getDoorByNodeId;
4128
4161
  private disabledNodeIds;
4129
4162
  /**
4130
4163
  * Constructs a Navigator instance to manage pathfinding with optional obstructions and grouping features.
@@ -4133,13 +4166,15 @@ declare class Navigator$1 {
4133
4166
  * @param {ObstructionCollection} [obstructions] - Optional collection of obstructions that could block paths.
4134
4167
  * @param {SpaceCollection} [spaces] - Optional collection of spaces that could block paths.
4135
4168
  * @param {string} [groupBy] - Optional property name to group nodes and paths for differentiated processing.
4169
+ * @param {Function} getDoorByNodeId - Function to get door object by node ID.
4136
4170
  */
4137
- constructor({ nodes, geojsonCollection, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, }: {
4171
+ constructor({ nodes, geojsonCollection, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, getDoorByNodeId, }: {
4138
4172
  nodes: NodeCollection$1;
4139
4173
  geojsonCollection?: ObstructionCollection | SpaceCollection;
4140
4174
  groupBy?: string;
4141
4175
  multiplicativeDistanceWeightScaling?: boolean;
4142
4176
  flagDeclarations?: NavigationFlagDeclarations;
4177
+ getDoorByNodeId: (nodeId: string) => DoorGeometry | undefined;
4143
4178
  });
4144
4179
  private getDisabledNodeIds;
4145
4180
  /**
@@ -4152,9 +4187,11 @@ declare class Navigator$1 {
4152
4187
  * @param {SimplifyDirectionsOptions} [simplify] - Options to simplify the pathfinding result.
4153
4188
  * @returns {DirectionsCollection} A collection of directional features representing the path.
4154
4189
  */
4155
- getDirections({ zones: directionsZones, originIds, destinationNodeIds, disabledConnectionNodeIds, simplify, multiplicativeDistanceWeightScaling, overrideEdgeWeights, }: {
4190
+ getDirections({ zones: directionsZones, originIds, from, to, destinationNodeIds, disabledConnectionNodeIds, simplify, multiplicativeDistanceWeightScaling, overrideEdgeWeights, }: {
4156
4191
  originIds: string[];
4157
4192
  destinationNodeIds: string[];
4193
+ from: NodeFeature[];
4194
+ to: NodeFeature[];
4158
4195
  zones?: DirectionsZone[];
4159
4196
  disabledConnectionNodeIds?: string[];
4160
4197
  simplify?: SimplifyDirectionsOptions;
@@ -4169,11 +4206,21 @@ declare class Navigator$1 {
4169
4206
  */
4170
4207
  private generatePath;
4171
4208
  /**
4172
- * Simplifies a sequence of steps by reducing unnecessary nodes using a buffer radius to check for obstructions.
4209
+ * Simplifies a sequence of steps by reducing unnecessary nodes using line-of-sight checks.
4210
+ *
4211
+ * Method Selection:
4212
+ * - 'greedy-los': Greedy forward scan with line-of-sight validation. Fastest, O(n) time complexity. Good default choice.
4213
+ * - 'rdp': Uses Ramer-Douglas-Peucker preprocessing + line-of-sight validation + door buffer nodes.
4214
+ * Better for paths with doors and complex geometry. Medium speed.
4215
+ * - 'dp-optimal': Dynamic Programming for globally optimal simplification. Slowest but highest quality, O(n²) complexity.
4216
+ * Best when path quality is critical (e.g., indoor navigation with many turns).
4217
+ *
4218
+ * Performance: greedy-los < rdp < dp-optimal
4219
+ * Quality: greedy-los < rdp < dp-optimal
4173
4220
  *
4174
4221
  * @param {Edge[]} steps - The steps to simplify.
4175
- * @param {number} bufferRadius - The buffer radius to use
4176
- * for simplification.
4222
+ * @param {SimplifyDirectionsOptions} options - Simplification options.
4223
+ * @param {boolean} multiplicativeDistanceWeightScaling - Distance weight scaling option.
4177
4224
  * @returns {Edge[]} An array of simplified edges representing a more direct path.
4178
4225
  */
4179
4226
  private simplifyAllSteps;
@@ -4216,6 +4263,8 @@ declare class Navigator$1 {
4216
4263
  * @returns {Edge[]} An array of simplified edges.
4217
4264
  */
4218
4265
  private simplifySteps;
4266
+ private simplifyStepsImprovedWithSimplifyBeforeLoSChecks;
4267
+ private simplifyStepsWithDPMethod;
4219
4268
  /**
4220
4269
  * Calculates the approximate distance between two geographic coordinates on Earth's surface.
4221
4270
  *
@@ -4297,13 +4346,14 @@ declare class DirectionsInternal {
4297
4346
  /**
4298
4347
  * @hidden
4299
4348
  */
4300
- constructor({ nodes, geojsonCollection, connections, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, }: {
4349
+ constructor({ nodes, geojsonCollection, connections, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, getDoorByNodeId, }: {
4301
4350
  nodes: ParsedMVF["node.geojson"];
4302
4351
  geojsonCollection: ParsedMVF["obstruction"] | ParsedMVF["space"];
4303
4352
  connections: ParsedMVF["connection.json"];
4304
4353
  groupBy?: string;
4305
4354
  multiplicativeDistanceWeightScaling?: boolean;
4306
4355
  flagDeclarations?: ParsedMVF["navigationFlags.json"];
4356
+ getDoorByNodeId: (nodeId: string) => DoorGeometry | undefined;
4307
4357
  });
4308
4358
  processTargets(fromNodesByTarget: Map<TNavigationTarget, string[]>, toNodesByTarget: Map<TNavigationTarget, string[]>, mapData: MapDataInternal): {
4309
4359
  originIds: string[];
@@ -4312,10 +4362,7 @@ declare class DirectionsInternal {
4312
4362
  };
4313
4363
  getDirections: (from: TNavigationTarget[], to: TNavigationTarget[], options: {
4314
4364
  accessible: boolean;
4315
- smoothing: {
4316
- enabled: boolean;
4317
- radius: number;
4318
- };
4365
+ smoothing: SimplifyDirectionsOptions;
4319
4366
  zones: TDirectionZone[];
4320
4367
  excludedConnections: Connection[];
4321
4368
  connectionIdWeightMap: Record<string, number>;
@@ -4323,10 +4370,7 @@ declare class DirectionsInternal {
4323
4370
  /** @deprecated use getDirections instead */
4324
4371
  getDirectionsSync: (from: TNavigationTarget[], to: TNavigationTarget[], options: {
4325
4372
  accessible: boolean;
4326
- smoothing: {
4327
- enabled: boolean;
4328
- radius: number;
4329
- };
4373
+ smoothing: SimplifyDirectionsOptions;
4330
4374
  zones: TDirectionZone[];
4331
4375
  excludedConnections: Connection[];
4332
4376
  connectionIdWeightMap: Record<string, number>;
@@ -4528,31 +4572,121 @@ type TGetDirectionsOptions = {
4528
4572
  */
4529
4573
  accessible?: boolean;
4530
4574
  /**
4531
- * Enable or disable line-of-sight directions smoothing.
4532
- * With this option enabled, the directions will be simplified to provide a more visually appealing path and shorter instructions.
4575
+ * Enable or disable path smoothing for directions.
4576
+ * When enabled, the path is simplified using line-of-sight checks to provide a more visually appealing route and shorter instructions.
4577
+ *
4578
+ * Can be a boolean to enable or disable smoothing, or an object with configuration options.
4533
4579
  *
4534
- * Can be a boolean to enable or disable smoothing, or an object with a radius property to specify the line of sight radius in metres.
4580
+ * **Available methods:**
4581
+ * - `'greedy-los'` (default): Greedy forward scan with line-of-sight validation. Fastest, O(n) time complexity. Good default choice.
4582
+ * - `'rdp'`: Uses Ramer-Douglas-Peucker preprocessing + line-of-sight validation + door buffer nodes. Better for paths with doors and complex geometry. Medium speed.
4583
+ * - `'dp-optimal'`: Dynamic Programming for globally optimal simplification. Slowest but highest quality, O(n²) complexity. Best when path quality is critical.
4535
4584
  *
4536
4585
  * @default true for non-enterprise mode, false for enterprise mode
4537
4586
  *
4538
4587
  * @example
4539
4588
  * ```ts
4540
- * // Enable smoothing with a radius of 3 metres
4589
+ * // Enable smoothing with default settings
4541
4590
  * mapView.getDirections(firstSpace, secondSpace, {
4542
- * smoothing: {
4543
- * radius: 3,
4591
+ * smoothing: true
4592
+ * })
4593
+ *
4594
+ * // Enable smoothing with custom radius (in meters)
4595
+ * mapView.getDirections(firstSpace, secondSpace, {
4596
+ * smoothing: {
4597
+ * radius: 1.5,
4544
4598
  * }
4545
4599
  * })
4546
4600
  *
4547
- * // Explicitly enable smoothing in enterprise mode
4601
+ * // Use greedy line-of-sight method (default, explicit)
4548
4602
  * mapView.getDirections(firstSpace, secondSpace, {
4549
- * smoothing: true
4603
+ * smoothing: {
4604
+ * enabled: true,
4605
+ * __EXPERIMENTAL_METHOD: 'greedy-los',
4606
+ * radius: 0.4,
4607
+ * }
4608
+ * })
4609
+ *
4610
+ * // Use RDP method (always uses line-of-sight)
4611
+ * mapView.getDirections(firstSpace, secondSpace, {
4612
+ * smoothing: {
4613
+ * enabled: true,
4614
+ * __EXPERIMENTAL_METHOD: 'rdp',
4615
+ * radius: 0.4,
4616
+ * }
4617
+ * })
4618
+ *
4619
+ * // Use DP-optimal method with door buffer nodes
4620
+ * mapView.getDirections(firstSpace, secondSpace, {
4621
+ * smoothing: {
4622
+ * enabled: true,
4623
+ * __EXPERIMENTAL_METHOD: 'dp-optimal',
4624
+ * __EXPERIMENTAL_INCLUDE_DOOR_BUFFER_NODES: true,
4625
+ * radius: 0.4,
4626
+ * }
4550
4627
  * })
4551
4628
  * ```
4552
4629
  */
4553
4630
  smoothing?: boolean | {
4631
+ /**
4632
+ * Enable or disable path smoothing.
4633
+ * @default true for non-enterprise mode, false for enterprise mode
4634
+ */
4635
+ enabled?: boolean;
4636
+ /**
4637
+ * The radius of the buffer around the path to consider when simplifying, in meters.
4638
+ * @default 0.75
4639
+ */
4640
+ radius?: number;
4641
+ /**
4642
+ * @experimental
4643
+ * Path smoothing method using greedy line-of-sight algorithm.
4644
+ * Fastest method with O(n) time complexity. Good default choice.
4645
+ * @default 'greedy-los'
4646
+ */
4647
+ __EXPERIMENTAL_METHOD?: "greedy-los";
4648
+ } | {
4649
+ /**
4650
+ * Enable or disable path smoothing.
4651
+ * @default true for non-enterprise mode, false for enterprise mode
4652
+ */
4653
+ enabled?: boolean;
4654
+ /**
4655
+ * The radius of the buffer around the path to consider when simplifying, in meters.
4656
+ * @default 0.75
4657
+ */
4658
+ radius?: number;
4659
+ /**
4660
+ * @experimental
4661
+ * Path smoothing method using Ramer-Douglas-Peucker preprocessing with line-of-sight validation.
4662
+ * Better for paths with doors and complex geometry. Medium speed.
4663
+ * Always uses line-of-sight validation (cannot be disabled).
4664
+ */
4665
+ __EXPERIMENTAL_METHOD: "rdp";
4666
+ } | {
4667
+ /**
4668
+ * Enable or disable path smoothing.
4669
+ * @default true for non-enterprise mode, false for enterprise mode
4670
+ */
4554
4671
  enabled?: boolean;
4555
- radius: number;
4672
+ /**
4673
+ * The radius of the buffer around the path to consider when simplifying, in meters.
4674
+ * @default 0.75
4675
+ */
4676
+ radius?: number;
4677
+ /**
4678
+ * @experimental
4679
+ * Path smoothing method using Dynamic Programming for globally optimal simplification.
4680
+ * Slowest but highest quality, O(n²) complexity. Best when path quality is critical.
4681
+ */
4682
+ __EXPERIMENTAL_METHOD: "dp-optimal";
4683
+ /**
4684
+ * @experimental
4685
+ * Whether to include 0.5m buffer nodes perpendicular to doors in DP simplification.
4686
+ * When true, predecessor and successor nodes of doors are marked with preventSmoothing.
4687
+ * @default false
4688
+ */
4689
+ __EXPERIMENTAL_INCLUDE_DOOR_BUFFER_NODES?: boolean;
4556
4690
  };
4557
4691
  /**
4558
4692
  * Defines the special zones for navigation operations.
@@ -5481,8 +5615,7 @@ declare class Connection extends DetailedMapData<Feature<Point, SpaceProperties>
5481
5615
  * @internal
5482
5616
  */
5483
5617
  constructor(data: MapDataInternal, options: {
5484
- mvfDataByFloorId: Record<string, FeatureCollection<Point, SpaceProperties>["features"][number]> | Record<string, Feature<Point, MVFConnection>>;
5485
- accessible?: boolean;
5618
+ mvfData: MVFConnection;
5486
5619
  });
5487
5620
  /**
5488
5621
  * Whether the connection is accessible. For example elevators are accessible while stairs are not.
@@ -5518,10 +5651,6 @@ declare class Connection extends DetailedMapData<Feature<Point, SpaceProperties>
5518
5651
  * @returns {Floor[]} An array of floors for the connection.
5519
5652
  */
5520
5653
  get floors(): Floor[];
5521
- /**
5522
- * Gets the location profiles ({@link LocationProfile}) associated with the connection.
5523
- */
5524
- get locationProfiles(): LocationProfile[];
5525
5654
  /** @internal */
5526
5655
  get focusTarget(): Coordinate[];
5527
5656
  /**
@@ -6150,8 +6279,6 @@ type MapDataRecords = {
6150
6279
  locationProfilesByExternalId: Record<string, LocationProfile[]>;
6151
6280
  objectEntranceNodeIdsByObstructionId: Record<string, string[]>;
6152
6281
  obstructionIdByEntranceId: Record<string, string>;
6153
- connectionIdsByLatLon: Record<string, string[]>;
6154
- mvfConnectionIdsByLatLon: Record<string, string[]>;
6155
6282
  locationProfilesByAttachedFeatureId: Record<string, LocationProfile[]>;
6156
6283
  mvfSpacesById: Record<string, SpaceCollection["features"][number]>;
6157
6284
  mvfNodesById: Record<string, NodeCollection["features"][number]>;
@@ -6740,7 +6867,6 @@ declare class MapDataInternal extends PubSub<{
6740
6867
  mvfAnnotationsById: MapDataRecords["mvfAnnotationsById"];
6741
6868
  mvfConnectionsById: MapDataRecords["mvfConnectionsById"];
6742
6869
  mvfConnectionsByNodeId: MapDataRecords["mvfConnectionsByNodeId"];
6743
- mvfConnectionIdsByLatLon: MapDataRecords["mvfConnectionIdsByLatLon"];
6744
6870
  mvfEntrancesById: MapDataRecords["mvfEntrancesById"];
6745
6871
  mvfNodesById: MapDataRecords["mvfNodesById"];
6746
6872
  mvfObstructionById: MapDataRecords["mvfObstructionById"];
@@ -6756,7 +6882,6 @@ declare class MapDataInternal extends PubSub<{
6756
6882
  floorStacksByExternalId: MapDataRecords["floorStacksByExternalId"];
6757
6883
  doorsByExternalId: MapDataRecords["doorsByExternalId"];
6758
6884
  areasByExternalId: MapDataRecords["areasByExternalId"];
6759
- connectionSpaceIdsByLatLon: MapDataRecords["connectionIdsByLatLon"];
6760
6885
  locationProfilesByAttachedFeatureId: MapDataRecords["locationProfilesByAttachedFeatureId"];
6761
6886
  entranceNodeIdsBySpaceId?: MapDataRecords["entranceNodeIdsBySpaceId"];
6762
6887
  locationsById: EnterpriseMapDataRecords["locationsById"];
@@ -6955,6 +7080,13 @@ declare class MapDataInternal extends PubSub<{
6955
7080
  getDirections: (from: TNavigationTarget | TNavigationTarget[], to: TNavigationTarget | TNavigationTarget[], opt?: TGetDirectionsOptions) => Promise<Directions | undefined>;
6956
7081
  getDirectionsMultiDestination: (from: TNavigationTarget | TNavigationTarget[], to: TNavigationTarget | (TNavigationTarget | TNavigationTarget[])[], opt?: TGetDirectionsOptions) => Promise<Directions[] | undefined>;
6957
7082
  getDistance(from: Space | Door | Coordinate | MapObject | PointOfInterest | Annotation | Node$1 | EnterpriseLocation | Area, to: Space | Door | Coordinate | MapObject | PointOfInterest | Annotation | Node$1 | EnterpriseLocation | Area): number;
7083
+ /**
7084
+ * Gets the door associated with a node.
7085
+ *
7086
+ * @param nodeId The ID of the node to check
7087
+ * @returns The door object if the node is associated with a door, undefined otherwise
7088
+ */
7089
+ getDoorByNodeId: (nodeId: string) => Door | undefined;
6958
7090
  transformImageRequest: (url: string) => Promise<{
6959
7091
  url: string;
6960
7092
  }>;