@mappedin/events 6.7.0-beta.0 → 6.8.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.
@@ -1,4 +1,4 @@
1
- import { AnnotationCollection, AnnotationSymbol, AreaCollection, AreaId, Category as MVFCategory, CategoryId, Connection as MVFConnection, Details, EnterpriseCategory as MVFEnterpriseCategory, EnterpriseCategory as MvfEnterpriseCategory, EnterpriseCategoryId as MVFEnterpriseCategoryId, EnterpriseLocation as MVFEnterpriseLocation, EnterpriseLocation as MvfEnterpriseLocation, EnterpriseLocationId as MVFEnterpriseLocationId, EnterpriseLocationInstance, EnterpriseVenue as MVFEnterpriseVenue, EnterpriseVenueType, EntranceCollection, EntranceFeature, Facade as MVFFacade, Feature, Feature as MVFFeature, FeatureCollection, FloorCollection, FloorProperties as MVFFloor, FloorProperties as MvfFloor, FloorStack as MVFFloorStack, FloorStack as MvfFloorStack, Geometry, Hyperlink as MVFHyperlink, Image as MVFImage, Language, LineStringStyle as TMVFLineStringStyle, Location as MVFLocation, LocationId, LocationLink, LocationSocial, LocationState, MultiPolygon, NavigationFlagDeclarations, NodeCollection, NodeCollection as MVFNodeCollection, NodeId, ObstructionCollection, ObstructionFeature, ObstructionId, ObstructionProperties, OpeningHoursSpecification, OperationHours, ParsedMVF, ParsedMVF as TMVF, ParsedMVFLocalePack, Point, PointStyle as TMVFPointStyle, Polygon, PolygonStyle as TMVFPolygonStyle, SiblingGroup, SpaceCollection, SpaceFeature, SpaceId, SpaceProperties, Style as TMVFStyle, StyleCollection as TMVFStyleCollection, TilesetStyle } from '@mappedin/mvf-v2';
1
+ import { AnnotationCollection, AnnotationSymbol, AreaCollection, AreaId, Category as MVFCategory, CategoryId, Connection as MVFConnection, Details, EnterpriseCategory as MVFEnterpriseCategory, EnterpriseCategory as MvfEnterpriseCategory, EnterpriseCategoryId as MVFEnterpriseCategoryId, EnterpriseLocation as MVFEnterpriseLocation, EnterpriseLocation as MvfEnterpriseLocation, EnterpriseLocationId as MVFEnterpriseLocationId, EnterpriseLocationInstance, EnterpriseVenue as MVFEnterpriseVenue, EnterpriseVenueType, EntranceCollection, EntranceFeature, Facade as MVFFacade, Feature, Feature as MVFFeature, FeatureCollection, FloorCollection, FloorProperties as MVFFloor, FloorProperties as MvfFloor, FloorStack as MVFFloorStack, FloorStack as MvfFloorStack, Geometry, Hyperlink as MVFHyperlink, Image as MVFImage, Language, LineStringStyle as TMVFLineStringStyle, Location as MVF2Location, LocationId, LocationLink, LocationSocial, LocationState, MultiPolygon, NavigationFlagDeclarations, NodeCollection, NodeCollection as MVFNodeCollection, NodeId, ObstructionCollection, ObstructionFeature, ObstructionId, ObstructionProperties, OpeningHoursSpecification, OperationHours, ParsedMVF, ParsedMVF as TMVF, ParsedMVFLocalePack, ParsedMVFv3, Point, PointStyle as TMVFPointStyle, Polygon, PolygonStyle as TMVFPolygonStyle, SiblingGroup, SpaceCollection, SpaceFeature, SpaceId, SpaceProperties, Style as TMVFStyle, StyleCollection as TMVFStyleCollection, TilesetStyle } from '@mappedin/mvf-v2';
2
2
  import { ParsedMVF } from '@mappedin/mvf-v2/no-validator';
3
3
 
