venue-js 1.2.0-next.14 → 1.2.0-next.15

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/dist/index.d.mts CHANGED
@@ -394,6 +394,29 @@ type Page = {
394
394
  id: Id;
395
395
  attributes: Record<string, unknown>;
396
396
  };
397
+ type Model3dGeometry = null;
398
+ type Model3dProperties = {
399
+ name: {
400
+ en: string;
401
+ };
402
+ model: string;
403
+ level_id: null;
404
+ project_id: string;
405
+ rotation_x: number;
406
+ rotation_y: number;
407
+ rotation_z: number;
408
+ center: number[];
409
+ scale: number;
410
+ altitude: 0;
411
+ translation_x: number;
412
+ translation_y: number;
413
+ translation_z: number;
414
+ createdAt: string;
415
+ updatedAt: string;
416
+ publishedAt: string;
417
+ locale: string;
418
+ };
419
+ type Model3dFeature = ImdfFeature<Model3dGeometry, Model3dProperties>;
397
420
  type FeatureResponseMap = {
398
421
  address: ImdfFeature;
399
422
  amenity: AmenityFeature;
@@ -417,6 +440,7 @@ type FeatureResponseMap = {
417
440
  promotion: PromotionFeature;
418
441
  label: LabelFeature;
419
442
  element: ElementFeature;
443
+ model3d: Model3dFeature;
420
444
  "sponsored-content": SponsoredContentFeature;
421
445
  page: Page;
422
446
  };
@@ -642,6 +666,7 @@ type FeaturePopulatedResponseMap = {
642
666
  promotion: PromotionFeature;
643
667
  label: LabelFeature;
644
668
  element: ImdfFeature;
669
+ model3d: Model3dFeature;
645
670
  "sponsored-content": SponsoredContentFeature;
646
671
  page: Page;
647
672
  };
@@ -1263,4 +1288,4 @@ declare const VENUE_EVENTS: {
1263
1288
  VENUE_MOVEINTOVIEW: string;
1264
1289
  };
1265
1290
 
1266
- export { ALL_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_LOCALE, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, type IAllVenuesViewConfig, type IExtrudeConfig, type IGraphFeatureOptions, type IGraphOptions, type IHighlightOptions, IMDF_FEATURE_TYPES, type IMapAnimation, type IMapConfig, type IMapExtrudeConfig, type ISetHighlight2DElementIdsOptions, type IUnitDistanceModifier, type IVerticalGraphOptions, type Id, type ImdfFeature, IndoorMap, type IndoorMapOptions, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, occupantHelper as OccupantHelpers, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, PulsingMarker, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type SymbolSet, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, type TextMarkerOptions, TextSpriteMarker, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap, fetchDeliveryApi, fetchPreviewApi, getBearingBetweenPoints, getCenterFromGeometry, getDataClient, getExtrudeConfigByFeature, getFeatureByLocationId, getLocationByAmenity, getLocationByFeature, getLocationByOccupant, getLocationIdByFeature, getOrdinalByLocationId, getRelatedLocationIdsByFeature, getRelatedLocationsByAmenity, getRelatedLocationsByFeature, getRelatedLocationsByOccupant, getSuitablyValueBetweenBearings, isClickableFeature, isValidCoordinate, isValidLineString, isValidLineStringCoordinates, isValidMultiPolygon, isValidMultiPolygonCoordinates, isValidPoint, isValidPolygon, isValidPolygonCoordinates, matchFilter, matchFilters, safeFetchFeature, styledFeatureGenerator };
1291
+ export { ALL_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_LOCALE, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, type IAllVenuesViewConfig, type IExtrudeConfig, type IGraphFeatureOptions, type IGraphOptions, type IHighlightOptions, IMDF_FEATURE_TYPES, type IMapAnimation, type IMapConfig, type IMapExtrudeConfig, type ISetHighlight2DElementIdsOptions, type IUnitDistanceModifier, type IVerticalGraphOptions, type Id, type ImdfFeature, IndoorMap, type IndoorMapOptions, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, type Model3dFeature, type Model3dGeometry, type Model3dProperties, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, occupantHelper as OccupantHelpers, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, PulsingMarker, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type SymbolSet, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, type TextMarkerOptions, TextSpriteMarker, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap, fetchDeliveryApi, fetchPreviewApi, getBearingBetweenPoints, getCenterFromGeometry, getDataClient, getExtrudeConfigByFeature, getFeatureByLocationId, getLocationByAmenity, getLocationByFeature, getLocationByOccupant, getLocationIdByFeature, getOrdinalByLocationId, getRelatedLocationIdsByFeature, getRelatedLocationsByAmenity, getRelatedLocationsByFeature, getRelatedLocationsByOccupant, getSuitablyValueBetweenBearings, isClickableFeature, isValidCoordinate, isValidLineString, isValidLineStringCoordinates, isValidMultiPolygon, isValidMultiPolygonCoordinates, isValidPoint, isValidPolygon, isValidPolygonCoordinates, matchFilter, matchFilters, safeFetchFeature, styledFeatureGenerator };
package/dist/index.d.ts CHANGED
@@ -394,6 +394,29 @@ type Page = {
394
394
  id: Id;
395
395
  attributes: Record<string, unknown>;
396
396
  };
397
+ type Model3dGeometry = null;
398
+ type Model3dProperties = {
399
+ name: {
400
+ en: string;
401
+ };
402
+ model: string;
403
+ level_id: null;
404
+ project_id: string;
405
+ rotation_x: number;
406
+ rotation_y: number;
407
+ rotation_z: number;
408
+ center: number[];
409
+ scale: number;
410
+ altitude: 0;
411
+ translation_x: number;
412
+ translation_y: number;
413
+ translation_z: number;
414
+ createdAt: string;
415
+ updatedAt: string;
416
+ publishedAt: string;
417
+ locale: string;
418
+ };
419
+ type Model3dFeature = ImdfFeature<Model3dGeometry, Model3dProperties>;
397
420
  type FeatureResponseMap = {
398
421
  address: ImdfFeature;
399
422
  amenity: AmenityFeature;
@@ -417,6 +440,7 @@ type FeatureResponseMap = {
417
440
  promotion: PromotionFeature;
418
441
  label: LabelFeature;
419
442
  element: ElementFeature;
443
+ model3d: Model3dFeature;
420
444
  "sponsored-content": SponsoredContentFeature;
421
445
  page: Page;
422
446
  };
@@ -642,6 +666,7 @@ type FeaturePopulatedResponseMap = {
642
666
  promotion: PromotionFeature;
643
667
  label: LabelFeature;
644
668
  element: ImdfFeature;
669
+ model3d: Model3dFeature;
645
670
  "sponsored-content": SponsoredContentFeature;
646
671
  page: Page;
647
672
  };
@@ -1263,4 +1288,4 @@ declare const VENUE_EVENTS: {
1263
1288
  VENUE_MOVEINTOVIEW: string;
1264
1289
  };
1265
1290
 
1266
- export { ALL_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_LOCALE, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, type IAllVenuesViewConfig, type IExtrudeConfig, type IGraphFeatureOptions, type IGraphOptions, type IHighlightOptions, IMDF_FEATURE_TYPES, type IMapAnimation, type IMapConfig, type IMapExtrudeConfig, type ISetHighlight2DElementIdsOptions, type IUnitDistanceModifier, type IVerticalGraphOptions, type Id, type ImdfFeature, IndoorMap, type IndoorMapOptions, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, occupantHelper as OccupantHelpers, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, PulsingMarker, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type SymbolSet, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, type TextMarkerOptions, TextSpriteMarker, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap, fetchDeliveryApi, fetchPreviewApi, getBearingBetweenPoints, getCenterFromGeometry, getDataClient, getExtrudeConfigByFeature, getFeatureByLocationId, getLocationByAmenity, getLocationByFeature, getLocationByOccupant, getLocationIdByFeature, getOrdinalByLocationId, getRelatedLocationIdsByFeature, getRelatedLocationsByAmenity, getRelatedLocationsByFeature, getRelatedLocationsByOccupant, getSuitablyValueBetweenBearings, isClickableFeature, isValidCoordinate, isValidLineString, isValidLineStringCoordinates, isValidMultiPolygon, isValidMultiPolygonCoordinates, isValidPoint, isValidPolygon, isValidPolygonCoordinates, matchFilter, matchFilters, safeFetchFeature, styledFeatureGenerator };
1291
+ export { ALL_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_LOCALE, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, type IAllVenuesViewConfig, type IExtrudeConfig, type IGraphFeatureOptions, type IGraphOptions, type IHighlightOptions, IMDF_FEATURE_TYPES, type IMapAnimation, type IMapConfig, type IMapExtrudeConfig, type ISetHighlight2DElementIdsOptions, type IUnitDistanceModifier, type IVerticalGraphOptions, type Id, type ImdfFeature, IndoorMap, type IndoorMapOptions, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, type Model3dFeature, type Model3dGeometry, type Model3dProperties, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, occupantHelper as OccupantHelpers, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, PulsingMarker, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type SymbolSet, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, type TextMarkerOptions, TextSpriteMarker, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap, fetchDeliveryApi, fetchPreviewApi, getBearingBetweenPoints, getCenterFromGeometry, getDataClient, getExtrudeConfigByFeature, getFeatureByLocationId, getLocationByAmenity, getLocationByFeature, getLocationByOccupant, getLocationIdByFeature, getOrdinalByLocationId, getRelatedLocationIdsByFeature, getRelatedLocationsByAmenity, getRelatedLocationsByFeature, getRelatedLocationsByOccupant, getSuitablyValueBetweenBearings, isClickableFeature, isValidCoordinate, isValidLineString, isValidLineStringCoordinates, isValidMultiPolygon, isValidMultiPolygonCoordinates, isValidPoint, isValidPolygon, isValidPolygonCoordinates, matchFilter, matchFilters, safeFetchFeature, styledFeatureGenerator };
package/dist/index.js CHANGED
@@ -168,7 +168,8 @@ var defaultFeatureQueryOptionsMap = {
168
168
  // refresh every 5 min
169
169
  },
170
170
  element: {},
171
- page: {}
171
+ page: {},
172
+ model3d: {}
172
173
  };
173
174
 
174
175
  // src/data/api/delivery-project.ts
@@ -184,6 +185,14 @@ async function fetchDeliveryApi(projectId, apiKey, featureType, baseUrl = DEFAUL
184
185
  const items = await res.json();
185
186
  return items;
186
187
  }
188
+ case "model3d": {
189
+ const res = await fetch(
190
+ `${baseUrl}/delivery/projects/${projectId}/${featureType}.geojson?api-key=${apiKey}`
191
+ );
192
+ if (res.status !== 200) return [];
193
+ const items = await res.json();
194
+ return items.features;
195
+ }
187
196
  case "sponsored-content": {
188
197
  const res = await fetch(
189
198
  `${baseUrl}/delivery/projects/${projectId}/sponsored-content.json?api-key=${apiKey}`
@@ -866,6 +875,13 @@ function featureCollection(features, options = {}) {
866
875
  fc.features = features;
867
876
  return fc;
868
877
  }
878
+ function multiPoint(coordinates, properties, options = {}) {
879
+ const geom = {
880
+ type: "MultiPoint",
881
+ coordinates
882
+ };
883
+ return feature(geom, properties, options);
884
+ }
869
885
  function isNumber(num) {
870
886
  return !isNaN(num) && num !== null && !Array.isArray(num);
871
887
  }
@@ -2781,6 +2797,7 @@ var CameraManager = class {
2781
2797
  };
2782
2798
 
2783
2799
  // src/IndoorMap/renderer/RendererManager.ts
2800
+ var import_compact2 = __toESM(require("lodash/compact"));
2784
2801
  var import_isFunction = __toESM(require("lodash/isFunction"));
2785
2802
  var import_min = __toESM(require("lodash/min"));
2786
2803
  var import_center3 = require("@turf/center");
@@ -2791,6 +2808,12 @@ var maptalks4 = __toESM(require("maptalks-gl"));
2791
2808
  var THREE = __toESM(require("three"));
2792
2809
  var import_maptalks7 = require("maptalks.three");
2793
2810
  var import_buffer2 = __toESM(require("@turf/buffer"));
2811
+ var import_clean_coords = require("@turf/clean-coords");
2812
+ var import_polygon_to_line = require("@turf/polygon-to-line");
2813
+ var import_nearest_point_on_line = require("@turf/nearest-point-on-line");
2814
+ var import_length = require("@turf/length");
2815
+ var import_along = require("@turf/along");
2816
+ var import_point_to_line_distance = require("@turf/point-to-line-distance");
2794
2817
 
2795
2818
  // src/IndoorMap/renderer/3d/objects/GroundLabel.ts
2796
2819
  var maptalks3 = __toESM(require("maptalks-gl"));
@@ -3093,15 +3116,15 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
3093
3116
  // src/IndoorMap/renderer/3d/element3DRendererOptions.ts
3094
3117
  var element3DRendererOptions = {
3095
3118
  unit: {
3096
- default: { color: "#ffffff", height: 4 },
3119
+ default: { color: "#ffffff", height: 0.2 },
3097
3120
  byCategory: {
3098
3121
  walkway: { color: "#cccccc", height: 0.1 },
3099
3122
  terrace: { color: "#cccccc", height: 0.1 },
3100
3123
  unenclosedarea: { color: "#cccccc", height: 0.2 },
3101
3124
  nonpublic: { color: "#999999", height: 0.3 },
3102
3125
  escalator: { height: 0.2 },
3103
- parking: { height: 0.1 },
3104
- room: { color: "#ffffff", height: 2, bottomHeight: 0.12 }
3126
+ parking: { color: "#999999", height: 0.1 },
3127
+ room: { color: "#ffffff", height: 0.5, bottomHeight: 0.12 }
3105
3128
  }
3106
3129
  },
3107
3130
  kiosk: {
@@ -3133,6 +3156,7 @@ var get3DRendererOption = (featureType, category, options) => {
3133
3156
  };
3134
3157
 
3135
3158
  // src/IndoorMap/renderer/3d/Element3DRenderer.ts
3159
+ var import_line_split = __toESM(require("@turf/line-split"));
3136
3160
  var HEIGHT_METER = 4;
3137
3161
  var MULTIORDINAL_HEIGHT_METER = 9;
3138
3162
  var Element3DRenderer = class extends EventTarget {
@@ -3264,6 +3288,68 @@ var Element3DRenderer = class extends EventTarget {
3264
3288
  console.log(`error createGeometry`, err, { feature: feature2, options });
3265
3289
  }
3266
3290
  };
3291
+ createRoomWall(unit, openings = []) {
3292
+ const polygons = unit.geometry.type === "Polygon" ? [unit.geometry.coordinates] : unit.geometry.coordinates;
3293
+ return polygons.map((plg) => {
3294
+ return plg.map((ring) => {
3295
+ const roomWall = (0, import_clean_coords.cleanCoords)((0, import_polygon_to_line.polygonToLine)(polygon([ring])));
3296
+ if (openings.length === 0) {
3297
+ const color = "#ababab";
3298
+ const material = this.getOrCreateMaterialByColor(color);
3299
+ const extrudedWall = this.threeLayer.toExtrudeLine(
3300
+ new maptalks4.LineString(roomWall.geometry.coordinates),
3301
+ { height: 4, width: 1 },
3302
+ material
3303
+ );
3304
+ return extrudedWall;
3305
+ }
3306
+ let openingPoints = [];
3307
+ openings.forEach((opening) => {
3308
+ const doorCoords = opening?.geometry?.coordinates;
3309
+ const p0 = point(doorCoords[0]);
3310
+ const p1 = point(doorCoords[doorCoords.length - 1]);
3311
+ const s0 = (0, import_nearest_point_on_line.nearestPointOnLine)(roomWall, p0, { units: "meters" });
3312
+ const s1 = (0, import_nearest_point_on_line.nearestPointOnLine)(roomWall, p1, { units: "meters" });
3313
+ const d0 = s0.properties.dist;
3314
+ const d1 = s1.properties.dist;
3315
+ if (d0 > 1 || d1 > 1) {
3316
+ } else {
3317
+ openingPoints = openingPoints.concat([s0.geometry.coordinates, s1.geometry.coordinates]);
3318
+ }
3319
+ });
3320
+ try {
3321
+ const split = (0, import_line_split.default)(roomWall, multiPoint(openingPoints));
3322
+ const wallsOnly = split.features.filter((seg) => {
3323
+ const mid = (0, import_along.along)(seg, (0, import_length.length)(seg, { units: "meters" }) / 2, { units: "meters" });
3324
+ for (const opening of openings) {
3325
+ const dist = (0, import_point_to_line_distance.pointToLineDistance)(mid, opening, { units: "meters" });
3326
+ if (dist < 0.05) return false;
3327
+ }
3328
+ return true;
3329
+ });
3330
+ const wallMeshes = wallsOnly.map((feature2, i) => {
3331
+ const color = "#ababab";
3332
+ const material = this.getOrCreateMaterialByColor(color);
3333
+ const extrudedLine = this.threeLayer.toExtrudeLine(
3334
+ new maptalks4.LineString(feature2.geometry.coordinates),
3335
+ { height: 3, width: 0.4, id: unit.id },
3336
+ material
3337
+ );
3338
+ extrudedLine.getObject3d().userData = {
3339
+ unitId: unit.id,
3340
+ coords: feature2.geometry.coordinates
3341
+ };
3342
+ return extrudedLine;
3343
+ }).flat();
3344
+ this.threeLayer.addMesh(wallMeshes);
3345
+ return wallMeshes;
3346
+ } catch (e) {
3347
+ console.log(e.message, { unit, roomWall });
3348
+ return [];
3349
+ }
3350
+ }).flat();
3351
+ }).flat();
3352
+ }
3267
3353
  async createEscalator(f, coordinate, options) {
3268
3354
  const model = {
3269
3355
  url: "https://cdn.venue.in.th/static/glb/escalator.glb",
@@ -3293,14 +3379,14 @@ var Element3DRenderer = class extends EventTarget {
3293
3379
  this.threeLayer.addMesh(groundLabel);
3294
3380
  return groundLabel;
3295
3381
  }
3296
- async createTree(coordinate, ordinal) {
3297
- const treeMarker = new maptalks4.GLTFMarker(coordinate, {
3382
+ async createModel3d(f) {
3383
+ const marker = new maptalks4.GLTFMarker(f.properties.center, {
3298
3384
  symbol: {
3299
- url: "https://dashboard.situm.com/uploads/3dmodels/demoaccount/new_escalator.glb"
3385
+ url: f.properties.model
3300
3386
  }
3301
3387
  });
3302
- treeMarker.addTo(this.gltfLayer);
3303
- return treeMarker;
3388
+ marker.addTo(this.gltfLayer);
3389
+ return marker;
3304
3390
  }
3305
3391
  async createBuilding(coordinate, ordinal) {
3306
3392
  return Promise.resolve(null);
@@ -3459,6 +3545,9 @@ var Element2DRenderer = class extends EventTarget {
3459
3545
  return geometry;
3460
3546
  }
3461
3547
  };
3548
+ createRoomWall(unit, openings) {
3549
+ return null;
3550
+ }
3462
3551
  async createEscalator(f, coordinates) {
3463
3552
  return Promise.resolve(null);
3464
3553
  }
@@ -3467,9 +3556,6 @@ var Element2DRenderer = class extends EventTarget {
3467
3556
  const bound = f.geometry.coordinates[0];
3468
3557
  return null;
3469
3558
  }
3470
- async createTree(coordinates) {
3471
- return Promise.resolve(null);
3472
- }
3473
3559
  async createBuilding(coordinate, ordinal) {
3474
3560
  return Promise.resolve(null);
3475
3561
  }
@@ -4341,6 +4427,38 @@ var RendererManager = class extends EventTarget {
4341
4427
  const groupLayer = this.map.getLayer("group");
4342
4428
  const threeLayer = groupLayer.getLayer("three");
4343
4429
  threeLayer.prepareToDraw = function(gl, scene, camera) {
4430
+ function findBadMeshes(scene2) {
4431
+ const bad = [];
4432
+ scene2.traverse((obj) => {
4433
+ if (!obj?.isMesh) return;
4434
+ const geom = obj.geometry;
4435
+ const pos = geom?.attributes?.position?.array;
4436
+ if (!pos || pos.length === 0) return;
4437
+ for (let i = 0; i < pos.length; i++) {
4438
+ const v2 = pos[i];
4439
+ if (!Number.isFinite(v2)) {
4440
+ bad.push({ mesh: obj, index: i, value: v2 });
4441
+ break;
4442
+ }
4443
+ }
4444
+ });
4445
+ if (bad.length) {
4446
+ console.group(`\u274C Found ${bad.length} meshes with invalid positions`);
4447
+ for (const b of bad) {
4448
+ console.log({
4449
+ name: b.mesh.name,
4450
+ userData: b.mesh.userData,
4451
+ uuid: b.mesh.uuid,
4452
+ badIndex: b.index,
4453
+ badValue: b.value
4454
+ });
4455
+ }
4456
+ console.groupEnd();
4457
+ } else {
4458
+ console.log("\u2705 No invalid meshes found");
4459
+ }
4460
+ return bad;
4461
+ }
4344
4462
  const ambientLight = new THREE3.AmbientLight(16777215, 0.3);
4345
4463
  scene.add(ambientLight);
4346
4464
  const dirColor = 16777215;
@@ -4355,6 +4473,9 @@ var RendererManager = class extends EventTarget {
4355
4473
  options.onRendererReady();
4356
4474
  }
4357
4475
  _this.#createElements();
4476
+ setTimeout(() => {
4477
+ findBadMeshes(scene);
4478
+ }, 3e3);
4358
4479
  };
4359
4480
  } else {
4360
4481
  this.elementRenderer = new Element2DRenderer(map, options.elements);
@@ -4396,6 +4517,9 @@ var RendererManager = class extends EventTarget {
4396
4517
  const levels = await this.#dataClient.filterByType("level", {
4397
4518
  populate: true
4398
4519
  });
4520
+ const openings = await this.#dataClient.filterByType("opening", {
4521
+ populate: true
4522
+ });
4399
4523
  const relationships = await this.#dataClient.filterByType("relationship");
4400
4524
  const fixtures = await this.#dataClient.filterByType("fixture", { populate: true });
4401
4525
  fixtures.forEach((fixture) => {
@@ -4409,7 +4533,7 @@ var RendererManager = class extends EventTarget {
4409
4533
  populate: true
4410
4534
  });
4411
4535
  units.filter(
4412
- (u4) => !["opentobelow", "escalator"].includes(u4.properties.category)
4536
+ (u4) => !["opentobelow", "escalator", "room"].includes(u4.properties.category)
4413
4537
  ).forEach((unit) => {
4414
4538
  const element = this.elementRenderer.createGeometry(unit);
4415
4539
  if (element) {
@@ -4417,6 +4541,22 @@ var RendererManager = class extends EventTarget {
4417
4541
  this.addElementsToManager(unit.id, _elements, unit.properties.level.properties.ordinal);
4418
4542
  }
4419
4543
  });
4544
+ units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
4545
+ const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
4546
+ const roomOpenings = (0, import_compact2.default)(openingRelationships.map((rel) => {
4547
+ const openingId = rel?.properties.intermediary[0].id;
4548
+ return openings.find((o) => o.id === openingId);
4549
+ }));
4550
+ const innerElements = this.elementRenderer.createGeometry(unit);
4551
+ const wallElements = this.elementRenderer.createRoomWall(unit, roomOpenings);
4552
+ if (innerElements || wallElements) {
4553
+ const _innerElements = Array.isArray(innerElements) ? innerElements : [innerElements];
4554
+ const _wallElements = Array.isArray(wallElements) ? wallElements : [wallElements];
4555
+ const _elements = [..._innerElements, ..._wallElements];
4556
+ const ordinal = unit.properties.level.properties.ordinal;
4557
+ this.addElementsToManager(unit.id, _elements, ordinal);
4558
+ }
4559
+ });
4420
4560
  const kiosks = await this.#dataClient.filterByType("kiosk", {
4421
4561
  populate: true
4422
4562
  });
@@ -4464,12 +4604,17 @@ var RendererManager = class extends EventTarget {
4464
4604
  const center2 = (0, import_center3.center)(polygon(label.geometry.coordinates)).geometry.coordinates;
4465
4605
  const unit = findUnitOnPoint(units, center2);
4466
4606
  const element = this.elementRenderer.createGroundLabel(label, unit);
4467
- console.log({ element });
4468
4607
  if (element) {
4469
4608
  const _elements = Array.isArray(element) ? element : [element];
4470
4609
  this.addElementsToManager(label.id, _elements, label.properties.ordinal);
4471
4610
  }
4472
4611
  }
4612
+ if (this.options.type === "3D") {
4613
+ const model3ds = await this.#dataClient.filterByType("model3d");
4614
+ for (const model3d of model3ds) {
4615
+ this.elementRenderer.createModel3d(model3d);
4616
+ }
4617
+ }
4473
4618
  this.changeLevelByOrdinal(this.currentOrdinals);
4474
4619
  this.dispatchEvent(new CustomEvent("renderermanager:elements_created"));
4475
4620
  }