venue-js 1.2.0-next.7 → 1.2.0-next.8
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 +156 -9
- package/dist/index.d.ts +156 -9
- package/dist/index.js +176 -333
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -331
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49,6 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
MARKER_LAYER_NAME: () => MARKER_LAYER_NAME,
|
|
50
50
|
NONIMDF_FEATURE_TYPES: () => NONIMDF_FEATURE_TYPES,
|
|
51
51
|
ORIGIN_MARKER_ID: () => ORIGIN_MARKER_ID,
|
|
52
|
+
OccupantHelpers: () => occupant_helper_exports,
|
|
52
53
|
POI_MARKER_LAYER_NAME: () => POI_MARKER_LAYER_NAME,
|
|
53
54
|
QueryObserver: () => import_query_core2.QueryObserver,
|
|
54
55
|
USER_LOCATION_ELEMENT_ID: () => USER_LOCATION_ELEMENT_ID,
|
|
@@ -76,6 +77,16 @@ __export(index_exports, {
|
|
|
76
77
|
getRelatedLocationsByOccupant: () => getRelatedLocationsByOccupant,
|
|
77
78
|
getSuitablyValueBetweenBearings: () => getSuitablyValueBetweenBearings,
|
|
78
79
|
isClickableFeature: () => isClickableFeature,
|
|
80
|
+
isValidCoordinate: () => isValidCoordinate,
|
|
81
|
+
isValidLineString: () => isValidLineString,
|
|
82
|
+
isValidLineStringCoordinates: () => isValidLineStringCoordinates,
|
|
83
|
+
isValidMultiPolygon: () => isValidMultiPolygon,
|
|
84
|
+
isValidMultiPolygonCoordinates: () => isValidMultiPolygonCoordinates,
|
|
85
|
+
isValidPoint: () => isValidPoint,
|
|
86
|
+
isValidPolygon: () => isValidPolygon,
|
|
87
|
+
isValidPolygonCoordinates: () => isValidPolygonCoordinates,
|
|
88
|
+
matchFilter: () => matchFilter,
|
|
89
|
+
matchFilters: () => matchFilters,
|
|
79
90
|
safeFetchFeature: () => safeFetchFeature,
|
|
80
91
|
styledFeatureGenerator: () => styledFeatureGenerator
|
|
81
92
|
});
|
|
@@ -274,6 +285,115 @@ var safeFetchFeature = async (featureType, params) => {
|
|
|
274
285
|
}
|
|
275
286
|
};
|
|
276
287
|
|
|
288
|
+
// src/data/utils/geometry-validator.ts
|
|
289
|
+
var isValidCoordinate = (point2) => {
|
|
290
|
+
return point2.length === 2 && point2.every((coord) => typeof coord === "number");
|
|
291
|
+
};
|
|
292
|
+
function isValidLinearRingCoordinates(ring) {
|
|
293
|
+
if (ring.length < 4) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
return ring.every(isValidCoordinate) && ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1];
|
|
297
|
+
}
|
|
298
|
+
var isValidPolygonCoordinates = (polygon) => {
|
|
299
|
+
if (Array.isArray(polygon[0]) && (polygon[0].length === 0 || typeof polygon[0][0] === "number")) {
|
|
300
|
+
return isValidLinearRingCoordinates(polygon);
|
|
301
|
+
}
|
|
302
|
+
if (Array.isArray(polygon) && polygon.length > 0 && Array.isArray(polygon[0])) {
|
|
303
|
+
if (!isValidLinearRingCoordinates(polygon[0])) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
for (let i = 1; i < polygon.length; i++) {
|
|
307
|
+
if (!isValidLinearRingCoordinates(polygon[i])) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
return false;
|
|
314
|
+
};
|
|
315
|
+
var isValidMultiPolygonCoordinates = (multipolygon) => {
|
|
316
|
+
return multipolygon.every(isValidPolygonCoordinates);
|
|
317
|
+
};
|
|
318
|
+
var isValidLineStringCoordinates = (lineString2) => {
|
|
319
|
+
if (!Array.isArray(lineString2) || lineString2.length < 2) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
const firstPoint = lineString2[0];
|
|
323
|
+
const lastPoint = lineString2[lineString2.length - 1];
|
|
324
|
+
if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1]) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
return lineString2.every(isValidCoordinate);
|
|
328
|
+
};
|
|
329
|
+
var isValidMultiPolygon = (geometry) => {
|
|
330
|
+
const { type, coordinates } = geometry;
|
|
331
|
+
return type === "MultiPolygon" && isValidMultiPolygonCoordinates(coordinates);
|
|
332
|
+
};
|
|
333
|
+
var isValidPolygon = (geometry) => {
|
|
334
|
+
const { type, coordinates } = geometry;
|
|
335
|
+
return type === "Polygon" && isValidPolygonCoordinates(coordinates);
|
|
336
|
+
};
|
|
337
|
+
var isValidLineString = (geometry) => {
|
|
338
|
+
const { type, coordinates } = geometry;
|
|
339
|
+
return type === "LineString" && isValidLineStringCoordinates(coordinates);
|
|
340
|
+
};
|
|
341
|
+
var isValidPoint = (geometry) => {
|
|
342
|
+
const { type, coordinates } = geometry;
|
|
343
|
+
return type === "Point" && isValidCoordinate(coordinates);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// src/data/utils/match-filters.ts
|
|
347
|
+
function isInFilter(filter) {
|
|
348
|
+
return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
|
|
349
|
+
}
|
|
350
|
+
var someIntersect = (a, b) => a.some((v) => b.includes(v));
|
|
351
|
+
function matchFilter(value, filter) {
|
|
352
|
+
if (Array.isArray(value)) {
|
|
353
|
+
if (isInFilter(filter)) return someIntersect(value, filter.$in);
|
|
354
|
+
return value.includes(filter);
|
|
355
|
+
} else {
|
|
356
|
+
if (isInFilter(filter)) return filter.$in.includes(value);
|
|
357
|
+
return value === filter;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function matchFilters(item, filters) {
|
|
361
|
+
return Object.entries(filters).every(([key, filter]) => {
|
|
362
|
+
return matchFilter(item.properties[key], filter);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/data/utils/occupant-helper.ts
|
|
367
|
+
var occupant_helper_exports = {};
|
|
368
|
+
__export(occupant_helper_exports, {
|
|
369
|
+
getOccupantCorrelatedLocations: () => getOccupantCorrelatedLocations,
|
|
370
|
+
getOccupantMainLocation: () => getOccupantMainLocation,
|
|
371
|
+
getOccupantMarkerLocations: () => getOccupantMarkerLocations
|
|
372
|
+
});
|
|
373
|
+
var import_compact = __toESM(require("lodash/compact"));
|
|
374
|
+
var getOccupantMainLocation = (occupant) => {
|
|
375
|
+
return occupant.properties.kiosk || occupant.properties.unit;
|
|
376
|
+
};
|
|
377
|
+
var getOccupantCorrelatedLocations = (occupant) => {
|
|
378
|
+
const allCorrelatedLocations = [
|
|
379
|
+
...occupant.properties.units,
|
|
380
|
+
...occupant.properties.kiosks
|
|
381
|
+
];
|
|
382
|
+
return (0, import_compact.default)(allCorrelatedLocations);
|
|
383
|
+
};
|
|
384
|
+
var getOccupantMarkerLocations = (occupant, options) => {
|
|
385
|
+
const placementType = options?.type ? options.type : occupant.properties.show_name_on_all_units ? "ALL_LOCATIONS" : "ONCE_PER_LEVEL";
|
|
386
|
+
const mainLocation = getOccupantMainLocation(occupant);
|
|
387
|
+
const mainLocationLevel = mainLocation?.properties?.level_id;
|
|
388
|
+
const allCorrelatedLocations = getOccupantCorrelatedLocations(occupant);
|
|
389
|
+
if (placementType === "ALL_LOCATIONS") {
|
|
390
|
+
return (0, import_compact.default)([mainLocation, ...allCorrelatedLocations]);
|
|
391
|
+
}
|
|
392
|
+
const otherLevelLocations = allCorrelatedLocations.filter((f) => f.properties.level_id !== mainLocationLevel);
|
|
393
|
+
const onePerLevelLocations = [...new Map(otherLevelLocations.map((loc) => [loc.properties.level_id, loc])).values()];
|
|
394
|
+
return (0, import_compact.default)([mainLocation, ...onePerLevelLocations]);
|
|
395
|
+
};
|
|
396
|
+
|
|
277
397
|
// src/data/getDataClient.ts
|
|
278
398
|
var import_query_core = require("@tanstack/query-core");
|
|
279
399
|
|
|
@@ -429,8 +549,8 @@ var createPopulator = ({
|
|
|
429
549
|
venue,
|
|
430
550
|
promotions,
|
|
431
551
|
privileges,
|
|
432
|
-
kiosk,
|
|
433
|
-
unit,
|
|
552
|
+
kiosk: kiosk ? await populateKiosk(kiosk) : null,
|
|
553
|
+
unit: unit ? await populateUnit(unit) : null,
|
|
434
554
|
kiosks: await Promise.all(kiosks.map(populateKiosk)),
|
|
435
555
|
units: await Promise.all(units.map(populateUnit))
|
|
436
556
|
}
|
|
@@ -522,26 +642,6 @@ var createPopulator = ({
|
|
|
522
642
|
};
|
|
523
643
|
};
|
|
524
644
|
|
|
525
|
-
// src/data/utils/match-filters.ts
|
|
526
|
-
function isInFilter(filter) {
|
|
527
|
-
return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
|
|
528
|
-
}
|
|
529
|
-
var someIntersect = (a, b) => a.some((v) => b.includes(v));
|
|
530
|
-
function matchFilter(value, filter) {
|
|
531
|
-
if (Array.isArray(value)) {
|
|
532
|
-
if (isInFilter(filter)) return someIntersect(value, filter.$in);
|
|
533
|
-
return value.includes(filter);
|
|
534
|
-
} else {
|
|
535
|
-
if (isInFilter(filter)) return filter.$in.includes(value);
|
|
536
|
-
return value === filter;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
function matchFilters(item, filters) {
|
|
540
|
-
return Object.entries(filters).every(([key, filter]) => {
|
|
541
|
-
return matchFilter(item.properties[key], filter);
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
|
|
545
645
|
// src/data/getDataClient.ts
|
|
546
646
|
var getDataClient = (options) => {
|
|
547
647
|
const observers = /* @__PURE__ */ new Map();
|
|
@@ -752,7 +852,7 @@ function isNumber(num) {
|
|
|
752
852
|
// src/IndoorMap/IndoorMap.ts
|
|
753
853
|
var import_distance = __toESM(require("@turf/distance"));
|
|
754
854
|
var import_center4 = __toESM(require("@turf/center"));
|
|
755
|
-
var
|
|
855
|
+
var import_three7 = require("three");
|
|
756
856
|
var import_maptalks9 = require("maptalks.three");
|
|
757
857
|
|
|
758
858
|
// src/IndoorMap/constants.ts
|
|
@@ -1749,18 +1849,6 @@ var loadModel3d = (model3d, coordinate, threeLayer) => {
|
|
|
1749
1849
|
);
|
|
1750
1850
|
});
|
|
1751
1851
|
};
|
|
1752
|
-
var create3DModels = async (models, defaultCoordinate, properties, threeLayer) => {
|
|
1753
|
-
let modelObjs = [];
|
|
1754
|
-
for (let j = 0; j < models.length; j++) {
|
|
1755
|
-
const model = models[j];
|
|
1756
|
-
const positionCoord = import_lodash4.default.get(model, "properties.position");
|
|
1757
|
-
const coord = positionCoord || defaultCoordinate;
|
|
1758
|
-
const object = await loadModel3d(model, coord, threeLayer);
|
|
1759
|
-
object.properties = properties;
|
|
1760
|
-
modelObjs.push(object);
|
|
1761
|
-
}
|
|
1762
|
-
return modelObjs;
|
|
1763
|
-
};
|
|
1764
1852
|
var createExtrudePolygon = (geometry, threeLayer, material, height, properties = {}, options) => {
|
|
1765
1853
|
const { offset = 0, altitude = 0 } = options;
|
|
1766
1854
|
const offsetGeometry = (0, import_buffer.default)(geometry, offset, { units: "meters" });
|
|
@@ -2668,44 +2756,6 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2668
2756
|
markerProperties
|
|
2669
2757
|
);
|
|
2670
2758
|
},
|
|
2671
|
-
createVenue3DModel: async (venue, threeLayer) => {
|
|
2672
|
-
const { id, feature_type, properties } = venue;
|
|
2673
|
-
const { category, model3d } = properties;
|
|
2674
|
-
const modelProperty = {
|
|
2675
|
-
id,
|
|
2676
|
-
feature_type,
|
|
2677
|
-
category
|
|
2678
|
-
};
|
|
2679
|
-
const center2 = (0, import_center2.default)(venue);
|
|
2680
|
-
const centerCoord = import_lodash4.default.get(center2, "geometry.coordinates");
|
|
2681
|
-
const modelPosition = import_lodash4.default.get(model3d, "properties.position", centerCoord);
|
|
2682
|
-
const models = await create3DModels(
|
|
2683
|
-
model3d,
|
|
2684
|
-
modelPosition,
|
|
2685
|
-
modelProperty,
|
|
2686
|
-
threeLayer
|
|
2687
|
-
);
|
|
2688
|
-
return models;
|
|
2689
|
-
},
|
|
2690
|
-
create3DFixture: async (fixture, threeLayer) => {
|
|
2691
|
-
const { id, feature_type, properties } = fixture;
|
|
2692
|
-
const { category, ordinal, model3d } = properties;
|
|
2693
|
-
const modelProperty = {
|
|
2694
|
-
id,
|
|
2695
|
-
feature_type,
|
|
2696
|
-
category,
|
|
2697
|
-
ordinal
|
|
2698
|
-
};
|
|
2699
|
-
const center2 = (0, import_center2.default)(fixture);
|
|
2700
|
-
const coordinate = import_lodash4.default.get(center2, "geometry.coordinates");
|
|
2701
|
-
const models = await create3DModels(
|
|
2702
|
-
model3d,
|
|
2703
|
-
coordinate,
|
|
2704
|
-
modelProperty,
|
|
2705
|
-
threeLayer
|
|
2706
|
-
);
|
|
2707
|
-
return models;
|
|
2708
|
-
},
|
|
2709
2759
|
createExtrudedUnit: (unit, threeLayer, options) => {
|
|
2710
2760
|
const extrudeHeight = import_lodash4.default.get(options, "height");
|
|
2711
2761
|
if (!extrudeHeight) return;
|
|
@@ -2745,24 +2795,6 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2745
2795
|
options3d
|
|
2746
2796
|
);
|
|
2747
2797
|
return object;
|
|
2748
|
-
},
|
|
2749
|
-
createAmbientLight: (config) => {
|
|
2750
|
-
const { color: colorString = "0xffffff", intensity = 1 } = config;
|
|
2751
|
-
const color = parseInt(colorString, 16);
|
|
2752
|
-
const ambientLight = new import_three5.AmbientLight(color, intensity);
|
|
2753
|
-
return ambientLight;
|
|
2754
|
-
},
|
|
2755
|
-
createDirectionalLight: (config) => {
|
|
2756
|
-
const {
|
|
2757
|
-
color: colorString = "0xffffff",
|
|
2758
|
-
intensity = 1,
|
|
2759
|
-
position: positionString = [0, 0, 0]
|
|
2760
|
-
} = config;
|
|
2761
|
-
const color = parseInt(colorString, 16);
|
|
2762
|
-
const [x, y, z] = positionString;
|
|
2763
|
-
const light = new import_three5.DirectionalLight(color, intensity);
|
|
2764
|
-
light.position.set(x, y, z).normalize();
|
|
2765
|
-
return light;
|
|
2766
2798
|
}
|
|
2767
2799
|
};
|
|
2768
2800
|
};
|
|
@@ -3140,6 +3172,7 @@ var element3DRendererOptions = {
|
|
|
3140
3172
|
unenclosedarea: { color: "#cccccc", height: 0.2 },
|
|
3141
3173
|
nonpublic: { color: "#999999", height: 0.3 },
|
|
3142
3174
|
escalator: { height: 0.2 },
|
|
3175
|
+
parking: { height: 0.1 },
|
|
3143
3176
|
room: { color: "#ffffff", height: 2, bottomHeight: 0.12 }
|
|
3144
3177
|
}
|
|
3145
3178
|
},
|
|
@@ -3466,6 +3499,7 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3466
3499
|
markerLayer;
|
|
3467
3500
|
constructor(map) {
|
|
3468
3501
|
super();
|
|
3502
|
+
this.map = map;
|
|
3469
3503
|
}
|
|
3470
3504
|
createMarker = (coordinates, ordinal, content) => {
|
|
3471
3505
|
const marker = new maptalks6.ui.UIMarker(coordinates, {
|
|
@@ -3487,74 +3521,7 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3487
3521
|
};
|
|
3488
3522
|
|
|
3489
3523
|
// src/IndoorMap/renderer/3d/Marker3DRenderer.ts
|
|
3490
|
-
var maptalks7 = __toESM(require("maptalks"));
|
|
3491
|
-
|
|
3492
|
-
// src/IndoorMap/renderer/utils/svg2material.ts
|
|
3493
|
-
var import_three7 = require("three");
|
|
3494
|
-
var svgToDataURL = (svgString, scaleFactor = 1) => {
|
|
3495
|
-
const svgBlob = new Blob([svgString], { type: "image/svg+xml" });
|
|
3496
|
-
const url = URL.createObjectURL(svgBlob);
|
|
3497
|
-
const img = new Image();
|
|
3498
|
-
return new Promise((resolve, reject) => {
|
|
3499
|
-
img.onload = function() {
|
|
3500
|
-
const newWidth = img.width * scaleFactor;
|
|
3501
|
-
const newHeight = img.height * scaleFactor;
|
|
3502
|
-
const canvas = document.createElement("canvas");
|
|
3503
|
-
canvas.width = newWidth;
|
|
3504
|
-
canvas.height = newHeight;
|
|
3505
|
-
const ctx = canvas.getContext("2d");
|
|
3506
|
-
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
|
3507
|
-
const pngDataUrl = canvas.toDataURL("image/png");
|
|
3508
|
-
resolve(pngDataUrl);
|
|
3509
|
-
};
|
|
3510
|
-
img.onerror = function(error) {
|
|
3511
|
-
reject(error);
|
|
3512
|
-
};
|
|
3513
|
-
img.src = url;
|
|
3514
|
-
});
|
|
3515
|
-
};
|
|
3516
|
-
var createSVGPathFromMarkerSymbol2 = (style) => {
|
|
3517
|
-
const {
|
|
3518
|
-
markerWidth = 24,
|
|
3519
|
-
markerDx = 0,
|
|
3520
|
-
markerDy = 0,
|
|
3521
|
-
// markerFill,
|
|
3522
|
-
markerPath,
|
|
3523
|
-
fill = "#000000"
|
|
3524
|
-
} = style;
|
|
3525
|
-
const scale2 = markerWidth / 24;
|
|
3526
|
-
const strokeWidth = 2;
|
|
3527
|
-
const halfStrokeWidth = 0.5 * strokeWidth;
|
|
3528
|
-
if (Array.isArray(markerPath)) {
|
|
3529
|
-
return markerPath.map(
|
|
3530
|
-
({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}" stroke="#ffffff" stroke-width="${strokeWidth}" />`
|
|
3531
|
-
);
|
|
3532
|
-
}
|
|
3533
|
-
return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill}" />`;
|
|
3534
|
-
};
|
|
3535
|
-
var createSpriteMaterialByLabelSymbol2 = (labelSymbol) => {
|
|
3536
|
-
const material = new import_three7.SpriteMaterial();
|
|
3537
|
-
try {
|
|
3538
|
-
const [base, icon] = labelSymbol ?? [{}, {}];
|
|
3539
|
-
const { markerWidth: baseWidth = 24 } = base;
|
|
3540
|
-
const { markerWidth: iconWidth = 24 } = icon;
|
|
3541
|
-
const viewBoxDimension = Math.max(baseWidth, iconWidth);
|
|
3542
|
-
const baseSVG = createSVGPathFromMarkerSymbol2(base);
|
|
3543
|
-
const iconSVG = icon ? createSVGPathFromMarkerSymbol2(icon) : "";
|
|
3544
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${viewBoxDimension}" height="${viewBoxDimension}">${baseSVG}${iconSVG}</svg>`;
|
|
3545
|
-
const textureLoader = new import_three7.TextureLoader();
|
|
3546
|
-
const scaleFactor = 200 / 24;
|
|
3547
|
-
svgToDataURL(svg, scaleFactor).then((png) => {
|
|
3548
|
-
const texture = textureLoader.load(png, () => {
|
|
3549
|
-
material.map = texture;
|
|
3550
|
-
material.needsUpdate = true;
|
|
3551
|
-
});
|
|
3552
|
-
});
|
|
3553
|
-
} catch (error) {
|
|
3554
|
-
console.warn(`Error createSpriteMaterialByLabelSymbol: `, labelSymbol);
|
|
3555
|
-
}
|
|
3556
|
-
return material;
|
|
3557
|
-
};
|
|
3524
|
+
var maptalks7 = __toESM(require("maptalks-gl"));
|
|
3558
3525
|
|
|
3559
3526
|
// src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
|
|
3560
3527
|
var import_maptalks7 = require("maptalks");
|
|
@@ -3585,11 +3552,11 @@ var OPTIONS4 = {
|
|
|
3585
3552
|
fontFamily: "sans-serif",
|
|
3586
3553
|
fontSize: 28,
|
|
3587
3554
|
fontWeight: 400,
|
|
3588
|
-
background: "
|
|
3555
|
+
background: "transparent",
|
|
3589
3556
|
lineHeight: 32,
|
|
3590
3557
|
padding: 8,
|
|
3591
3558
|
strokeColor: "#000000",
|
|
3592
|
-
strokeWidth:
|
|
3559
|
+
strokeWidth: 3,
|
|
3593
3560
|
strokeStyle: "round",
|
|
3594
3561
|
// Sprite options
|
|
3595
3562
|
/* Overall scale multiplier */
|
|
@@ -3801,40 +3768,41 @@ var Marker3DRenderer = class extends EventTarget {
|
|
|
3801
3768
|
});
|
|
3802
3769
|
}
|
|
3803
3770
|
/** Marker */
|
|
3804
|
-
getOrCreateIconMaterial(key) {
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3771
|
+
// getOrCreateIconMaterial(key) {
|
|
3772
|
+
// if (!this.materialByKey) this.materialByKey = new Map()
|
|
3773
|
+
// const existingMaterial = this.materialByKey.get(key)
|
|
3774
|
+
// if (existingMaterial) return existingMaterial
|
|
3775
|
+
// // Create new
|
|
3776
|
+
// const baseSymbol: maptalks.Path = {
|
|
3777
|
+
// markerType: "path",
|
|
3778
|
+
// markerPath: [
|
|
3779
|
+
// {
|
|
3780
|
+
// path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
|
|
3781
|
+
// fill: "#ff0000",
|
|
3782
|
+
// },
|
|
3783
|
+
// ],
|
|
3784
|
+
// markerPathWidth: 24,
|
|
3785
|
+
// markerPathHeight: 24
|
|
3786
|
+
// }
|
|
3787
|
+
// const markerSymbol: maptalks.PathMarkerSymbol = {
|
|
3788
|
+
// markerType: "path",
|
|
3789
|
+
// markerPath: [],
|
|
3790
|
+
// // TODO: Get Path by featureType.category
|
|
3791
|
+
// // markerPath: [{ fill: "#FFFFFF", path: "M 19 3 H 5 c -1.1 0 -2 0.9 -2 2 v 14 c 0 1.1 0.9 2 2 2 h 14 c 1.1 0 2 -0.9 2 -2 V 5 c 0 -1.1 -0.9 -2 -2 -2 Z m -2 6 h -1.7 l -5 9 H 7 c -0.83 0 -1.5 -0.67 -1.5 -1.5 S 6.17 15 7 15 h 1.7 l 5 -9 H 17 c 0.83 0 1.5 0.67 1.5 1.5 S 17.83 9 17 9 Z" }],
|
|
3792
|
+
// markerPathWidth: 24,
|
|
3793
|
+
// markerPathHeight: 24,
|
|
3794
|
+
// markerWidth: 24,
|
|
3795
|
+
// markerHeight: 24,
|
|
3796
|
+
// markerDy: 1.5,
|
|
3797
|
+
// markerDx: 1.5,
|
|
3798
|
+
// }
|
|
3799
|
+
// const created = createSpriteMaterialByLabelSymbol([
|
|
3800
|
+
// baseSymbol,
|
|
3801
|
+
// markerSymbol,
|
|
3802
|
+
// ])
|
|
3803
|
+
// this.materialByKey.set(key, created)
|
|
3804
|
+
// return created
|
|
3805
|
+
// }
|
|
3838
3806
|
};
|
|
3839
3807
|
|
|
3840
3808
|
// src/IndoorMap/renderer/utils/angleBetweenLineString.ts
|
|
@@ -4265,7 +4233,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4265
4233
|
const scene = this.threeLayer.getScene();
|
|
4266
4234
|
if (scene) {
|
|
4267
4235
|
scene.children = scene.children.filter(
|
|
4268
|
-
(children) => children instanceof
|
|
4236
|
+
(children) => children instanceof import_three7.PerspectiveCamera
|
|
4269
4237
|
);
|
|
4270
4238
|
}
|
|
4271
4239
|
}
|
|
@@ -4290,16 +4258,11 @@ var IndoorMap = class extends EventTarget {
|
|
|
4290
4258
|
create3DFootprint,
|
|
4291
4259
|
create3DGroundLabel,
|
|
4292
4260
|
create3DBillboard,
|
|
4293
|
-
createVenue3DModel,
|
|
4294
4261
|
createExtrudedUnit,
|
|
4295
|
-
create3DFixture,
|
|
4296
4262
|
create3DAmenityMarker,
|
|
4297
4263
|
create3DOccupantAmenityMarker,
|
|
4298
4264
|
create3DOpeningMarker,
|
|
4299
|
-
createOccupantGroundLabel
|
|
4300
|
-
// Light
|
|
4301
|
-
createAmbientLight,
|
|
4302
|
-
createDirectionalLight
|
|
4265
|
+
createOccupantGroundLabel
|
|
4303
4266
|
} = this.#styler;
|
|
4304
4267
|
let elements = {};
|
|
4305
4268
|
let object3ds = [];
|
|
@@ -4326,16 +4289,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4326
4289
|
feature2
|
|
4327
4290
|
);
|
|
4328
4291
|
switch (featureType) {
|
|
4329
|
-
case "venue": {
|
|
4330
|
-
geometry = createVenue(feature2).addTo(layer);
|
|
4331
|
-
const models = await createVenue3DModel(feature2, this.threeLayer);
|
|
4332
|
-
models.forEach((model) => {
|
|
4333
|
-
model.on("click", this.handleClickElement);
|
|
4334
|
-
object3ds.push(model);
|
|
4335
|
-
this.#venueObjects.push(model);
|
|
4336
|
-
});
|
|
4337
|
-
break;
|
|
4338
|
-
}
|
|
4339
4292
|
case "amenity": {
|
|
4340
4293
|
if (feature2.properties.is_featured) {
|
|
4341
4294
|
const billboardObj = create3DBillboard(feature2, this.threeLayer);
|
|
@@ -4379,127 +4332,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4379
4332
|
geometry = createSection(feature2)?.addTo(layer);
|
|
4380
4333
|
break;
|
|
4381
4334
|
}
|
|
4382
|
-
case "occupant": {
|
|
4383
|
-
switch (category) {
|
|
4384
|
-
// Create only marker if it is amenity occupant
|
|
4385
|
-
case "currencyexchange":
|
|
4386
|
-
case "donationcenter":
|
|
4387
|
-
case "postoffice":
|
|
4388
|
-
const markerFeature = {
|
|
4389
|
-
...feature2,
|
|
4390
|
-
geometry: feature2.properties?.anchor?.geometry
|
|
4391
|
-
};
|
|
4392
|
-
const marker3d = create3DOccupantAmenityMarker(
|
|
4393
|
-
markerFeature,
|
|
4394
|
-
this.threeLayer,
|
|
4395
|
-
extrudeConfig
|
|
4396
|
-
)?.on("click", this.handleClickElement);
|
|
4397
|
-
object3ds.push(marker3d);
|
|
4398
|
-
break;
|
|
4399
|
-
default: {
|
|
4400
|
-
const { kiosk, anchor } = feature2.properties;
|
|
4401
|
-
const { unit } = anchor.properties;
|
|
4402
|
-
let mainLocation = kiosk || unit || null;
|
|
4403
|
-
const relatedLocations = [
|
|
4404
|
-
...feature2.properties.units,
|
|
4405
|
-
...feature2.properties.kiosks
|
|
4406
|
-
].filter((f) => f.properties.ordinal !== properties.ordinal);
|
|
4407
|
-
const occupantLocations = [mainLocation, ...relatedLocations];
|
|
4408
|
-
const renderType = feature2.properties.render_type;
|
|
4409
|
-
occupantLocations.forEach((location, index) => {
|
|
4410
|
-
const isMainLocation = index === 0;
|
|
4411
|
-
if (renderType === "Label") {
|
|
4412
|
-
const occupantGroundLabel = createOccupantGroundLabel(
|
|
4413
|
-
feature2,
|
|
4414
|
-
location,
|
|
4415
|
-
{ textMarkerType, extrudeConfig },
|
|
4416
|
-
this.threeLayer
|
|
4417
|
-
);
|
|
4418
|
-
if (occupantGroundLabel instanceof GroundLabel) {
|
|
4419
|
-
occupantGroundLabel.on("click", this.handleClickElement);
|
|
4420
|
-
occupantGroundLabel.addTo(this.threeLayer);
|
|
4421
|
-
object3ds.push(occupantGroundLabel);
|
|
4422
|
-
this.#groundObjects.push(occupantGroundLabel);
|
|
4423
|
-
}
|
|
4424
|
-
} else {
|
|
4425
|
-
const occupantMarker = createOccupant(feature2, location, {
|
|
4426
|
-
textMarkerType,
|
|
4427
|
-
extrudeConfig
|
|
4428
|
-
});
|
|
4429
|
-
if (occupantMarker instanceof import_maptalks_gl.ui.UIMarker) {
|
|
4430
|
-
occupantMarker.addTo(this.map);
|
|
4431
|
-
} else {
|
|
4432
|
-
occupantMarker?.on("click", this.handleClickElement);
|
|
4433
|
-
occupantMarker?.addTo(layer);
|
|
4434
|
-
}
|
|
4435
|
-
if (isMainLocation) {
|
|
4436
|
-
geometry = occupantMarker;
|
|
4437
|
-
} else {
|
|
4438
|
-
elements[`${feature2.id}_${index}`] = {
|
|
4439
|
-
geometry: occupantMarker,
|
|
4440
|
-
properties: location.properties,
|
|
4441
|
-
featureType: "occupant",
|
|
4442
|
-
feature: feature2
|
|
4443
|
-
};
|
|
4444
|
-
}
|
|
4445
|
-
}
|
|
4446
|
-
});
|
|
4447
|
-
}
|
|
4448
|
-
}
|
|
4449
|
-
break;
|
|
4450
|
-
}
|
|
4451
|
-
case "fixture": {
|
|
4452
|
-
const models = await create3DFixture(feature2, this.threeLayer);
|
|
4453
|
-
models.forEach((model) => {
|
|
4454
|
-
model.on("click", this.handleClickElement);
|
|
4455
|
-
object3ds.push(model);
|
|
4456
|
-
this.#glbObjects.push(model);
|
|
4457
|
-
});
|
|
4458
|
-
if (!featureExtrudeConfig) {
|
|
4459
|
-
geometry = createFixture(feature2)?.addTo(layer);
|
|
4460
|
-
} else {
|
|
4461
|
-
const locatedLevel = feature2?.properties?.level;
|
|
4462
|
-
const levelExtrudeConfig = getExtrudeConfigByFeature(
|
|
4463
|
-
extrudeConfig,
|
|
4464
|
-
locatedLevel
|
|
4465
|
-
);
|
|
4466
|
-
const levelHeight = import_lodash7.default.get(levelExtrudeConfig, "height", 0);
|
|
4467
|
-
const option = { ...featureExtrudeConfig, altitude: levelHeight };
|
|
4468
|
-
const extrudedFixture = createExtrudedUnit(
|
|
4469
|
-
feature2,
|
|
4470
|
-
this.threeLayer,
|
|
4471
|
-
option
|
|
4472
|
-
);
|
|
4473
|
-
object3ds.push(extrudedFixture);
|
|
4474
|
-
}
|
|
4475
|
-
break;
|
|
4476
|
-
}
|
|
4477
|
-
case "footprint": {
|
|
4478
|
-
const objects = await create3DFootprint(
|
|
4479
|
-
feature2,
|
|
4480
|
-
this.threeLayer,
|
|
4481
|
-
featureExtrudeConfig
|
|
4482
|
-
);
|
|
4483
|
-
objects.forEach((object) => {
|
|
4484
|
-
object.on("click", () => {
|
|
4485
|
-
const {
|
|
4486
|
-
geometry: { coordinates }
|
|
4487
|
-
} = (0, import_center4.default)(feature2);
|
|
4488
|
-
this.camera.animateTo({ center: coordinates, pitch: 45 });
|
|
4489
|
-
});
|
|
4490
|
-
object3ds.push(object);
|
|
4491
|
-
this.#objects.push(object);
|
|
4492
|
-
});
|
|
4493
|
-
if (feature2.properties.logo) {
|
|
4494
|
-
const footprintMarker = create3DBillboard(
|
|
4495
|
-
feature2,
|
|
4496
|
-
this.threeLayer
|
|
4497
|
-
);
|
|
4498
|
-
object3ds.push(footprintMarker);
|
|
4499
|
-
this.#billboardObjects.push(footprintMarker);
|
|
4500
|
-
}
|
|
4501
|
-
break;
|
|
4502
|
-
}
|
|
4503
4335
|
default:
|
|
4504
4336
|
break;
|
|
4505
4337
|
}
|
|
@@ -5168,6 +5000,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5168
5000
|
MARKER_LAYER_NAME,
|
|
5169
5001
|
NONIMDF_FEATURE_TYPES,
|
|
5170
5002
|
ORIGIN_MARKER_ID,
|
|
5003
|
+
OccupantHelpers,
|
|
5171
5004
|
POI_MARKER_LAYER_NAME,
|
|
5172
5005
|
QueryObserver,
|
|
5173
5006
|
USER_LOCATION_ELEMENT_ID,
|
|
@@ -5195,6 +5028,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
5195
5028
|
getRelatedLocationsByOccupant,
|
|
5196
5029
|
getSuitablyValueBetweenBearings,
|
|
5197
5030
|
isClickableFeature,
|
|
5031
|
+
isValidCoordinate,
|
|
5032
|
+
isValidLineString,
|
|
5033
|
+
isValidLineStringCoordinates,
|
|
5034
|
+
isValidMultiPolygon,
|
|
5035
|
+
isValidMultiPolygonCoordinates,
|
|
5036
|
+
isValidPoint,
|
|
5037
|
+
isValidPolygon,
|
|
5038
|
+
isValidPolygonCoordinates,
|
|
5039
|
+
matchFilter,
|
|
5040
|
+
matchFilters,
|
|
5198
5041
|
safeFetchFeature,
|
|
5199
5042
|
styledFeatureGenerator
|
|
5200
5043
|
});
|