4
4
  declare const VALID_CONTEXTS: readonly [
@@ -4016,7 +4016,6 @@ type NodeProperties = {
4016
4016
  * */
4017
4017
  [name: string]: any;
4018
4018
  };
4019
- type NodeCollection$1 = FeatureCollection$1<Point$1, NodeProperties>;
4020
4019
  type NodeFeature = Feature$1<Point$1, NodeProperties>;
4021
4020
  declare class Edge {
4022
4021
  /** The originating node of the edge */
@@ -4046,64 +4045,6 @@ declare class Edge {
4046
4045
  multiplicativeDistanceWeightScaling?: boolean;
4047
4046
  });
4048
4047
  }
4049
- declare class NavigationGraph {
4050
- #private;
4051
- readonly edges: {
4052
- [propName: string]: Edge[];
4053
- };
4054
- readonly nodesById: {
4055
- [propName: string]: NodeFeature;
4056
- };
4057
- readonly nodesByGroup: Map<string, NodeFeature[]>;
4058
- constructor({ nodes, groupBy, multiplicativeDistanceWeightScaling, }: {
4059
- nodes: NodeCollection$1;
4060
- groupBy: string;
4061
- multiplicativeDistanceWeightScaling?: boolean;
4062
- });
4063
- /**
4064
- * Calculates the shortest Euclidean distance from the origin node to any of the destination nodes.
4065
- *
4066
- * @param origin - The origin node.
4067
- * @param destinations - An array of destination nodes.
4068
- * @returns The shortest Euclidean distance.
4069
- */
4070
- getShortestEuclideanDistance(origin: NodeFeature, destinations: NodeFeature[]): number;
4071
- hasLineOfSight: (origin: Position, destination: Position, edges?: Position[][], bufferRadius?: number) => boolean;
4072
- /**
4073
- * Performs a Dijkstra search to find nodes within a given travel distance that satisfy a goal function, sorted by distance.
4074
- *
4075
- * @param originId - Origin node ID.
4076
- * @param maxTravelDistance - The maximum travel distance.
4077
- * @param includedNodeIds - Array of node IDs to include in the search.
4078
- * @param obstructionEdges - Array of obstruction edges for line of sight calculations.
4079
- * @param useLineOfSight - Whether to use line of sight checking.
4080
- * @returns An Array of nodes within the travel distance that satisfy the goal function.
4081
- * - feature: The node feature.
4082
- * - distance: The distance to the node.
4083
- * - edges: The edges to the node.
4084
- */
4085
- dijkstraFindWithinTravelDistance(originId: string, maxTravelDistance: number, includedNodeIds: string[], obstructionEdges: Position[][], useLineOfSight: boolean, limitNumberOfResults: number): {
4086
- feature: NodeFeature;
4087
- distance: number;
4088
- }[];
4089
- /**
4090
- * Performs A* pathfinding from specified origins to destinations, considering optional constraints like accessibility.
4091
- *
4092
- * @param {string[]} originIds - Array of origin node IDs.
4093
- * @param {string[]} destinationNodeIds - Array of destination node IDs.
4094
- * @param {Set<string>} [disabledConnectionNodeIds] - Optional set of connection node IDs that are disabled (ie. act as regular nodes).
4095
- * @param {Set<string>} [disabledNodeIds] - Optional set of node IDs which are ignored during pathfinding.
4096
- * @returns {Edge[]} An array of edges representing the shortest path, or an empty array if no path is found.
4097
- */
4098
- aStar({ originIds, destinationNodeIds, disabledConnectionNodeIds, zones, overrideEdgeWeights, disabledNodeIds, }: {
4099
- originIds: string[];
4100
- destinationNodeIds: string[];
4101
- zones: DirectionsZone[];
4102
- disabledConnectionNodeIds?: Set<string>;
4103
- overrideEdgeWeights?: Map<Edge, number>;
4104
- disabledNodeIds?: Set<string>;
4105
- }): Edge[];
4106
- }
4107
4048
  type DirectionProperties = {
4108
4049
  /**
4109
4050
  * Unique identifier for the direction.
@@ -4127,204 +4068,6 @@ type DirectionProperties = {
4127
4068
  };
4128
4069
  type DirectionFeature = Feature$1<Point$1, DirectionProperties>;
4129
4070
  type DirectionsCollection = FeatureCollection$1<Point$1, DirectionProperties>;
4130
- interface DoorGeometry {
4131
- geoJSON: {
4132
- geometry: {
4133
- coordinates: [
4134
- [
4135
- number,
4136
- number
4137
- ],
4138
- [
4139
- number,
4140
- number
4141
- ]
4142
- ];
4143
- };
4144
- };
4145
- }
4146
- type BaseSimplifyOptions = {
4147
- /**
4148
- * Enable or disable simplifying.
4149
- */
4150
- enabled: boolean;
4151
- /**
4152
- * The radius of the buffer around the path to consider when simplifying, in meters.
4153
- * @default 0.4
4154
- */
4155
- radius?: number;
4156
- };
4157
- type GreedyLosOptions = BaseSimplifyOptions & {
4158
- __EXPERIMENTAL_METHOD?: "greedy-los";
4159
- };
4160
- type RdpOptions = BaseSimplifyOptions & {
4161
- __EXPERIMENTAL_METHOD: "rdp";
4162
- /**
4163
- * Whether to include door-adjacent nodes (predecessor/successor of doors) in the must-include set.
4164
- * When true, nodes immediately before and after doors are preserved during simplification.
4165
- * @default true
4166
- */
4167
- mustIncludeDoorBufferNodes?: boolean;
4168
- };
4169
- type DpOptimalOptions = BaseSimplifyOptions & {
4170
- __EXPERIMENTAL_METHOD: "dp-optimal";
4171
- /**
4172
- * Whether to include door buffer nodes in DP simplification.
4173
- * When true, predecessor and successor nodes of doors are marked with preventSmoothing.
4174
- * @default false
4175
- */
4176
- includeDoorBufferNodes?: boolean;
4177
- };
4178
- type SimplifyDirectionsOptions = GreedyLosOptions | RdpOptions | DpOptimalOptions;
4179
- type DirectionsZone = {
4180
- geometry: Feature$1<MultiPolygon$1 | Polygon$1>;
4181
- /**
4182
- * The additional cost for navigation through the zone.
4183
- */
4184
- cost: number;
4185
- /**
4186
- *
4187
- * Additional property specific to the navigator based on the 'groupBy' option.
4188
- */
4189
- [index: string]: any;
4190
- };
4191
- declare class Navigator$1 {
4192
- private groupBy;
4193
- graph: NavigationGraph;
4194
- private geometryEdgesByMapId;
4195
- private flagDeclarations;
4196
- private getDoorByNodeId;
4197
- private disabledNodeIds;
4198
- /**
4199
- * Constructs a Navigator instance to manage pathfinding with optional obstructions and grouping features.
4200
- *
4201
- * @param {NodeCollection} nodes - Collection of nodes for the navigation graph.
4202
- * @param {ObstructionCollection} [obstructions] - Optional collection of obstructions that could block paths.
4203
- * @param {SpaceCollection} [spaces] - Optional collection of spaces that could block paths.
4204
- * @param {string} [groupBy] - Optional property name to group nodes and paths for differentiated processing.
4205
- * @param {Function} getDoorByNodeId - Function to get door object by node ID.
4206
- */
4207
- constructor({ nodes, geojsonCollection, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, getDoorByNodeId, }: {
4208
- nodes: NodeCollection$1;
4209
- geojsonCollection?: ObstructionCollection | SpaceCollection;
4210
- groupBy?: string;
4211
- multiplicativeDistanceWeightScaling?: boolean;
4212
- flagDeclarations?: NavigationFlagDeclarations;
4213
- getDoorByNodeId: (nodeId: string) => DoorGeometry | undefined;
4214
- });
4215
- private getDisabledNodeIds;
4216
- /**
4217
- * Calculates and returns a set of directions from origin nodes to destination nodes, including detailed properties.
4218
- *
4219
- * @param {DirectionsZone[]} zones - special zones for navigation operations.
4220
- * @param {string[]} originIds - IDs of origin nodes.
4221
- * @param {string[]} destinationNodeIds - IDs of destination nodes.
4222
- * @param {string[]} [disabledConnectionNodeIds] - IDs of connection nodes that are disabled (ie. act as regular nodes).
4223
- * @param {SimplifyDirectionsOptions} [simplify] - Options to simplify the pathfinding result.
4224
- * @returns {DirectionsCollection} A collection of directional features representing the path.
4225
- */
4226
- getDirections({ zones: directionsZones, originIds, from, to, destinationNodeIds, disabledConnectionNodeIds, simplify, multiplicativeDistanceWeightScaling, overrideEdgeWeights, }: {
4227
- originIds: string[];
4228
- destinationNodeIds: string[];
4229
- from: NodeFeature[];
4230
- to: NodeFeature[];
4231
- zones?: DirectionsZone[];
4232
- disabledConnectionNodeIds?: string[];
4233
- simplify?: SimplifyDirectionsOptions;
4234
- multiplicativeDistanceWeightScaling?: boolean;
4235
- overrideEdgeWeights?: Map<Edge, number>;
4236
- }): DirectionsCollection;
4237
- /**
4238
- * Generates a path from a series of edges, constructing a feature collection of directional steps.
4239
- *
4240
- * @param {Edge[]} steps - An array of edges representing the path.
4241
- * @returns {DirectionsCollection} A collection of directional features.
4242
- */
4243
- private generatePath;
4244
- /**
4245
- * Simplifies a sequence of steps by reducing unnecessary nodes using line-of-sight checks.
4246
- *
4247
- * Method Selection:
4248
- * - 'greedy-los': Greedy forward scan with line-of-sight validation. Fastest, O(n) time complexity. Good default choice.
4249
- * - 'rdp': Uses Ramer-Douglas-Peucker preprocessing + line-of-sight validation + door buffer nodes.
4250
- * Better for paths with doors and complex geometry. Medium speed.
4251
- * - 'dp-optimal': Dynamic Programming for globally optimal simplification. Slowest but highest quality, O(n²) complexity.
4252
- * Best when path quality is critical (e.g., indoor navigation with many turns).
4253
- *
4254
- * Performance: greedy-los < rdp < dp-optimal
4255
- * Quality: greedy-los < rdp < dp-optimal
4256
- *
4257
- * @param {Edge[]} steps - The steps to simplify.
4258
- * @param {SimplifyDirectionsOptions} options - Simplification options.
4259
- * @param {boolean} multiplicativeDistanceWeightScaling - Distance weight scaling option.
4260
- * @returns {Edge[]} An array of simplified edges representing a more direct path.
4261
- */
4262
- private simplifyAllSteps;
4263
- /**
4264
- * Finds the nearest nodes on the graph within a given travel distance.
4265
- *
4266
- * @param originId - The ID of the origin node.
4267
- * @param maxDistance - The maximum distance to search.
4268
- * @param floorId - The ID of the floor.
4269
- * @param includedNodeIds - The IDs of the nodes to include.
4270
- * @param useLineOfSight - Whether to use line of sight.
4271
- * @returns An array of nodes within the travel distance that satisfy the goal function.
4272
- */
4273
- findNearestNodesOnGraph: (originId: string, maxDistance: number, floorId: string, includedNodeIds: string[], useLineOfSight?: boolean, limitNumberOfResults?: number) => {
4274
- feature: NodeFeature;
4275
- distance: number;
4276
- }[];
4277
- /**
4278
- * Checks if there is a line of sight between two points on the map.
4279
- *
4280
- * @param origin - The origin point.
4281
- * @param destination - The destination point.
4282
- * @param floorId - The ID of the floor.
4283
- * @param bufferRadius - The buffer radius to use when checking for line of sight.
4284
- * @returns True if there is a line of sight, false otherwise.
4285
- */
4286
- hasLineOfSight: (origin: [
4287
- number,
4288
- number
4289
- ], destination: [
4290
- number,
4291
- number
4292
- ], floorId: string, bufferRadius?: number) => boolean;
4293
- /**
4294
- * Simplifies a section of steps by checking direct lines of sight between steps and eliminating intermediate nodes if unobstructed.
4295
- *
4296
- * @param {Edge[]} steps - The steps to potentially simplify.
4297
- * @param {[number, number][][]} geometryEdges - The geometrical edges of the map used to check for line of sight.
4298
- * @param {number} bufferRadius - The buffer radius to use when simplifying.
4299
- * @returns {Edge[]} An array of simplified edges.
4300
- */
4301
- private simplifySteps;
4302
- private simplifyStepsImprovedWithSimplifyBeforeLoSChecks;
4303
- private simplifyStepsWithDPMethod;
4304
- /**
4305
- * Calculates the approximate distance between two geographic coordinates on Earth's surface.
4306
- *
4307
- * This function uses the equirectangular approximation method to compute the distance, which simplifies
4308
- * the math and speeds up calculations, but is less accurate over long distances compared to other methods
4309
- * like the haversine formula.
4310
- *
4311
- * @param {Position} point1 - The first point's longitude and latitude as [longitude, latitude].
4312
- * @param {Position} point2 - The second point's longitude and latitude as [longitude, latitude].
4313
- * @return
4314
- * @return {number} The approximate distance between the two points in meters.
4315
- */
4316
- getDistance: (point1: Position, point2: Position) => number;
4317
- /**
4318
- * Calculates the angle between two geographic coordinates.
4319
- *
4320
- * @param {Position} point1 - The first point's longitude and latitude as [longitude, latitude].
4321
- * @param {Position} point2 - The second point's longitude and latitude as [longitude, latitude].
4322
- * @hidden
4323
- *
4324
- * @return {number} The angle in radians, calculated clockwise from the north between the two points specified.
4325
- */
4326
- getAngle: (point1: Position, point2: Position) => number;
4327
- }
4328
4071
  declare class Directions {
4329
4072
  #private;
4330
4073
  id: string;
@@ -4375,79 +4118,6 @@ declare class Directions {
4375
4118
  instructions: TDirectionInstruction[];
4376
4119
  };
4377
4120
  }
4378
- declare class DirectionsInternal {
4379
- #private;
4380
- navigator: Navigator$1;
4381
- private readonly connections;
4382
- /**
4383
- * @hidden
4384
- */
4385
- constructor({ nodes, geojsonCollection, connections, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, getDoorByNodeId, }: {
4386
- nodes: ParsedMVF["node.geojson"];
4387
- geojsonCollection: ParsedMVF["obstruction"] | ParsedMVF["space"];
4388
- connections: ParsedMVF["connection.json"];
4389
- groupBy?: string;
4390
- multiplicativeDistanceWeightScaling?: boolean;
4391
- flagDeclarations?: ParsedMVF["navigationFlags.json"];
4392
- getDoorByNodeId: (nodeId: string) => DoorGeometry | undefined;
4393
- });
4394
- processTargets(fromNodesByTarget: Map<TNavigationTarget, string[]>, toNodesByTarget: Map<TNavigationTarget, string[]>, mapData: MapDataInternal): {
4395
- originIds: string[];
4396
- destinationNodeIds: string[];
4397
- featureToNodeIdsMap: Map<TNavigationTarget, string[]>;
4398
- };
4399
- getDirections: (from: TNavigationTarget[], to: TNavigationTarget[], options: {
4400
- accessible: boolean;
4401
- smoothing: SimplifyDirectionsOptions;
4402
- zones: TDirectionZone[];
4403
- excludedConnections: Connection[];
4404
- connectionIdWeightMap: Record<string, number>;
4405
- }, mapData: MapDataInternal) => Promise<Directions | undefined>;
4406
- /** @deprecated use getDirections instead */
4407
- getDirectionsSync: (from: TNavigationTarget[], to: TNavigationTarget[], options: {
4408
- accessible: boolean;
4409
- smoothing: SimplifyDirectionsOptions;
4410
- zones: TDirectionZone[];
4411
- excludedConnections: Connection[];
4412
- connectionIdWeightMap: Record<string, number>;
4413
- }, mapData: MapDataInternal) => Directions | undefined;
4414
- /**
4415
- * Get the node IDs of connections that do not match the accessibility setting provided.
4416
- * A disabled connection node is a connection node that acts as a regular node
4417
- * (ie. the edges that would cause a floor change are ignored).
4418
- *
4419
- * @hidden
4420
- * @param accessible {boolean}
4421
- */
4422
- getDisabledConnectionNodeIds: (accessible: boolean) => string[];
4423
- /**
4424
- * If the navigation targets are coordinates, make sure to include them in the final directions. For other
4425
- * data types (e.g. POIs, Doors, Spaces), the coordinate should have a coincidental node generated in the
4426
- * navigation graph already, so this is unnecessary.
4427
- *
4428
- * @hidden
4429
- * @param directions
4430
- * @param from {TNavigationTarget[]}
4431
- * @param to {TNavigationTarget[]}
4432
- */
4433
- private addCoordinateDirections;
4434
- /**
4435
- * Create an geojson collection from the parsed MVF.
4436
- *
4437
- * @hidden
4438
- * @param obstructions
4439
- */
4440
- private createCollection;
4441
- /**
4442
- * Create a direction feature.
4443
- *
4444
- * @hidden
4445
- * @param coordinate
4446
- * @param angle
4447
- * @param distance
4448
- */
4449
- private createDirectionFeature;
4450
- }
4451
4121
  declare class Shape implements IFocusable {
4452
4122
  /**
4453
4123
  * id of Shape
@@ -5020,7 +4690,8 @@ declare class ImageMetaData extends BaseMetaData {
5020
4690
  */
5021
4691
  destroy(): void;
5022
4692
  }
5023
- type LocationData = Omit<MVFLocation, "categories" | "spaces" | "obstructions" | "entrances" | "shapes" | "connections" | "annotations" | "areas" | "openingHoursSpecification" | "links" | "pictures" | "website" | "icon"> & {
4693
+ type MVF3Location = Required<ParsedMVFv3>["locations"][number];
4694
+ type LocationData = Omit<MVF2Location, "categories" | "spaces" | "obstructions" | "entrances" | "shapes" | "connections" | "annotations" | "areas" | "openingHoursSpecification" | "links" | "pictures" | "website" | "icon"> & {
5024
4695
  links: Hyperlink[];
5025
4696
  images: ImageMetaData[];
5026
4697
  icon?: ImageMetaData;
@@ -5075,9 +4746,28 @@ declare class LocationProfile extends BaseMetaData implements LocationData, IFoc
5075
4746
  * @format uri
5076
4747
  */
5077
4748
  icon?: ImageMetaData;
4749
+ /**
4750
+ * Additional user defined data. The type is unknown, so it is recommended to validate the data before use.
4751
+ *
4752
+ * _Only available when loading MVFv3 data._
4753
+ *
4754
+ * ```ts
4755
+ * const mapData = await getMapData({
4756
+ * ...
4757
+ * mvfVersion: '3.0.0',
4758
+ * });
4759
+ *
4760
+ * const locationProfile = mapData.getById('location-profile', id);
4761
+ * if (typeof locationProfile?.extra?.myProperty === 'string') {
4762
+ * // Do something
4763
+ * }
4764
+ * ```
4765
+ */
4766
+ extra?: Record<string, unknown>;
5078
4767
  /** @internal */
5079
4768
  constructor(data: MapDataInternal, options: {
5080
- mvfData: MVFLocation;
4769
+ mvf2Data: MVF2Location;
4770
+ mvf3Data?: MVF3Location;
5081
4771
  });
5082
4772
  /**
5083
4773
  * Gets the {@link Space}s associated with the location.
@@ -5921,6 +5611,7 @@ type TMapDataInternalOptions = {
5921
5611
  binaryBundle?: Uint8Array;
5922
5612
  tokenManager?: TokenManager;
5923
5613
  getMapDataOptions?: TGetMapDataOptions;
5614
+ mvf3?: ParsedMVFv3;
5924
5615
  };
5925
5616
  type MVFNodeFeature = MVFNodeCollection["features"][number];
5926
5617
  type MVFFloorFeature = FloorCollection["features"][number];
@@ -6348,6 +6039,7 @@ type MapDataRecords = {
6348
6039
  [floorId: string]: AnnotationCollection["features"][number][];
6349
6040
  };
6350
6041
  mvfAreasById: Record<AreaId, AreaCollection["features"][number]>;
6042
+ mvf3LocationsById: Record<string, Required<ParsedMVFv3>["locations"][number]>;
6351
6043
  };
6352
6044
  type EnterpriseMapDataRecords = {
6353
6045
  connectionsByExternalId: Record<string, Connection[]>;