venue-js 1.2.0-next.1 → 1.2.0-next.10
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 +135 -71
- package/dist/index.d.ts +135 -71
- package/dist/index.js +797 -1016
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +793 -1016
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -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();
|
|
@@ -670,6 +770,7 @@ var getDataClient = (options) => {
|
|
|
670
770
|
|
|
671
771
|
// src/IndoorMap/IndoorMap.ts
|
|
672
772
|
var import_maptalks_gl = require("maptalks-gl");
|
|
773
|
+
var import_transcoders = require("@maptalks/transcoders.draco");
|
|
673
774
|
var import_tween2 = __toESM(require("@tweenjs/tween.js"));
|
|
674
775
|
var import_lodash7 = __toESM(require("lodash"));
|
|
675
776
|
|
|
@@ -751,133 +852,8 @@ function isNumber(num) {
|
|
|
751
852
|
// src/IndoorMap/IndoorMap.ts
|
|
752
853
|
var import_distance = __toESM(require("@turf/distance"));
|
|
753
854
|
var import_center4 = __toESM(require("@turf/center"));
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
757
|
-
if (geojson === null) return;
|
|
758
|
-
var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
759
|
-
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
760
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
761
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
762
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
763
|
-
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
764
|
-
var multiFeatureIndex = 0;
|
|
765
|
-
var geometryIndex = 0;
|
|
766
|
-
geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
767
|
-
if (geometry === null) continue;
|
|
768
|
-
coords = geometry.coordinates;
|
|
769
|
-
var geomType = geometry.type;
|
|
770
|
-
wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
|
|
771
|
-
switch (geomType) {
|
|
772
|
-
case null:
|
|
773
|
-
break;
|
|
774
|
-
case "Point":
|
|
775
|
-
if (callback(
|
|
776
|
-
coords,
|
|
777
|
-
coordIndex,
|
|
778
|
-
featureIndex,
|
|
779
|
-
multiFeatureIndex,
|
|
780
|
-
geometryIndex
|
|
781
|
-
) === false)
|
|
782
|
-
return false;
|
|
783
|
-
coordIndex++;
|
|
784
|
-
multiFeatureIndex++;
|
|
785
|
-
break;
|
|
786
|
-
case "LineString":
|
|
787
|
-
case "MultiPoint":
|
|
788
|
-
for (j = 0; j < coords.length; j++) {
|
|
789
|
-
if (callback(
|
|
790
|
-
coords[j],
|
|
791
|
-
coordIndex,
|
|
792
|
-
featureIndex,
|
|
793
|
-
multiFeatureIndex,
|
|
794
|
-
geometryIndex
|
|
795
|
-
) === false)
|
|
796
|
-
return false;
|
|
797
|
-
coordIndex++;
|
|
798
|
-
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
799
|
-
}
|
|
800
|
-
if (geomType === "LineString") multiFeatureIndex++;
|
|
801
|
-
break;
|
|
802
|
-
case "Polygon":
|
|
803
|
-
case "MultiLineString":
|
|
804
|
-
for (j = 0; j < coords.length; j++) {
|
|
805
|
-
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
806
|
-
if (callback(
|
|
807
|
-
coords[j][k],
|
|
808
|
-
coordIndex,
|
|
809
|
-
featureIndex,
|
|
810
|
-
multiFeatureIndex,
|
|
811
|
-
geometryIndex
|
|
812
|
-
) === false)
|
|
813
|
-
return false;
|
|
814
|
-
coordIndex++;
|
|
815
|
-
}
|
|
816
|
-
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
817
|
-
if (geomType === "Polygon") geometryIndex++;
|
|
818
|
-
}
|
|
819
|
-
if (geomType === "Polygon") multiFeatureIndex++;
|
|
820
|
-
break;
|
|
821
|
-
case "MultiPolygon":
|
|
822
|
-
for (j = 0; j < coords.length; j++) {
|
|
823
|
-
geometryIndex = 0;
|
|
824
|
-
for (k = 0; k < coords[j].length; k++) {
|
|
825
|
-
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
|
826
|
-
if (callback(
|
|
827
|
-
coords[j][k][l],
|
|
828
|
-
coordIndex,
|
|
829
|
-
featureIndex,
|
|
830
|
-
multiFeatureIndex,
|
|
831
|
-
geometryIndex
|
|
832
|
-
) === false)
|
|
833
|
-
return false;
|
|
834
|
-
coordIndex++;
|
|
835
|
-
}
|
|
836
|
-
geometryIndex++;
|
|
837
|
-
}
|
|
838
|
-
multiFeatureIndex++;
|
|
839
|
-
}
|
|
840
|
-
break;
|
|
841
|
-
case "GeometryCollection":
|
|
842
|
-
for (j = 0; j < geometry.geometries.length; j++)
|
|
843
|
-
if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
|
|
844
|
-
return false;
|
|
845
|
-
break;
|
|
846
|
-
default:
|
|
847
|
-
throw new Error("Unknown Geometry Type");
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
854
|
-
function bbox(geojson, options = {}) {
|
|
855
|
-
if (geojson.bbox != null && true !== options.recompute) {
|
|
856
|
-
return geojson.bbox;
|
|
857
|
-
}
|
|
858
|
-
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
859
|
-
coordEach(geojson, (coord) => {
|
|
860
|
-
if (result[0] > coord[0]) {
|
|
861
|
-
result[0] = coord[0];
|
|
862
|
-
}
|
|
863
|
-
if (result[1] > coord[1]) {
|
|
864
|
-
result[1] = coord[1];
|
|
865
|
-
}
|
|
866
|
-
if (result[2] < coord[0]) {
|
|
867
|
-
result[2] = coord[0];
|
|
868
|
-
}
|
|
869
|
-
if (result[3] < coord[1]) {
|
|
870
|
-
result[3] = coord[1];
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
|
-
return result;
|
|
874
|
-
}
|
|
875
|
-
var index_default = bbox;
|
|
876
|
-
|
|
877
|
-
// src/IndoorMap/IndoorMap.ts
|
|
878
|
-
var import_transform_scale = __toESM(require("@turf/transform-scale"));
|
|
879
|
-
var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
|
|
880
|
-
var import_three8 = require("three");
|
|
855
|
+
var import_three7 = require("three");
|
|
856
|
+
var import_maptalks10 = require("maptalks.three");
|
|
881
857
|
|
|
882
858
|
// src/IndoorMap/constants.ts
|
|
883
859
|
var defaultLayerOption = { enableAltitude: true };
|
|
@@ -1873,18 +1849,6 @@ var loadModel3d = (model3d, coordinate, threeLayer) => {
|
|
|
1873
1849
|
);
|
|
1874
1850
|
});
|
|
1875
1851
|
};
|
|
1876
|
-
var create3DModels = async (models, defaultCoordinate, properties, threeLayer) => {
|
|
1877
|
-
let modelObjs = [];
|
|
1878
|
-
for (let j = 0; j < models.length; j++) {
|
|
1879
|
-
const model = models[j];
|
|
1880
|
-
const positionCoord = import_lodash4.default.get(model, "properties.position");
|
|
1881
|
-
const coord = positionCoord || defaultCoordinate;
|
|
1882
|
-
const object = await loadModel3d(model, coord, threeLayer);
|
|
1883
|
-
object.properties = properties;
|
|
1884
|
-
modelObjs.push(object);
|
|
1885
|
-
}
|
|
1886
|
-
return modelObjs;
|
|
1887
|
-
};
|
|
1888
1852
|
var createExtrudePolygon = (geometry, threeLayer, material, height, properties = {}, options) => {
|
|
1889
1853
|
const { offset = 0, altitude = 0 } = options;
|
|
1890
1854
|
const offsetGeometry = (0, import_buffer.default)(geometry, offset, { units: "meters" });
|
|
@@ -2792,44 +2756,6 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2792
2756
|
markerProperties
|
|
2793
2757
|
);
|
|
2794
2758
|
},
|
|
2795
|
-
createVenue3DModel: async (venue, threeLayer) => {
|
|
2796
|
-
const { id, feature_type, properties } = venue;
|
|
2797
|
-
const { category, model3d } = properties;
|
|
2798
|
-
const modelProperty = {
|
|
2799
|
-
id,
|
|
2800
|
-
feature_type,
|
|
2801
|
-
category
|
|
2802
|
-
};
|
|
2803
|
-
const center2 = (0, import_center2.default)(venue);
|
|
2804
|
-
const centerCoord = import_lodash4.default.get(center2, "geometry.coordinates");
|
|
2805
|
-
const modelPosition = import_lodash4.default.get(model3d, "properties.position", centerCoord);
|
|
2806
|
-
const models = await create3DModels(
|
|
2807
|
-
model3d,
|
|
2808
|
-
modelPosition,
|
|
2809
|
-
modelProperty,
|
|
2810
|
-
threeLayer
|
|
2811
|
-
);
|
|
2812
|
-
return models;
|
|
2813
|
-
},
|
|
2814
|
-
create3DFixture: async (fixture, threeLayer) => {
|
|
2815
|
-
const { id, feature_type, properties } = fixture;
|
|
2816
|
-
const { category, ordinal, model3d } = properties;
|
|
2817
|
-
const modelProperty = {
|
|
2818
|
-
id,
|
|
2819
|
-
feature_type,
|
|
2820
|
-
category,
|
|
2821
|
-
ordinal
|
|
2822
|
-
};
|
|
2823
|
-
const center2 = (0, import_center2.default)(fixture);
|
|
2824
|
-
const coordinate = import_lodash4.default.get(center2, "geometry.coordinates");
|
|
2825
|
-
const models = await create3DModels(
|
|
2826
|
-
model3d,
|
|
2827
|
-
coordinate,
|
|
2828
|
-
modelProperty,
|
|
2829
|
-
threeLayer
|
|
2830
|
-
);
|
|
2831
|
-
return models;
|
|
2832
|
-
},
|
|
2833
2759
|
createExtrudedUnit: (unit, threeLayer, options) => {
|
|
2834
2760
|
const extrudeHeight = import_lodash4.default.get(options, "height");
|
|
2835
2761
|
if (!extrudeHeight) return;
|
|
@@ -2869,24 +2795,6 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2869
2795
|
options3d
|
|
2870
2796
|
);
|
|
2871
2797
|
return object;
|
|
2872
|
-
},
|
|
2873
|
-
createAmbientLight: (config) => {
|
|
2874
|
-
const { color: colorString = "0xffffff", intensity = 1 } = config;
|
|
2875
|
-
const color = parseInt(colorString, 16);
|
|
2876
|
-
const ambientLight = new import_three5.AmbientLight(color, intensity);
|
|
2877
|
-
return ambientLight;
|
|
2878
|
-
},
|
|
2879
|
-
createDirectionalLight: (config) => {
|
|
2880
|
-
const {
|
|
2881
|
-
color: colorString = "0xffffff",
|
|
2882
|
-
intensity = 1,
|
|
2883
|
-
position: positionString = [0, 0, 0]
|
|
2884
|
-
} = config;
|
|
2885
|
-
const color = parseInt(colorString, 16);
|
|
2886
|
-
const [x, y, z] = positionString;
|
|
2887
|
-
const light = new import_three5.DirectionalLight(color, intensity);
|
|
2888
|
-
light.position.set(x, y, z).normalize();
|
|
2889
|
-
return light;
|
|
2890
2798
|
}
|
|
2891
2799
|
};
|
|
2892
2800
|
};
|
|
@@ -3056,311 +2964,229 @@ var createHighlighExtrudeObjectController = (obj, { color }) => {
|
|
|
3056
2964
|
};
|
|
3057
2965
|
|
|
3058
2966
|
// src/IndoorMap/camera/CameraManager.ts
|
|
3059
|
-
var
|
|
3060
|
-
var ZOOM_IN_LEVEL = 24;
|
|
3061
|
-
var CameraManager = class {
|
|
3062
|
-
map;
|
|
3063
|
-
constructor(map, options) {
|
|
3064
|
-
this.map = map;
|
|
3065
|
-
if (options?.defaultView) {
|
|
3066
|
-
this.setView(options?.defaultView);
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
/** Private method */
|
|
3070
|
-
#animateflyTo(viewOptions = {}, options = {}, callbackOption = () => {
|
|
3071
|
-
}) {
|
|
3072
|
-
const { start, end } = {
|
|
3073
|
-
start: (frame) => {
|
|
3074
|
-
},
|
|
3075
|
-
end: (frame) => {
|
|
3076
|
-
},
|
|
3077
|
-
...callbackOption
|
|
3078
|
-
};
|
|
3079
|
-
this.map.flyTo(viewOptions, options, (frame) => {
|
|
3080
|
-
if (frame.state.playState === "running" && frame.state.progress === 0)
|
|
3081
|
-
start(frame);
|
|
3082
|
-
if (frame.state.playState === "finished") end(frame);
|
|
3083
|
-
});
|
|
3084
|
-
}
|
|
3085
|
-
/** Public methods */
|
|
3086
|
-
getView = () => {
|
|
3087
|
-
return this.map.getView();
|
|
3088
|
-
};
|
|
3089
|
-
getZoom = () => {
|
|
3090
|
-
return this.map.getView().zoom;
|
|
3091
|
-
};
|
|
3092
|
-
setView = (value) => {
|
|
3093
|
-
this.map.setView(value);
|
|
3094
|
-
};
|
|
3095
|
-
flyTo = (center2, options = {}) => {
|
|
3096
|
-
const currentView = this.getView();
|
|
3097
|
-
const {
|
|
3098
|
-
zoom = ZOOM_OUT_LEVEL,
|
|
3099
|
-
pitch = 60,
|
|
3100
|
-
duration = 600,
|
|
3101
|
-
easing = "out",
|
|
3102
|
-
bearing = currentView.bearing
|
|
3103
|
-
} = options;
|
|
3104
|
-
this.#animateflyTo(
|
|
3105
|
-
{
|
|
3106
|
-
center: center2,
|
|
3107
|
-
zoom,
|
|
3108
|
-
pitch,
|
|
3109
|
-
bearing
|
|
3110
|
-
},
|
|
3111
|
-
{ duration, easing }
|
|
3112
|
-
);
|
|
3113
|
-
};
|
|
3114
|
-
flyToAndZoomIn = (centerPoint, options = {}) => {
|
|
3115
|
-
const {
|
|
3116
|
-
zoom = ZOOM_IN_LEVEL,
|
|
3117
|
-
pitch = 60,
|
|
3118
|
-
duration = 600,
|
|
3119
|
-
easing = "out"
|
|
3120
|
-
} = options;
|
|
3121
|
-
this.#animateflyTo(
|
|
3122
|
-
{
|
|
3123
|
-
center: centerPoint,
|
|
3124
|
-
zoom,
|
|
3125
|
-
pitch
|
|
3126
|
-
},
|
|
3127
|
-
{ duration, easing }
|
|
3128
|
-
);
|
|
3129
|
-
};
|
|
3130
|
-
};
|
|
3131
|
-
|
|
3132
|
-
// src/IndoorMap/renderer/RendererManager.ts
|
|
3133
|
-
var import_min = __toESM(require("lodash/min"));
|
|
3134
|
-
var import_center3 = require("@turf/center");
|
|
3135
|
-
var import_maptalks8 = require("maptalks.three");
|
|
3136
|
-
var THREE3 = __toESM(require("three"));
|
|
3137
|
-
|
|
3138
|
-
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
3139
|
-
var maptalks4 = __toESM(require("maptalks"));
|
|
3140
|
-
var THREE2 = __toESM(require("three"));
|
|
3141
|
-
var import_GLTFLoader2 = require("three/examples/jsm/loaders/GLTFLoader");
|
|
3142
|
-
var import_DRACOLoader = require("three/examples/jsm/loaders/DRACOLoader");
|
|
3143
|
-
var import_buffer2 = __toESM(require("@turf/buffer"));
|
|
2967
|
+
var import_maptalks6 = require("maptalks");
|
|
3144
2968
|
|
|
3145
|
-
//
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
2969
|
+
// ../../node_modules/@turf/meta/dist/esm/index.js
|
|
2970
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
2971
|
+
if (geojson === null) return;
|
|
2972
|
+
var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
2973
|
+
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
2974
|
+
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
2975
|
+
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
2976
|
+
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
2977
|
+
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
2978
|
+
var multiFeatureIndex = 0;
|
|
2979
|
+
var geometryIndex = 0;
|
|
2980
|
+
geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
2981
|
+
if (geometry === null) continue;
|
|
2982
|
+
coords = geometry.coordinates;
|
|
2983
|
+
var geomType = geometry.type;
|
|
2984
|
+
wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
|
|
2985
|
+
switch (geomType) {
|
|
2986
|
+
case null:
|
|
2987
|
+
break;
|
|
2988
|
+
case "Point":
|
|
2989
|
+
if (callback(
|
|
2990
|
+
coords,
|
|
2991
|
+
coordIndex,
|
|
2992
|
+
featureIndex,
|
|
2993
|
+
multiFeatureIndex,
|
|
2994
|
+
geometryIndex
|
|
2995
|
+
) === false)
|
|
2996
|
+
return false;
|
|
2997
|
+
coordIndex++;
|
|
2998
|
+
multiFeatureIndex++;
|
|
2999
|
+
break;
|
|
3000
|
+
case "LineString":
|
|
3001
|
+
case "MultiPoint":
|
|
3002
|
+
for (j = 0; j < coords.length; j++) {
|
|
3003
|
+
if (callback(
|
|
3004
|
+
coords[j],
|
|
3005
|
+
coordIndex,
|
|
3006
|
+
featureIndex,
|
|
3007
|
+
multiFeatureIndex,
|
|
3008
|
+
geometryIndex
|
|
3009
|
+
) === false)
|
|
3010
|
+
return false;
|
|
3011
|
+
coordIndex++;
|
|
3012
|
+
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
3013
|
+
}
|
|
3014
|
+
if (geomType === "LineString") multiFeatureIndex++;
|
|
3015
|
+
break;
|
|
3016
|
+
case "Polygon":
|
|
3017
|
+
case "MultiLineString":
|
|
3018
|
+
for (j = 0; j < coords.length; j++) {
|
|
3019
|
+
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
3020
|
+
if (callback(
|
|
3021
|
+
coords[j][k],
|
|
3022
|
+
coordIndex,
|
|
3023
|
+
featureIndex,
|
|
3024
|
+
multiFeatureIndex,
|
|
3025
|
+
geometryIndex
|
|
3026
|
+
) === false)
|
|
3027
|
+
return false;
|
|
3028
|
+
coordIndex++;
|
|
3029
|
+
}
|
|
3030
|
+
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
3031
|
+
if (geomType === "Polygon") geometryIndex++;
|
|
3032
|
+
}
|
|
3033
|
+
if (geomType === "Polygon") multiFeatureIndex++;
|
|
3034
|
+
break;
|
|
3035
|
+
case "MultiPolygon":
|
|
3036
|
+
for (j = 0; j < coords.length; j++) {
|
|
3037
|
+
geometryIndex = 0;
|
|
3038
|
+
for (k = 0; k < coords[j].length; k++) {
|
|
3039
|
+
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
|
3040
|
+
if (callback(
|
|
3041
|
+
coords[j][k][l],
|
|
3042
|
+
coordIndex,
|
|
3043
|
+
featureIndex,
|
|
3044
|
+
multiFeatureIndex,
|
|
3045
|
+
geometryIndex
|
|
3046
|
+
) === false)
|
|
3047
|
+
return false;
|
|
3048
|
+
coordIndex++;
|
|
3049
|
+
}
|
|
3050
|
+
geometryIndex++;
|
|
3051
|
+
}
|
|
3052
|
+
multiFeatureIndex++;
|
|
3053
|
+
}
|
|
3054
|
+
break;
|
|
3055
|
+
case "GeometryCollection":
|
|
3056
|
+
for (j = 0; j < geometry.geometries.length; j++)
|
|
3057
|
+
if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
|
|
3058
|
+
return false;
|
|
3059
|
+
break;
|
|
3060
|
+
default:
|
|
3061
|
+
throw new Error("Unknown Geometry Type");
|
|
3062
|
+
}
|
|
3166
3063
|
}
|
|
3167
3064
|
}
|
|
3168
|
-
}
|
|
3169
|
-
|
|
3170
|
-
// src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
|
|
3171
|
-
var import_maptalks6 = require("maptalks");
|
|
3172
|
-
var THREE = __toESM(require("three"));
|
|
3173
|
-
var import_maptalks7 = require("maptalks.three");
|
|
3174
|
-
var import_lodash6 = require("lodash");
|
|
3065
|
+
}
|
|
3175
3066
|
|
|
3176
|
-
//
|
|
3177
|
-
|
|
3178
|
-
if (
|
|
3179
|
-
|
|
3180
|
-
for (let i = 0; i < stops.length - 1; i++) {
|
|
3181
|
-
const [z1, v1] = stops[i];
|
|
3182
|
-
const [z2, v2] = stops[i + 1];
|
|
3183
|
-
if (zoom >= z1 && zoom <= z2) {
|
|
3184
|
-
const t = (zoom - z1) / (z2 - z1);
|
|
3185
|
-
return v1 + t * (v2 - v1);
|
|
3186
|
-
}
|
|
3067
|
+
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
3068
|
+
function bbox(geojson, options = {}) {
|
|
3069
|
+
if (geojson.bbox != null && true !== options.recompute) {
|
|
3070
|
+
return geojson.bbox;
|
|
3187
3071
|
}
|
|
3188
|
-
|
|
3072
|
+
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
3073
|
+
coordEach(geojson, (coord) => {
|
|
3074
|
+
if (result[0] > coord[0]) {
|
|
3075
|
+
result[0] = coord[0];
|
|
3076
|
+
}
|
|
3077
|
+
if (result[1] > coord[1]) {
|
|
3078
|
+
result[1] = coord[1];
|
|
3079
|
+
}
|
|
3080
|
+
if (result[2] < coord[0]) {
|
|
3081
|
+
result[2] = coord[0];
|
|
3082
|
+
}
|
|
3083
|
+
if (result[3] < coord[1]) {
|
|
3084
|
+
result[3] = coord[1];
|
|
3085
|
+
}
|
|
3086
|
+
});
|
|
3087
|
+
return result;
|
|
3088
|
+
}
|
|
3089
|
+
var index_default = bbox;
|
|
3189
3090
|
|
|
3190
|
-
// src/IndoorMap/
|
|
3191
|
-
var
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
background: "rgba(0, 0, 0, 0.2)",
|
|
3200
|
-
lineHeight: 32,
|
|
3201
|
-
padding: 8,
|
|
3202
|
-
strokeColor: "#000000",
|
|
3203
|
-
strokeWidth: 6,
|
|
3204
|
-
strokeStyle: "round",
|
|
3205
|
-
// Sprite options
|
|
3206
|
-
/* Overall scale multiplier */
|
|
3207
|
-
scale: 1,
|
|
3208
|
-
altitude: 0,
|
|
3209
|
-
opacity: 1
|
|
3210
|
-
};
|
|
3211
|
-
var TextSpriteMarker = class extends import_maptalks7.BaseObject {
|
|
3212
|
-
#altitudeOffset = 0;
|
|
3213
|
-
constructor(coordinate, options, layer, properties = {}) {
|
|
3214
|
-
options = import_maptalks6.Util.extend({}, OPTIONS4, options, { layer });
|
|
3215
|
-
super();
|
|
3216
|
-
this._coordinate = new import_maptalks6.Coordinate(coordinate);
|
|
3217
|
-
this._initOptions(options);
|
|
3218
|
-
this._createGroup();
|
|
3219
|
-
this.properties = { ...properties };
|
|
3220
|
-
const sprite = this._createSprite();
|
|
3221
|
-
this.getObject3d().add(sprite);
|
|
3222
|
-
this._updatePosition();
|
|
3223
|
-
this.type = "TextSpriteMarker";
|
|
3224
|
-
}
|
|
3225
|
-
getOptions() {
|
|
3226
|
-
return super.getOptions();
|
|
3227
|
-
}
|
|
3228
|
-
_createSprite() {
|
|
3229
|
-
const options = this.getOptions();
|
|
3230
|
-
const texture = this._createTextTexture(options.text, options);
|
|
3231
|
-
const material = new THREE.SpriteMaterial({
|
|
3232
|
-
map: texture,
|
|
3233
|
-
transparent: true,
|
|
3234
|
-
alphaTest: 0.1
|
|
3235
|
-
});
|
|
3236
|
-
const sprite = new THREE.Sprite(material);
|
|
3237
|
-
const w = texture.image.width;
|
|
3238
|
-
const h = texture.image.height;
|
|
3239
|
-
const base = 1 / 16;
|
|
3240
|
-
const normalizedScale = options.scale / this.getMap().getGLRes();
|
|
3241
|
-
sprite.scale.set(w * base * normalizedScale, h * base * normalizedScale, 1);
|
|
3242
|
-
this.#altitudeOffset = Math.max(
|
|
3243
|
-
h * base * options.scale * 0.5,
|
|
3244
|
-
0.05
|
|
3245
|
-
// minimum lift in world units
|
|
3246
|
-
);
|
|
3247
|
-
return sprite;
|
|
3248
|
-
}
|
|
3249
|
-
_createTextTexture(text, options = {}) {
|
|
3250
|
-
const {
|
|
3251
|
-
padding,
|
|
3252
|
-
fontSize,
|
|
3253
|
-
fontFamily,
|
|
3254
|
-
fontWeight,
|
|
3255
|
-
lineHeight,
|
|
3256
|
-
background,
|
|
3257
|
-
color,
|
|
3258
|
-
textAlign,
|
|
3259
|
-
strokeColor,
|
|
3260
|
-
strokeWidth,
|
|
3261
|
-
maxWidth
|
|
3262
|
-
} = options || {};
|
|
3263
|
-
const canvas = document.createElement("canvas");
|
|
3264
|
-
const ctx = canvas.getContext("2d");
|
|
3265
|
-
ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
3266
|
-
const paragraphs = String(text).split("\n");
|
|
3267
|
-
const wrappedLines = [];
|
|
3268
|
-
paragraphs.forEach((paragraph) => {
|
|
3269
|
-
if ((0, import_lodash6.isNil)(maxWidth) || isNaN(maxWidth)) {
|
|
3270
|
-
wrappedLines.push(paragraph);
|
|
3271
|
-
return;
|
|
3272
|
-
}
|
|
3273
|
-
const words = paragraph.split(/\s+/);
|
|
3274
|
-
let currentLine = "";
|
|
3275
|
-
words.forEach((word) => {
|
|
3276
|
-
const testLine = currentLine ? currentLine + " " + word : word;
|
|
3277
|
-
const testWidth = ctx.measureText(testLine).width;
|
|
3278
|
-
if (testWidth > maxWidth && currentLine) {
|
|
3279
|
-
wrappedLines.push(currentLine);
|
|
3280
|
-
currentLine = word;
|
|
3281
|
-
} else {
|
|
3282
|
-
currentLine = testLine;
|
|
3283
|
-
}
|
|
3284
|
-
});
|
|
3285
|
-
if (currentLine) {
|
|
3286
|
-
wrappedLines.push(currentLine);
|
|
3287
|
-
}
|
|
3288
|
-
});
|
|
3289
|
-
const lines = wrappedLines.length ? wrappedLines : [""];
|
|
3290
|
-
const widest = Math.max(...lines.map((l) => ctx.measureText(l).width), 0);
|
|
3291
|
-
const finalWidth = (maxWidth ? Math.min(widest, maxWidth) : widest) + padding * 2;
|
|
3292
|
-
const finalHeight = lineHeight * lines.length + padding * 2;
|
|
3293
|
-
canvas.width = finalWidth;
|
|
3294
|
-
canvas.height = finalHeight;
|
|
3295
|
-
const ctx2 = canvas.getContext("2d");
|
|
3296
|
-
ctx2.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
3297
|
-
ctx2.textAlign = textAlign;
|
|
3298
|
-
if (background && background !== "transparent") {
|
|
3299
|
-
ctx2.fillStyle = background;
|
|
3300
|
-
ctx2.fillRect(0, 0, canvas.width, canvas.height);
|
|
3091
|
+
// src/IndoorMap/camera/CameraManager.ts
|
|
3092
|
+
var import_transform_scale = __toESM(require("@turf/transform-scale"));
|
|
3093
|
+
var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
|
|
3094
|
+
var CameraManager = class {
|
|
3095
|
+
map;
|
|
3096
|
+
constructor(map, options) {
|
|
3097
|
+
this.map = map;
|
|
3098
|
+
if (options?.defaultView) {
|
|
3099
|
+
this.setView(options?.defaultView);
|
|
3301
3100
|
}
|
|
3302
|
-
lines.forEach((line, i) => {
|
|
3303
|
-
const y = padding + lineHeight * (i + 0.8);
|
|
3304
|
-
let x = padding;
|
|
3305
|
-
if (textAlign === "center") x = canvas.width / 2;
|
|
3306
|
-
if (textAlign === "right" || textAlign === "end")
|
|
3307
|
-
x = canvas.width - padding;
|
|
3308
|
-
if (strokeWidth > 0) {
|
|
3309
|
-
ctx2.lineWidth = strokeWidth;
|
|
3310
|
-
ctx2.lineJoin = "round";
|
|
3311
|
-
ctx2.miterLimit = 2;
|
|
3312
|
-
ctx2.strokeStyle = strokeColor;
|
|
3313
|
-
ctx2.strokeText(line, x, y);
|
|
3314
|
-
}
|
|
3315
|
-
ctx2.fillStyle = color;
|
|
3316
|
-
ctx2.fillText(line, x, y);
|
|
3317
|
-
});
|
|
3318
|
-
const texture = new THREE.CanvasTexture(canvas);
|
|
3319
|
-
texture.needsUpdate = true;
|
|
3320
|
-
texture.minFilter = THREE.LinearFilter;
|
|
3321
|
-
return texture;
|
|
3322
3101
|
}
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3102
|
+
/** Public methods */
|
|
3103
|
+
getView = () => {
|
|
3104
|
+
return this.map.getView();
|
|
3105
|
+
};
|
|
3106
|
+
setView = (value) => {
|
|
3107
|
+
if (this.map && Object.keys(value).length !== 0) {
|
|
3108
|
+
this.map.setView(value);
|
|
3109
|
+
}
|
|
3110
|
+
};
|
|
3111
|
+
animateTo = (view, options = {}, step) => {
|
|
3112
|
+
this.map.animateTo(view, options, step);
|
|
3113
|
+
};
|
|
3114
|
+
setMaxExtent(extent) {
|
|
3115
|
+
return this.map.setMaxExtent(extent);
|
|
3332
3116
|
}
|
|
3333
|
-
|
|
3334
|
-
const
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
throw new Error(`Unknown opacity value ${opacity}`);
|
|
3347
|
-
}
|
|
3348
|
-
const visible = opacityValue > 0.5;
|
|
3349
|
-
object3d.visible = visible;
|
|
3117
|
+
getFeatureExtent = (feature2, scaleFactor = 1) => {
|
|
3118
|
+
const [minX, minY, maxX, maxY] = index_default(
|
|
3119
|
+
(0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
|
|
3120
|
+
);
|
|
3121
|
+
return new import_maptalks6.Extent(minX, minY, maxX, maxY);
|
|
3122
|
+
};
|
|
3123
|
+
getExtentZoom = (extent, options = {
|
|
3124
|
+
isFraction: false,
|
|
3125
|
+
padding: {
|
|
3126
|
+
paddingLeft: 0,
|
|
3127
|
+
paddingRight: 0,
|
|
3128
|
+
paddingTop: 0,
|
|
3129
|
+
paddingBottom: 0
|
|
3350
3130
|
}
|
|
3131
|
+
}) => {
|
|
3132
|
+
const { isFraction = false, padding } = options;
|
|
3133
|
+
return this.map.getFitZoom(extent, isFraction, padding);
|
|
3134
|
+
};
|
|
3135
|
+
set maxZoom(value) {
|
|
3136
|
+
this.map.setMaxZoom(value);
|
|
3137
|
+
const spatialReference = {
|
|
3138
|
+
projection: "EPSG:3857",
|
|
3139
|
+
resolutions: (function() {
|
|
3140
|
+
const resolutions = [];
|
|
3141
|
+
const d = 2 * 6378137 * Math.PI;
|
|
3142
|
+
for (let i = 0; i < value; i++) {
|
|
3143
|
+
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
3144
|
+
}
|
|
3145
|
+
return resolutions;
|
|
3146
|
+
})()
|
|
3147
|
+
};
|
|
3148
|
+
this.map.setSpatialReference(spatialReference);
|
|
3351
3149
|
}
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
options.text = text;
|
|
3355
|
-
const newSprite = this._createSprite();
|
|
3356
|
-
const group = this.getObject3d();
|
|
3357
|
-
group.children.forEach((child) => group.remove(child));
|
|
3358
|
-
group.add(newSprite);
|
|
3359
|
-
this._updatePosition();
|
|
3150
|
+
set minZoom(value) {
|
|
3151
|
+
this.map.setMinZoom(value);
|
|
3360
3152
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3153
|
+
};
|
|
3154
|
+
|
|
3155
|
+
// src/IndoorMap/renderer/RendererManager.ts
|
|
3156
|
+
var import_isFunction = __toESM(require("lodash/isFunction"));
|
|
3157
|
+
var import_min = __toESM(require("lodash/min"));
|
|
3158
|
+
var import_center3 = require("@turf/center");
|
|
3159
|
+
var THREE3 = __toESM(require("three"));
|
|
3160
|
+
|
|
3161
|
+
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
3162
|
+
var maptalks4 = __toESM(require("maptalks-gl"));
|
|
3163
|
+
var THREE = __toESM(require("three"));
|
|
3164
|
+
var import_maptalks7 = require("maptalks.three");
|
|
3165
|
+
var import_buffer2 = __toESM(require("@turf/buffer"));
|
|
3166
|
+
|
|
3167
|
+
// src/IndoorMap/renderer/3d/element3DRendererOptions.ts
|
|
3168
|
+
var element3DRendererOptions = {
|
|
3169
|
+
unit: {
|
|
3170
|
+
default: { color: "#ffffff", height: 4 },
|
|
3171
|
+
byCategory: {
|
|
3172
|
+
walkway: { color: "#cccccc", height: 0.1 },
|
|
3173
|
+
terrace: { color: "#cccccc", height: 0.1 },
|
|
3174
|
+
unenclosedarea: { color: "#cccccc", height: 0.2 },
|
|
3175
|
+
nonpublic: { color: "#999999", height: 0.3 },
|
|
3176
|
+
escalator: { height: 0.2 },
|
|
3177
|
+
parking: { height: 0.1 },
|
|
3178
|
+
room: { color: "#ffffff", height: 2, bottomHeight: 0.12 }
|
|
3179
|
+
}
|
|
3180
|
+
},
|
|
3181
|
+
kiosk: {
|
|
3182
|
+
default: { color: "#666666", height: 0.6, bottomHeight: 0.12 }
|
|
3183
|
+
},
|
|
3184
|
+
fixture: {
|
|
3185
|
+
default: { color: "#ffffff", height: 0.5 },
|
|
3186
|
+
byCategory: {
|
|
3187
|
+
water: { color: "#ACD7EC", height: 0.1 },
|
|
3188
|
+
vegetation: { color: "#91C499", height: 0.5 }
|
|
3189
|
+
}
|
|
3364
3190
|
}
|
|
3365
3191
|
};
|
|
3366
3192
|
|
|
@@ -3384,21 +3210,22 @@ var getGeometryOption = (feature2, options) => {
|
|
|
3384
3210
|
var Element3DRenderer = class extends EventTarget {
|
|
3385
3211
|
options;
|
|
3386
3212
|
map;
|
|
3213
|
+
gltfLayer;
|
|
3387
3214
|
threeLayer;
|
|
3388
|
-
|
|
3215
|
+
scene;
|
|
3216
|
+
// private dracoLoader: DRACOLoader
|
|
3389
3217
|
lineMaterial;
|
|
3390
3218
|
materialByColorMap;
|
|
3391
|
-
markerRenderer;
|
|
3392
3219
|
// Renderer is Ready
|
|
3393
3220
|
isReady = false;
|
|
3394
|
-
constructor(map, options
|
|
3221
|
+
constructor(map, options) {
|
|
3395
3222
|
super();
|
|
3396
3223
|
this.options = options;
|
|
3397
3224
|
this.map = map;
|
|
3398
|
-
|
|
3399
|
-
this.
|
|
3400
|
-
this.
|
|
3401
|
-
this.
|
|
3225
|
+
const groupLayer = this.map.getLayer("group");
|
|
3226
|
+
this.threeLayer = groupLayer.getLayer("three");
|
|
3227
|
+
this.gltfLayer = groupLayer.getLayer("gltf");
|
|
3228
|
+
this.lineMaterial = new THREE.LineBasicMaterial({ color: "#000" });
|
|
3402
3229
|
this.render();
|
|
3403
3230
|
}
|
|
3404
3231
|
animation() {
|
|
@@ -3413,7 +3240,7 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3413
3240
|
if (!this.materialByColorMap) this.materialByColorMap = /* @__PURE__ */ new Map();
|
|
3414
3241
|
const existingMaterial = this.materialByColorMap.get(color);
|
|
3415
3242
|
if (existingMaterial) return existingMaterial;
|
|
3416
|
-
const created = new
|
|
3243
|
+
const created = new THREE.MeshLambertMaterial({ color, transparent: true });
|
|
3417
3244
|
created.toneMapped = false;
|
|
3418
3245
|
this.materialByColorMap.set(color, created);
|
|
3419
3246
|
return created;
|
|
@@ -3428,46 +3255,48 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3428
3255
|
} = getGeometryOption(feature2, this.options);
|
|
3429
3256
|
const _this = this;
|
|
3430
3257
|
const createPolygon = (geometry, feature3) => {
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
)
|
|
3465
|
-
|
|
3258
|
+
try {
|
|
3259
|
+
const [outerRing, ...innerRings] = geometry.coordinates;
|
|
3260
|
+
const offsetFeature = offset !== 0 ? (0, import_buffer2.default)(geometry, offset, { units: "meters" }) : feature3;
|
|
3261
|
+
const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#ffffff";
|
|
3262
|
+
if (color === "transparent") return;
|
|
3263
|
+
const material = this.getOrCreateMaterialByColor(color);
|
|
3264
|
+
const altitude = 0;
|
|
3265
|
+
const height = feature3.properties.height ?? heightOptions ?? HEIGHT_METER;
|
|
3266
|
+
const bottomHeight = feature3.properties.bottomHeight ?? bottomHeightOptions ?? 0;
|
|
3267
|
+
const extrudedPolygon = this.threeLayer.toExtrudePolygon(
|
|
3268
|
+
offsetFeature,
|
|
3269
|
+
{ asynchronous: true, ...options, height, bottomHeight, altitude },
|
|
3270
|
+
material
|
|
3271
|
+
);
|
|
3272
|
+
const topLineStrings = [
|
|
3273
|
+
new maptalks4.LineString(outerRing),
|
|
3274
|
+
...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
|
|
3275
|
+
];
|
|
3276
|
+
const topLines = this.threeLayer.toLines(
|
|
3277
|
+
topLineStrings,
|
|
3278
|
+
{ altitude, bottomHeight: bottomHeight + height + 1e-3, interactive: false },
|
|
3279
|
+
this.lineMaterial
|
|
3280
|
+
);
|
|
3281
|
+
const bottomLineStrings = [
|
|
3282
|
+
new maptalks4.LineString(outerRing),
|
|
3283
|
+
...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
|
|
3284
|
+
];
|
|
3285
|
+
const bottomLines = this.threeLayer.toLines(
|
|
3286
|
+
bottomLineStrings,
|
|
3287
|
+
{ altitude, bottomHeight, interactive: false },
|
|
3288
|
+
this.lineMaterial
|
|
3289
|
+
);
|
|
3290
|
+
return [extrudedPolygon, topLines, bottomLines];
|
|
3291
|
+
} catch (err) {
|
|
3292
|
+
return [];
|
|
3293
|
+
}
|
|
3466
3294
|
};
|
|
3467
3295
|
try {
|
|
3468
3296
|
switch (feature2.geometry.type) {
|
|
3469
3297
|
case "MultiPolygon": {
|
|
3470
3298
|
const { coordinates } = feature2.geometry;
|
|
3299
|
+
if (!coordinates) return [];
|
|
3471
3300
|
const multiMeshes = coordinates.flatMap((polygonCoordinates) => {
|
|
3472
3301
|
const meshes = createPolygon({ type: "Polygon", coordinates: polygonCoordinates }, feature2);
|
|
3473
3302
|
this.threeLayer.addMesh(meshes);
|
|
@@ -3476,70 +3305,47 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3476
3305
|
return multiMeshes;
|
|
3477
3306
|
}
|
|
3478
3307
|
case "Polygon": {
|
|
3308
|
+
const { coordinates } = feature2.geometry;
|
|
3309
|
+
if (!coordinates) return [];
|
|
3479
3310
|
const meshes = createPolygon(feature2.geometry, feature2);
|
|
3480
3311
|
this.threeLayer.addMesh(meshes);
|
|
3481
3312
|
return meshes;
|
|
3482
3313
|
}
|
|
3483
3314
|
}
|
|
3484
3315
|
} catch (err) {
|
|
3485
|
-
console.log(`error createGeometry`, { feature: feature2, options });
|
|
3316
|
+
console.log(`error createGeometry`, err, { feature: feature2, options });
|
|
3486
3317
|
}
|
|
3487
3318
|
};
|
|
3488
3319
|
async createEscalator(f, coordinate, options) {
|
|
3320
|
+
const model = {
|
|
3321
|
+
url: "https://cdn.venue.in.th/static/glb/escalator.glb",
|
|
3322
|
+
size: 4.4
|
|
3323
|
+
};
|
|
3489
3324
|
const { direction: dir, angle } = options;
|
|
3490
|
-
const
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
},
|
|
3499
|
-
position: { x: 0, y: 0, z: 0 },
|
|
3500
|
-
scale: 0.01
|
|
3325
|
+
const rotationZ = dir === "up" ? 180 + angle : angle;
|
|
3326
|
+
var escalatorMarker = new maptalks4.GLTFMarker(coordinate, {
|
|
3327
|
+
symbol: {
|
|
3328
|
+
url: model.url,
|
|
3329
|
+
rotationZ,
|
|
3330
|
+
translationX: dir === "up" ? 0 : model.size * Math.cos(Math.PI * rotationZ / 180),
|
|
3331
|
+
translationY: dir === "up" ? 0 : model.size * Math.sin(Math.PI * rotationZ / 180),
|
|
3332
|
+
translationZ: dir === "up" ? -0.05 * model.size : -0.5 * model.size
|
|
3501
3333
|
}
|
|
3502
3334
|
});
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
const pivotPoint = dir === "up" ? new THREE2.Vector3(0, 0, 0) : new THREE2.Vector3(
|
|
3506
|
-
1 * (box.min.x + box.max.x),
|
|
3507
|
-
1 * (box.min.y + box.max.y),
|
|
3508
|
-
0.6 * box.max.z
|
|
3509
|
-
);
|
|
3510
|
-
const pivot = new THREE2.Group();
|
|
3511
|
-
pivot.add(model);
|
|
3512
|
-
model.position.sub(pivotPoint);
|
|
3513
|
-
model.updateMatrixWorld(true);
|
|
3514
|
-
const altitude = f.properties.ordinal * HEIGHT_METER;
|
|
3515
|
-
const baseObjectModel = this.threeLayer.toModel(pivot, {
|
|
3516
|
-
coordinate,
|
|
3517
|
-
altitude
|
|
3518
|
-
});
|
|
3519
|
-
this.threeLayer.addMesh(baseObjectModel);
|
|
3520
|
-
return baseObjectModel;
|
|
3335
|
+
escalatorMarker.addTo(this.gltfLayer);
|
|
3336
|
+
return escalatorMarker;
|
|
3521
3337
|
}
|
|
3522
3338
|
async createTree(coordinate, ordinal) {
|
|
3523
|
-
const
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
rotation: {
|
|
3527
|
-
x: 0.5 * Math.PI,
|
|
3528
|
-
// Rotate the model up (new_escalator.glb)
|
|
3529
|
-
y: 0,
|
|
3530
|
-
z: 0
|
|
3531
|
-
},
|
|
3532
|
-
position: { x: 0, y: 0, z: 0 },
|
|
3533
|
-
scale: 0.01
|
|
3339
|
+
const treeMarker = new maptalks4.GLTFMarker(coordinate, {
|
|
3340
|
+
symbol: {
|
|
3341
|
+
url: "https://dashboard.situm.com/uploads/3dmodels/demoaccount/new_escalator.glb"
|
|
3534
3342
|
}
|
|
3535
3343
|
});
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
this.threeLayer.addMesh(baseObjectModel);
|
|
3542
|
-
return baseObjectModel;
|
|
3344
|
+
treeMarker.addTo(this.gltfLayer);
|
|
3345
|
+
return treeMarker;
|
|
3346
|
+
}
|
|
3347
|
+
async createBuilding(coordinate, ordinal) {
|
|
3348
|
+
return Promise.resolve(null);
|
|
3543
3349
|
}
|
|
3544
3350
|
createElement(f) {
|
|
3545
3351
|
switch (f.feature_type) {
|
|
@@ -3562,34 +3368,34 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3562
3368
|
}
|
|
3563
3369
|
});
|
|
3564
3370
|
}
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
}
|
|
3371
|
+
createHighlightController(element) {
|
|
3372
|
+
if (!(element instanceof import_maptalks7.BaseObject)) {
|
|
3373
|
+
return null;
|
|
3374
|
+
}
|
|
3375
|
+
switch (element.type) {
|
|
3376
|
+
case "ExtrudePolygon": {
|
|
3377
|
+
const mesh = element.getObject3d();
|
|
3378
|
+
const originalMaterial = mesh.material;
|
|
3379
|
+
const highlightMaterial = this.getOrCreateMaterialByColor("#ff0000");
|
|
3380
|
+
return {
|
|
3381
|
+
start: () => {
|
|
3382
|
+
mesh.material = highlightMaterial;
|
|
3383
|
+
},
|
|
3384
|
+
clear: () => {
|
|
3385
|
+
mesh.material = originalMaterial;
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3388
|
+
}
|
|
3389
|
+
default: {
|
|
3390
|
+
return {
|
|
3391
|
+
start() {
|
|
3392
|
+
},
|
|
3393
|
+
clear() {
|
|
3394
|
+
}
|
|
3395
|
+
};
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3593
3399
|
render() {
|
|
3594
3400
|
this.threeLayer._needsUpdate = !this.threeLayer._needsUpdate;
|
|
3595
3401
|
if (this.threeLayer._needsUpdate) {
|
|
@@ -3697,7 +3503,10 @@ var Element2DRenderer = class extends EventTarget {
|
|
|
3697
3503
|
async createEscalator(f, coordinates) {
|
|
3698
3504
|
return Promise.resolve(null);
|
|
3699
3505
|
}
|
|
3700
|
-
async createTree(
|
|
3506
|
+
async createTree(coordinates) {
|
|
3507
|
+
return Promise.resolve(null);
|
|
3508
|
+
}
|
|
3509
|
+
async createBuilding(coordinate, ordinal) {
|
|
3701
3510
|
return Promise.resolve(null);
|
|
3702
3511
|
}
|
|
3703
3512
|
createElement = (imdfFeature) => {
|
|
@@ -3717,6 +3526,15 @@ var Element2DRenderer = class extends EventTarget {
|
|
|
3717
3526
|
element.hide();
|
|
3718
3527
|
});
|
|
3719
3528
|
}
|
|
3529
|
+
createHighlightController(element) {
|
|
3530
|
+
if (!(element instanceof maptalks5.Geometry)) return null;
|
|
3531
|
+
return {
|
|
3532
|
+
start() {
|
|
3533
|
+
},
|
|
3534
|
+
clear() {
|
|
3535
|
+
}
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3720
3538
|
};
|
|
3721
3539
|
|
|
3722
3540
|
// src/IndoorMap/renderer/2d/Marker2DRenderer.ts
|
|
@@ -3727,6 +3545,7 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3727
3545
|
markerLayer;
|
|
3728
3546
|
constructor(map) {
|
|
3729
3547
|
super();
|
|
3548
|
+
this.map = map;
|
|
3730
3549
|
}
|
|
3731
3550
|
createMarker = (coordinates, ordinal, content) => {
|
|
3732
3551
|
const marker = new maptalks6.ui.UIMarker(coordinates, {
|
|
@@ -3735,86 +3554,216 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3735
3554
|
collisionFadeIn: true,
|
|
3736
3555
|
altitude: 0
|
|
3737
3556
|
});
|
|
3738
|
-
marker.addTo(this.map);
|
|
3739
|
-
return marker;
|
|
3740
|
-
};
|
|
3741
|
-
removeMarker = (marker) => {
|
|
3742
|
-
marker.remove();
|
|
3743
|
-
};
|
|
3744
|
-
showMarkers(elements, ordinalDiff = 0) {
|
|
3557
|
+
marker.addTo(this.map);
|
|
3558
|
+
return marker;
|
|
3559
|
+
};
|
|
3560
|
+
removeMarker = (marker) => {
|
|
3561
|
+
marker.remove();
|
|
3562
|
+
};
|
|
3563
|
+
showMarkers(elements, ordinalDiff = 0) {
|
|
3564
|
+
}
|
|
3565
|
+
hideMarkers(elements, ordinalDiff = 0) {
|
|
3566
|
+
}
|
|
3567
|
+
};
|
|
3568
|
+
|
|
3569
|
+
// src/IndoorMap/renderer/3d/Marker3DRenderer.ts
|
|
3570
|
+
var maptalks7 = __toESM(require("maptalks-gl"));
|
|
3571
|
+
|
|
3572
|
+
// src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
|
|
3573
|
+
var import_maptalks8 = require("maptalks");
|
|
3574
|
+
var THREE2 = __toESM(require("three"));
|
|
3575
|
+
var import_maptalks9 = require("maptalks.three");
|
|
3576
|
+
var import_lodash6 = require("lodash");
|
|
3577
|
+
|
|
3578
|
+
// src/IndoorMap/renderer/utils/interpolateStops.ts
|
|
3579
|
+
var interpolateStops = ({ stops }, zoom) => {
|
|
3580
|
+
if (zoom <= stops[0][0]) return stops[0][1];
|
|
3581
|
+
if (zoom >= stops[stops.length - 1][0]) return stops[stops.length - 1][1];
|
|
3582
|
+
for (let i = 0; i < stops.length - 1; i++) {
|
|
3583
|
+
const [z1, v1] = stops[i];
|
|
3584
|
+
const [z2, v2] = stops[i + 1];
|
|
3585
|
+
if (zoom >= z1 && zoom <= z2) {
|
|
3586
|
+
const t = (zoom - z1) / (z2 - z1);
|
|
3587
|
+
return v1 + t * (v2 - v1);
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
};
|
|
3591
|
+
|
|
3592
|
+
// src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
|
|
3593
|
+
var OPTIONS4 = {
|
|
3594
|
+
// Texture options
|
|
3595
|
+
text: "",
|
|
3596
|
+
textAlign: "center",
|
|
3597
|
+
color: "#ffffff",
|
|
3598
|
+
fontFamily: "sans-serif",
|
|
3599
|
+
fontSize: 28,
|
|
3600
|
+
fontWeight: 400,
|
|
3601
|
+
background: "transparent",
|
|
3602
|
+
lineHeight: 32,
|
|
3603
|
+
padding: 8,
|
|
3604
|
+
strokeColor: "#000000",
|
|
3605
|
+
strokeWidth: 3,
|
|
3606
|
+
strokeStyle: "round",
|
|
3607
|
+
// Sprite options
|
|
3608
|
+
/* Overall scale multiplier */
|
|
3609
|
+
scale: 1,
|
|
3610
|
+
altitude: 0,
|
|
3611
|
+
opacity: 1
|
|
3612
|
+
};
|
|
3613
|
+
var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
3614
|
+
#altitudeOffset = 0;
|
|
3615
|
+
constructor(coordinate, options, layer, properties = {}) {
|
|
3616
|
+
options = import_maptalks8.Util.extend({}, OPTIONS4, options, { layer });
|
|
3617
|
+
super();
|
|
3618
|
+
this._coordinate = new import_maptalks8.Coordinate(coordinate);
|
|
3619
|
+
this._initOptions(options);
|
|
3620
|
+
this._createGroup();
|
|
3621
|
+
this.properties = { ...properties };
|
|
3622
|
+
const sprite = this._createSprite();
|
|
3623
|
+
this.getObject3d().add(sprite);
|
|
3624
|
+
this._updatePosition();
|
|
3625
|
+
this.type = "TextSpriteMarker";
|
|
3626
|
+
}
|
|
3627
|
+
getOptions() {
|
|
3628
|
+
return super.getOptions();
|
|
3629
|
+
}
|
|
3630
|
+
_createSprite() {
|
|
3631
|
+
const options = this.getOptions();
|
|
3632
|
+
const texture = this._createTextTexture(options.text, options);
|
|
3633
|
+
const material = new THREE2.SpriteMaterial({
|
|
3634
|
+
map: texture,
|
|
3635
|
+
transparent: true,
|
|
3636
|
+
alphaTest: 0.1
|
|
3637
|
+
});
|
|
3638
|
+
const sprite = new THREE2.Sprite(material);
|
|
3639
|
+
const w = texture.image.width;
|
|
3640
|
+
const h = texture.image.height;
|
|
3641
|
+
const base = 1 / 16;
|
|
3642
|
+
const normalizedScale = options.scale / this.getMap().getGLRes();
|
|
3643
|
+
sprite.scale.set(w * base * normalizedScale, h * base * normalizedScale, 1);
|
|
3644
|
+
this.#altitudeOffset = Math.max(
|
|
3645
|
+
h * base * options.scale * 0.5,
|
|
3646
|
+
0.05
|
|
3647
|
+
// minimum lift in world units
|
|
3648
|
+
);
|
|
3649
|
+
return sprite;
|
|
3650
|
+
}
|
|
3651
|
+
_createTextTexture(text, options = {}) {
|
|
3652
|
+
const {
|
|
3653
|
+
padding,
|
|
3654
|
+
fontSize,
|
|
3655
|
+
fontFamily,
|
|
3656
|
+
fontWeight,
|
|
3657
|
+
lineHeight,
|
|
3658
|
+
background,
|
|
3659
|
+
color,
|
|
3660
|
+
textAlign,
|
|
3661
|
+
strokeColor,
|
|
3662
|
+
strokeWidth,
|
|
3663
|
+
maxWidth
|
|
3664
|
+
} = options || {};
|
|
3665
|
+
const canvas = document.createElement("canvas");
|
|
3666
|
+
const ctx = canvas.getContext("2d");
|
|
3667
|
+
ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
3668
|
+
const paragraphs = String(text).split("\n");
|
|
3669
|
+
const wrappedLines = [];
|
|
3670
|
+
paragraphs.forEach((paragraph) => {
|
|
3671
|
+
if ((0, import_lodash6.isNil)(maxWidth) || isNaN(maxWidth)) {
|
|
3672
|
+
wrappedLines.push(paragraph);
|
|
3673
|
+
return;
|
|
3674
|
+
}
|
|
3675
|
+
const words = paragraph.split(/\s+/);
|
|
3676
|
+
let currentLine = "";
|
|
3677
|
+
words.forEach((word) => {
|
|
3678
|
+
const testLine = currentLine ? currentLine + " " + word : word;
|
|
3679
|
+
const testWidth = ctx.measureText(testLine).width;
|
|
3680
|
+
if (testWidth > maxWidth && currentLine) {
|
|
3681
|
+
wrappedLines.push(currentLine);
|
|
3682
|
+
currentLine = word;
|
|
3683
|
+
} else {
|
|
3684
|
+
currentLine = testLine;
|
|
3685
|
+
}
|
|
3686
|
+
});
|
|
3687
|
+
if (currentLine) {
|
|
3688
|
+
wrappedLines.push(currentLine);
|
|
3689
|
+
}
|
|
3690
|
+
});
|
|
3691
|
+
const lines = wrappedLines.length ? wrappedLines : [""];
|
|
3692
|
+
const widest = Math.max(...lines.map((l) => ctx.measureText(l).width), 0);
|
|
3693
|
+
const finalWidth = (maxWidth ? Math.min(widest, maxWidth) : widest) + padding * 2;
|
|
3694
|
+
const finalHeight = lineHeight * lines.length + padding * 2;
|
|
3695
|
+
canvas.width = finalWidth;
|
|
3696
|
+
canvas.height = finalHeight;
|
|
3697
|
+
const ctx2 = canvas.getContext("2d");
|
|
3698
|
+
ctx2.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
3699
|
+
ctx2.textAlign = textAlign;
|
|
3700
|
+
if (background && background !== "transparent") {
|
|
3701
|
+
ctx2.fillStyle = background;
|
|
3702
|
+
ctx2.fillRect(0, 0, canvas.width, canvas.height);
|
|
3703
|
+
}
|
|
3704
|
+
lines.forEach((line, i) => {
|
|
3705
|
+
const y = padding + lineHeight * (i + 0.8);
|
|
3706
|
+
let x = padding;
|
|
3707
|
+
if (textAlign === "center") x = canvas.width / 2;
|
|
3708
|
+
if (textAlign === "right" || textAlign === "end")
|
|
3709
|
+
x = canvas.width - padding;
|
|
3710
|
+
if (strokeWidth > 0) {
|
|
3711
|
+
ctx2.lineWidth = strokeWidth;
|
|
3712
|
+
ctx2.lineJoin = "round";
|
|
3713
|
+
ctx2.miterLimit = 2;
|
|
3714
|
+
ctx2.strokeStyle = strokeColor;
|
|
3715
|
+
ctx2.strokeText(line, x, y);
|
|
3716
|
+
}
|
|
3717
|
+
ctx2.fillStyle = color;
|
|
3718
|
+
ctx2.fillText(line, x, y);
|
|
3719
|
+
});
|
|
3720
|
+
const texture = new THREE2.CanvasTexture(canvas);
|
|
3721
|
+
texture.needsUpdate = true;
|
|
3722
|
+
texture.minFilter = THREE2.LinearFilter;
|
|
3723
|
+
return texture;
|
|
3745
3724
|
}
|
|
3746
|
-
|
|
3725
|
+
_updatePosition() {
|
|
3726
|
+
const options = this.getOptions();
|
|
3727
|
+
const layer = options.layer;
|
|
3728
|
+
if (!layer) return;
|
|
3729
|
+
const altitude = (options.altitude || 0) + this.#altitudeOffset;
|
|
3730
|
+
const z = layer.altitudeToVector3(altitude, altitude).x;
|
|
3731
|
+
const position = layer.coordinateToVector3(this._coordinate, z);
|
|
3732
|
+
(0, import_lodash6.set)(this.properties, "default.position", position);
|
|
3733
|
+
this.getObject3d().position.copy(position);
|
|
3747
3734
|
}
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
const
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
const ctx = canvas.getContext("2d");
|
|
3767
|
-
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
|
3768
|
-
const pngDataUrl = canvas.toDataURL("image/png");
|
|
3769
|
-
resolve(pngDataUrl);
|
|
3770
|
-
};
|
|
3771
|
-
img.onerror = function(error) {
|
|
3772
|
-
reject(error);
|
|
3773
|
-
};
|
|
3774
|
-
img.src = url;
|
|
3775
|
-
});
|
|
3776
|
-
};
|
|
3777
|
-
var createSVGPathFromMarkerSymbol2 = (style) => {
|
|
3778
|
-
const {
|
|
3779
|
-
markerWidth = 24,
|
|
3780
|
-
markerDx = 0,
|
|
3781
|
-
markerDy = 0,
|
|
3782
|
-
// markerFill,
|
|
3783
|
-
markerPath,
|
|
3784
|
-
fill = "#000000"
|
|
3785
|
-
} = style;
|
|
3786
|
-
const scale2 = markerWidth / 24;
|
|
3787
|
-
const strokeWidth = 2;
|
|
3788
|
-
const halfStrokeWidth = 0.5 * strokeWidth;
|
|
3789
|
-
if (Array.isArray(markerPath)) {
|
|
3790
|
-
return markerPath.map(
|
|
3791
|
-
({ path, fill: fill2 }) => `<path d="${path}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${fill2}" stroke="#ffffff" stroke-width="${strokeWidth}" />`
|
|
3792
|
-
);
|
|
3735
|
+
_animation() {
|
|
3736
|
+
const layer = this.getLayer();
|
|
3737
|
+
if (!this.isAdd || !layer) return;
|
|
3738
|
+
if (this._visible === true) {
|
|
3739
|
+
const zoom = layer.map.getZoom();
|
|
3740
|
+
const object3d = this.getObject3d();
|
|
3741
|
+
const { opacity } = this.getOptions();
|
|
3742
|
+
let opacityValue;
|
|
3743
|
+
if (typeof opacity === "number") {
|
|
3744
|
+
opacityValue = opacity ?? 1;
|
|
3745
|
+
} else if (Array.isArray(opacity.stops)) {
|
|
3746
|
+
opacityValue = interpolateStops(opacity, zoom);
|
|
3747
|
+
} else {
|
|
3748
|
+
throw new Error(`Unknown opacity value ${opacity}`);
|
|
3749
|
+
}
|
|
3750
|
+
const visible = opacityValue > 0.5;
|
|
3751
|
+
object3d.visible = visible;
|
|
3752
|
+
}
|
|
3793
3753
|
}
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
const
|
|
3805
|
-
|
|
3806
|
-
const textureLoader = new import_three7.TextureLoader();
|
|
3807
|
-
const scaleFactor = 200 / 24;
|
|
3808
|
-
svgToDataURL(svg, scaleFactor).then((png) => {
|
|
3809
|
-
const texture = textureLoader.load(png, () => {
|
|
3810
|
-
material.map = texture;
|
|
3811
|
-
material.needsUpdate = true;
|
|
3812
|
-
});
|
|
3813
|
-
});
|
|
3814
|
-
} catch (error) {
|
|
3815
|
-
console.warn(`Error createSpriteMaterialByLabelSymbol: `, labelSymbol);
|
|
3754
|
+
setText(text) {
|
|
3755
|
+
const options = this.getOptions();
|
|
3756
|
+
options.text = text;
|
|
3757
|
+
const newSprite = this._createSprite();
|
|
3758
|
+
const group = this.getObject3d();
|
|
3759
|
+
group.children.forEach((child) => group.remove(child));
|
|
3760
|
+
group.add(newSprite);
|
|
3761
|
+
this._updatePosition();
|
|
3762
|
+
}
|
|
3763
|
+
setAltitude(altitude) {
|
|
3764
|
+
const bottomHeight = this.options.bottomHeight ?? 0;
|
|
3765
|
+
return super.setAltitude(altitude + bottomHeight + this.#altitudeOffset);
|
|
3816
3766
|
}
|
|
3817
|
-
return material;
|
|
3818
3767
|
};
|
|
3819
3768
|
|
|
3820
3769
|
// src/IndoorMap/renderer/3d/Marker3DRenderer.ts
|
|
@@ -3865,40 +3814,41 @@ var Marker3DRenderer = class extends EventTarget {
|
|
|
3865
3814
|
});
|
|
3866
3815
|
}
|
|
3867
3816
|
/** Marker */
|
|
3868
|
-
getOrCreateIconMaterial(key) {
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3817
|
+
// getOrCreateIconMaterial(key) {
|
|
3818
|
+
// if (!this.materialByKey) this.materialByKey = new Map()
|
|
3819
|
+
// const existingMaterial = this.materialByKey.get(key)
|
|
3820
|
+
// if (existingMaterial) return existingMaterial
|
|
3821
|
+
// // Create new
|
|
3822
|
+
// const baseSymbol: maptalks.Path = {
|
|
3823
|
+
// markerType: "path",
|
|
3824
|
+
// markerPath: [
|
|
3825
|
+
// {
|
|
3826
|
+
// path: "M20.775 1.2H1.225V20.35H8.215L11.3 22.8L14.385 20.35H20.775V1.2Z",
|
|
3827
|
+
// fill: "#ff0000",
|
|
3828
|
+
// },
|
|
3829
|
+
// ],
|
|
3830
|
+
// markerPathWidth: 24,
|
|
3831
|
+
// markerPathHeight: 24
|
|
3832
|
+
// }
|
|
3833
|
+
// const markerSymbol: maptalks.PathMarkerSymbol = {
|
|
3834
|
+
// markerType: "path",
|
|
3835
|
+
// markerPath: [],
|
|
3836
|
+
// // TODO: Get Path by featureType.category
|
|
3837
|
+
// // 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" }],
|
|
3838
|
+
// markerPathWidth: 24,
|
|
3839
|
+
// markerPathHeight: 24,
|
|
3840
|
+
// markerWidth: 24,
|
|
3841
|
+
// markerHeight: 24,
|
|
3842
|
+
// markerDy: 1.5,
|
|
3843
|
+
// markerDx: 1.5,
|
|
3844
|
+
// }
|
|
3845
|
+
// const created = createSpriteMaterialByLabelSymbol([
|
|
3846
|
+
// baseSymbol,
|
|
3847
|
+
// markerSymbol,
|
|
3848
|
+
// ])
|
|
3849
|
+
// this.materialByKey.set(key, created)
|
|
3850
|
+
// return created
|
|
3851
|
+
// }
|
|
3902
3852
|
};
|
|
3903
3853
|
|
|
3904
3854
|
// src/IndoorMap/renderer/utils/angleBetweenLineString.ts
|
|
@@ -3920,11 +3870,17 @@ var angleBetweenLineStrings = (line1, line2) => {
|
|
|
3920
3870
|
};
|
|
3921
3871
|
|
|
3922
3872
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
3873
|
+
function delay(ms) {
|
|
3874
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3875
|
+
}
|
|
3923
3876
|
var RendererManager = class extends EventTarget {
|
|
3924
3877
|
map;
|
|
3925
3878
|
options;
|
|
3926
3879
|
// Client for fetching data
|
|
3927
3880
|
#dataClient;
|
|
3881
|
+
#isClicked = false;
|
|
3882
|
+
#onClickElement = (e) => {
|
|
3883
|
+
};
|
|
3928
3884
|
/** Elements: Responsible for converting feature info elements and add to map */
|
|
3929
3885
|
elementRenderer;
|
|
3930
3886
|
markerRenderer;
|
|
@@ -3933,6 +3889,7 @@ var RendererManager = class extends EventTarget {
|
|
|
3933
3889
|
currentOrdinals;
|
|
3934
3890
|
markersMap;
|
|
3935
3891
|
markersByOrdinal;
|
|
3892
|
+
highlightControllers = [];
|
|
3936
3893
|
constructor(map, dataClient, options) {
|
|
3937
3894
|
super();
|
|
3938
3895
|
this.map = map;
|
|
@@ -3942,48 +3899,52 @@ var RendererManager = class extends EventTarget {
|
|
|
3942
3899
|
this.markersMap = /* @__PURE__ */ new Map();
|
|
3943
3900
|
this.markersByOrdinal = /* @__PURE__ */ new Map();
|
|
3944
3901
|
this.#dataClient = dataClient;
|
|
3902
|
+
const _this = this;
|
|
3945
3903
|
if (options.type === "3D") {
|
|
3946
|
-
const
|
|
3947
|
-
|
|
3948
|
-
forceRenderOnRotating: true
|
|
3949
|
-
});
|
|
3950
|
-
const _this = this;
|
|
3904
|
+
const groupLayer = this.map.getLayer("group");
|
|
3905
|
+
const threeLayer = groupLayer.getLayer("three");
|
|
3951
3906
|
threeLayer.prepareToDraw = function(gl, scene, camera) {
|
|
3952
3907
|
const ambientLight = new THREE3.AmbientLight(16777215, 0.3);
|
|
3953
3908
|
scene.add(ambientLight);
|
|
3954
3909
|
const dirColor = 16777215;
|
|
3955
3910
|
const dllight = new THREE3.DirectionalLight(dirColor, 0.8);
|
|
3956
|
-
dllight.position.set(0, -10,
|
|
3911
|
+
dllight.position.set(0, -10, 20).normalize();
|
|
3957
3912
|
scene.add(dllight);
|
|
3958
3913
|
const hemi = new THREE3.HemisphereLight(16777215, 4473924, 0.4);
|
|
3959
3914
|
scene.add(hemi);
|
|
3960
|
-
_this.elementRenderer = new Element3DRenderer(map, options.elements
|
|
3915
|
+
_this.elementRenderer = new Element3DRenderer(map, options.elements);
|
|
3961
3916
|
_this.markerRenderer = new Marker3DRenderer(map, {}, threeLayer);
|
|
3962
3917
|
if (typeof options.onRendererReady === "function") {
|
|
3963
3918
|
options.onRendererReady();
|
|
3964
3919
|
}
|
|
3965
3920
|
_this.#createElements();
|
|
3966
3921
|
};
|
|
3967
|
-
threeLayer.addTo(this.map);
|
|
3968
3922
|
} else {
|
|
3969
3923
|
this.elementRenderer = new Element2DRenderer(map, options.elements);
|
|
3970
3924
|
this.markerRenderer = new Marker2DRenderer(map);
|
|
3971
3925
|
this.#createElements();
|
|
3972
3926
|
}
|
|
3973
3927
|
}
|
|
3928
|
+
set onClickElement(func) {
|
|
3929
|
+
this.#onClickElement = func;
|
|
3930
|
+
}
|
|
3931
|
+
handleClickElement = (e) => {
|
|
3932
|
+
if (this.#isClicked) return;
|
|
3933
|
+
this.#isClicked = true;
|
|
3934
|
+
const onClickElement = this.#onClickElement;
|
|
3935
|
+
if (!(0, import_isFunction.default)(onClickElement)) return;
|
|
3936
|
+
this.#onClickElement(e);
|
|
3937
|
+
this.#isClicked = false;
|
|
3938
|
+
};
|
|
3974
3939
|
getElementsByOrdinal = (ordinal) => {
|
|
3975
3940
|
const exist = this.elementsByOrdinal.get(ordinal);
|
|
3976
3941
|
if (!exist) this.elementsByOrdinal.set(ordinal, []);
|
|
3977
3942
|
return this.elementsByOrdinal.get(ordinal);
|
|
3978
3943
|
};
|
|
3979
|
-
getMarkersByOrdinal = (ordinal) => {
|
|
3980
|
-
const exist = this.markersByOrdinal.get(ordinal);
|
|
3981
|
-
if (!exist) this.markersByOrdinal.set(ordinal, []);
|
|
3982
|
-
return this.markersByOrdinal.get(ordinal);
|
|
3983
|
-
};
|
|
3984
3944
|
addElementsToManager = (id, elements, ordinal) => {
|
|
3985
3945
|
this.elementsMap.set(id, elements);
|
|
3986
3946
|
elements.forEach((el) => {
|
|
3947
|
+
el.on("click", (e) => this.handleClickElement(id));
|
|
3987
3948
|
this.getElementsByOrdinal(ordinal).push(el);
|
|
3988
3949
|
});
|
|
3989
3950
|
const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
|
|
@@ -3993,19 +3954,8 @@ var RendererManager = class extends EventTarget {
|
|
|
3993
3954
|
this.elementRenderer.hideElements(elements, ordinal);
|
|
3994
3955
|
}
|
|
3995
3956
|
};
|
|
3996
|
-
addMarkersToManager = (id, markers, ordinal) => {
|
|
3997
|
-
this.markersMap.set(id, markers);
|
|
3998
|
-
markers.forEach((el) => {
|
|
3999
|
-
this.getMarkersByOrdinal(ordinal).push(el);
|
|
4000
|
-
});
|
|
4001
|
-
const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
|
|
4002
|
-
if (inOrdinal) {
|
|
4003
|
-
this.markerRenderer.showMarkers(markers, ordinal);
|
|
4004
|
-
} else {
|
|
4005
|
-
this.markerRenderer.hideMarkers(markers, ordinal);
|
|
4006
|
-
}
|
|
4007
|
-
};
|
|
4008
3957
|
async #createElements() {
|
|
3958
|
+
await delay(this.options.delayBeforeCreateElements ?? 0);
|
|
4009
3959
|
const levels = await this.#dataClient.filterByType("level", {
|
|
4010
3960
|
populate: true
|
|
4011
3961
|
});
|
|
@@ -4052,13 +4002,15 @@ var RendererManager = class extends EventTarget {
|
|
|
4052
4002
|
}
|
|
4053
4003
|
const thisOrdinal = escalator.properties.ordinal;
|
|
4054
4004
|
const relationship = escalatorRelationships[0];
|
|
4005
|
+
if (!relationship.properties.origin?.id) throw new Error(`relationship (id=${relationship.id}) - origin not exists`);
|
|
4006
|
+
if (!relationship.properties.destination?.id) throw new Error(`relationship (id=${relationship.id}) - destination not exists`);
|
|
4055
4007
|
const bothOpeningIds = [relationship.properties.origin.id, relationship.properties.destination.id];
|
|
4056
4008
|
const bothOpenings = await Promise.all(
|
|
4057
4009
|
bothOpeningIds.map((id) => this.#dataClient.findById("opening", id, { populate: true }))
|
|
4058
4010
|
);
|
|
4059
4011
|
const thisLevelOpening = bothOpenings.find((opening) => opening.properties.ordinal === thisOrdinal);
|
|
4060
4012
|
const thatLevelOpening = bothOpenings.find((opening) => opening.properties.ordinal !== thisOrdinal);
|
|
4061
|
-
const angle = angleBetweenLineStrings(thisLevelOpening.geometry.coordinates, thatLevelOpening.geometry.coordinates);
|
|
4013
|
+
const angle = 180 * (1 / Math.PI) * angleBetweenLineStrings(thisLevelOpening.geometry.coordinates, thatLevelOpening.geometry.coordinates);
|
|
4062
4014
|
const direction = thisOrdinal < thatLevelOpening.properties.ordinal ? "up" : "down";
|
|
4063
4015
|
const escalatorEntryPoint = (0, import_center3.center)(thisLevelOpening).geometry.coordinates;
|
|
4064
4016
|
const element = await this.elementRenderer.createEscalator(escalator, escalatorEntryPoint, { direction, angle });
|
|
@@ -4067,7 +4019,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4067
4019
|
this.addElementsToManager(escalator.id, _elements, escalator.properties.ordinal);
|
|
4068
4020
|
}
|
|
4069
4021
|
} catch (err) {
|
|
4070
|
-
console.
|
|
4022
|
+
console.warn(`cannot create escalator`, err.message);
|
|
4071
4023
|
}
|
|
4072
4024
|
}
|
|
4073
4025
|
this.changeLevelByOrdinal(this.currentOrdinals);
|
|
@@ -4103,14 +4055,48 @@ var RendererManager = class extends EventTarget {
|
|
|
4103
4055
|
}
|
|
4104
4056
|
}
|
|
4105
4057
|
}
|
|
4058
|
+
highlightElements = (elemIds, options) => {
|
|
4059
|
+
const { reset = true } = options ?? {};
|
|
4060
|
+
if (reset) {
|
|
4061
|
+
this.clearHighlightElements();
|
|
4062
|
+
}
|
|
4063
|
+
const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
|
|
4064
|
+
elements.forEach((element) => {
|
|
4065
|
+
const controller = this.elementRenderer.createHighlightController(element);
|
|
4066
|
+
controller.start();
|
|
4067
|
+
this.highlightControllers.push(controller);
|
|
4068
|
+
});
|
|
4069
|
+
};
|
|
4070
|
+
clearHighlightElements = () => {
|
|
4071
|
+
this.highlightControllers.forEach((controller) => {
|
|
4072
|
+
if ((0, import_isFunction.default)(controller?.clear)) controller.clear();
|
|
4073
|
+
});
|
|
4074
|
+
};
|
|
4106
4075
|
/**
|
|
4107
4076
|
* ========================================================================
|
|
4108
4077
|
* Markers
|
|
4109
4078
|
* ======================================================================== */
|
|
4079
|
+
_getMarkersByOrdinal = (ordinal) => {
|
|
4080
|
+
const exist = this.markersByOrdinal.get(ordinal);
|
|
4081
|
+
if (!exist) this.markersByOrdinal.set(ordinal, []);
|
|
4082
|
+
return this.markersByOrdinal.get(ordinal);
|
|
4083
|
+
};
|
|
4084
|
+
_addMarkersToManager = (id, markers, ordinal) => {
|
|
4085
|
+
this.markersMap.set(id, markers);
|
|
4086
|
+
markers.forEach((el) => {
|
|
4087
|
+
this._getMarkersByOrdinal(ordinal).push(el);
|
|
4088
|
+
});
|
|
4089
|
+
const inOrdinal = Array.isArray(this.currentOrdinals) ? this.currentOrdinals.includes(ordinal) : ordinal === this.currentOrdinals;
|
|
4090
|
+
if (inOrdinal) {
|
|
4091
|
+
this.markerRenderer.showMarkers(markers, ordinal);
|
|
4092
|
+
} else {
|
|
4093
|
+
this.markerRenderer.hideMarkers(markers, ordinal);
|
|
4094
|
+
}
|
|
4095
|
+
};
|
|
4110
4096
|
createMarker(coordinate, ordinal, text, options) {
|
|
4111
4097
|
const marker = this.markerRenderer.createMarker(coordinate, ordinal, text, options);
|
|
4112
4098
|
const markerId = `${this.markersMap.size + 1}`;
|
|
4113
|
-
this.
|
|
4099
|
+
this._addMarkersToManager(markerId, [marker], ordinal);
|
|
4114
4100
|
}
|
|
4115
4101
|
clearMarkers() {
|
|
4116
4102
|
for (const [markerId, marker] of this.markersMap) {
|
|
@@ -4128,6 +4114,7 @@ var defaultOptions = {
|
|
|
4128
4114
|
locale: DEFAULT_LOCALE
|
|
4129
4115
|
};
|
|
4130
4116
|
var IndoorMap = class extends EventTarget {
|
|
4117
|
+
options;
|
|
4131
4118
|
//TODO: refac functions; let them do only 1 thing in a function
|
|
4132
4119
|
/** Note: "#" means private variables */
|
|
4133
4120
|
#styler = null;
|
|
@@ -4179,14 +4166,18 @@ var IndoorMap = class extends EventTarget {
|
|
|
4179
4166
|
};
|
|
4180
4167
|
constructor(elementId, options) {
|
|
4181
4168
|
super();
|
|
4169
|
+
const combinedOptions = import_lodash7.default.merge({}, defaultOptions, options);
|
|
4170
|
+
this.options = options;
|
|
4182
4171
|
const {
|
|
4183
4172
|
onMapReady,
|
|
4184
4173
|
onMapLoading,
|
|
4185
4174
|
pixelRatio,
|
|
4186
4175
|
locale
|
|
4187
|
-
} =
|
|
4176
|
+
} = combinedOptions;
|
|
4188
4177
|
this.map = new import_maptalks_gl.Map(elementId, {
|
|
4189
4178
|
attribution: false,
|
|
4179
|
+
// Temporart set, not really default view
|
|
4180
|
+
// Default view is set in camera manager
|
|
4190
4181
|
center: INITIAL_CENTER,
|
|
4191
4182
|
zoom: INITIAL_ZOOM,
|
|
4192
4183
|
clickTimeThreshold: 600,
|
|
@@ -4202,8 +4193,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
4202
4193
|
}),
|
|
4203
4194
|
layers: []
|
|
4204
4195
|
});
|
|
4196
|
+
const groupLayer = new import_maptalks_gl.GroupGLLayer("group", [], {}).addTo(this.map);
|
|
4197
|
+
const threeLayer = new import_maptalks10.ThreeLayer("three", {
|
|
4198
|
+
forceRenderOnMoving: true,
|
|
4199
|
+
forceRenderOnRotating: true
|
|
4200
|
+
});
|
|
4201
|
+
groupLayer.addLayer(threeLayer);
|
|
4202
|
+
const gltfLayer = new import_maptalks_gl.GLTFLayer("gltf");
|
|
4203
|
+
groupLayer.addLayer(gltfLayer);
|
|
4205
4204
|
this.rendererManager = new RendererManager(this.map, options.dataClient, options.renderer);
|
|
4206
|
-
this.camera = new CameraManager(this.map);
|
|
4205
|
+
this.camera = new CameraManager(this.map, options.camera);
|
|
4207
4206
|
this.locale = locale;
|
|
4208
4207
|
this.pixelRatio = pixelRatio;
|
|
4209
4208
|
this.onMapReady = onMapReady;
|
|
@@ -4214,19 +4213,21 @@ var IndoorMap = class extends EventTarget {
|
|
|
4214
4213
|
}
|
|
4215
4214
|
set dataClient(value) {
|
|
4216
4215
|
this.#dataClient = value;
|
|
4217
|
-
this
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
this.map.on(eventName, handler);
|
|
4216
|
+
if (!this.options.camera?.defaultView?.center) {
|
|
4217
|
+
this.#dataClient.filterByType("venue").then((venues) => {
|
|
4218
|
+
const venueCenters = (0, import_center4.default)(featureCollection(venues));
|
|
4219
|
+
const [x, y] = venueCenters.geometry.coordinates;
|
|
4220
|
+
const center2 = new import_maptalks_gl.Coordinate(x, y);
|
|
4221
|
+
this.camera.setView({ center: center2, pitch: 60, zoom: 19 });
|
|
4222
|
+
});
|
|
4223
|
+
}
|
|
4226
4224
|
}
|
|
4227
4225
|
/**
|
|
4228
4226
|
* Events
|
|
4229
4227
|
*/
|
|
4228
|
+
on(eventName, handler) {
|
|
4229
|
+
this.map.on(eventName, handler);
|
|
4230
|
+
}
|
|
4230
4231
|
handleMapClick = ({ coordinate }) => {
|
|
4231
4232
|
const { x, y } = coordinate;
|
|
4232
4233
|
console.log(
|
|
@@ -4282,40 +4283,12 @@ var IndoorMap = class extends EventTarget {
|
|
|
4282
4283
|
this.map.off("moveend", this.#findAndSetVenueInView);
|
|
4283
4284
|
}
|
|
4284
4285
|
}
|
|
4285
|
-
get ordinals() {
|
|
4286
|
-
return this.#ordinals || [];
|
|
4287
|
-
}
|
|
4288
|
-
set ordinals(value) {
|
|
4289
|
-
if (!Array.isArray(value)) throw new Error("ordinals must be Array");
|
|
4290
|
-
this.#ordinals = value;
|
|
4291
|
-
}
|
|
4292
4286
|
set billboards(value) {
|
|
4293
4287
|
this.#billboards = value;
|
|
4294
4288
|
}
|
|
4295
|
-
set mapConfig(value) {
|
|
4296
|
-
this.#mapConfig = value;
|
|
4297
|
-
}
|
|
4298
4289
|
set mapDecorations(value) {
|
|
4299
4290
|
this.#mapDecorations = value;
|
|
4300
4291
|
}
|
|
4301
|
-
set maxZoom(value) {
|
|
4302
|
-
this.map.setMaxZoom(value);
|
|
4303
|
-
const spatialReference = {
|
|
4304
|
-
projection: "EPSG:3857",
|
|
4305
|
-
resolutions: (function() {
|
|
4306
|
-
const resolutions = [];
|
|
4307
|
-
const d = 2 * 6378137 * Math.PI;
|
|
4308
|
-
for (let i = 0; i < value; i++) {
|
|
4309
|
-
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
4310
|
-
}
|
|
4311
|
-
return resolutions;
|
|
4312
|
-
})()
|
|
4313
|
-
};
|
|
4314
|
-
this.map.setSpatialReference(spatialReference);
|
|
4315
|
-
}
|
|
4316
|
-
set minZoom(value) {
|
|
4317
|
-
this.map.setMinZoom(value);
|
|
4318
|
-
}
|
|
4319
4292
|
set groundLabels(value) {
|
|
4320
4293
|
this.#groundLabels = value;
|
|
4321
4294
|
}
|
|
@@ -4323,7 +4296,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4323
4296
|
this.map.setDevicePixelRatio(value);
|
|
4324
4297
|
}
|
|
4325
4298
|
set onClickElement(func) {
|
|
4326
|
-
this
|
|
4299
|
+
this.rendererManager.onClickElement = func;
|
|
4327
4300
|
}
|
|
4328
4301
|
set locale(value) {
|
|
4329
4302
|
this.#locale = value || defaultOptions.locale;
|
|
@@ -4339,7 +4312,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4339
4312
|
const scene = this.threeLayer.getScene();
|
|
4340
4313
|
if (scene) {
|
|
4341
4314
|
scene.children = scene.children.filter(
|
|
4342
|
-
(children) => children instanceof
|
|
4315
|
+
(children) => children instanceof import_three7.PerspectiveCamera
|
|
4343
4316
|
);
|
|
4344
4317
|
}
|
|
4345
4318
|
}
|
|
@@ -4351,9 +4324,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4351
4324
|
this.#onClickElement(e);
|
|
4352
4325
|
this.#isClicked = false;
|
|
4353
4326
|
};
|
|
4354
|
-
setCenter(center2, padding) {
|
|
4355
|
-
this.map.setCenter(center2, padding);
|
|
4356
|
-
}
|
|
4357
4327
|
async #legacy_createElements() {
|
|
4358
4328
|
const {
|
|
4359
4329
|
// 2D
|
|
@@ -4367,33 +4337,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4367
4337
|
create3DFootprint,
|
|
4368
4338
|
create3DGroundLabel,
|
|
4369
4339
|
create3DBillboard,
|
|
4370
|
-
createVenue3DModel,
|
|
4371
4340
|
createExtrudedUnit,
|
|
4372
|
-
create3DFixture,
|
|
4373
4341
|
create3DAmenityMarker,
|
|
4374
4342
|
create3DOccupantAmenityMarker,
|
|
4375
4343
|
create3DOpeningMarker,
|
|
4376
|
-
createOccupantGroundLabel
|
|
4377
|
-
// Light
|
|
4378
|
-
createAmbientLight,
|
|
4379
|
-
createDirectionalLight
|
|
4344
|
+
createOccupantGroundLabel
|
|
4380
4345
|
} = this.#styler;
|
|
4381
4346
|
let elements = {};
|
|
4382
4347
|
let object3ds = [];
|
|
4383
|
-
const scene = this.threeLayer.getScene();
|
|
4384
|
-
if (scene) {
|
|
4385
|
-
const {
|
|
4386
|
-
ambientLight: ambientLightConfig = {},
|
|
4387
|
-
directionalLight: directionalLightConfig = {}
|
|
4388
|
-
} = import_lodash7.default.get(this.#mapConfig, "light", {
|
|
4389
|
-
ambientLight: {},
|
|
4390
|
-
directionalLight: {}
|
|
4391
|
-
});
|
|
4392
|
-
const ambientLight = createAmbientLight(ambientLightConfig);
|
|
4393
|
-
scene.add(ambientLight);
|
|
4394
|
-
const light = createDirectionalLight(directionalLightConfig);
|
|
4395
|
-
scene.add(light);
|
|
4396
|
-
}
|
|
4397
4348
|
for (const feature2 of this.#features) {
|
|
4398
4349
|
try {
|
|
4399
4350
|
const { feature_type: featureType, properties, id } = feature2;
|
|
@@ -4416,16 +4367,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4416
4367
|
feature2
|
|
4417
4368
|
);
|
|
4418
4369
|
switch (featureType) {
|
|
4419
|
-
case "venue": {
|
|
4420
|
-
geometry = createVenue(feature2).addTo(layer);
|
|
4421
|
-
const models = await createVenue3DModel(feature2, this.threeLayer);
|
|
4422
|
-
models.forEach((model) => {
|
|
4423
|
-
model.on("click", this.handleClickElement);
|
|
4424
|
-
object3ds.push(model);
|
|
4425
|
-
this.#venueObjects.push(model);
|
|
4426
|
-
});
|
|
4427
|
-
break;
|
|
4428
|
-
}
|
|
4429
4370
|
case "amenity": {
|
|
4430
4371
|
if (feature2.properties.is_featured) {
|
|
4431
4372
|
const billboardObj = create3DBillboard(feature2, this.threeLayer);
|
|
@@ -4469,127 +4410,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4469
4410
|
geometry = createSection(feature2)?.addTo(layer);
|
|
4470
4411
|
break;
|
|
4471
4412
|
}
|
|
4472
|
-
case "occupant": {
|
|
4473
|
-
switch (category) {
|
|
4474
|
-
// Create only marker if it is amenity occupant
|
|
4475
|
-
case "currencyexchange":
|
|
4476
|
-
case "donationcenter":
|
|
4477
|
-
case "postoffice":
|
|
4478
|
-
const markerFeature = {
|
|
4479
|
-
...feature2,
|
|
4480
|
-
geometry: feature2.properties?.anchor?.geometry
|
|
4481
|
-
};
|
|
4482
|
-
const marker3d = create3DOccupantAmenityMarker(
|
|
4483
|
-
markerFeature,
|
|
4484
|
-
this.threeLayer,
|
|
4485
|
-
extrudeConfig
|
|
4486
|
-
)?.on("click", this.handleClickElement);
|
|
4487
|
-
object3ds.push(marker3d);
|
|
4488
|
-
break;
|
|
4489
|
-
default: {
|
|
4490
|
-
const { kiosk, anchor } = feature2.properties;
|
|
4491
|
-
const { unit } = anchor.properties;
|
|
4492
|
-
let mainLocation = kiosk || unit || null;
|
|
4493
|
-
const relatedLocations = [
|
|
4494
|
-
...feature2.properties.units,
|
|
4495
|
-
...feature2.properties.kiosks
|
|
4496
|
-
].filter((f) => f.properties.ordinal !== properties.ordinal);
|
|
4497
|
-
const occupantLocations = [mainLocation, ...relatedLocations];
|
|
4498
|
-
const renderType = feature2.properties.render_type;
|
|
4499
|
-
occupantLocations.forEach((location, index) => {
|
|
4500
|
-
const isMainLocation = index === 0;
|
|
4501
|
-
if (renderType === "Label") {
|
|
4502
|
-
const occupantGroundLabel = createOccupantGroundLabel(
|
|
4503
|
-
feature2,
|
|
4504
|
-
location,
|
|
4505
|
-
{ textMarkerType, extrudeConfig },
|
|
4506
|
-
this.threeLayer
|
|
4507
|
-
);
|
|
4508
|
-
if (occupantGroundLabel instanceof GroundLabel) {
|
|
4509
|
-
occupantGroundLabel.on("click", this.handleClickElement);
|
|
4510
|
-
occupantGroundLabel.addTo(this.threeLayer);
|
|
4511
|
-
object3ds.push(occupantGroundLabel);
|
|
4512
|
-
this.#groundObjects.push(occupantGroundLabel);
|
|
4513
|
-
}
|
|
4514
|
-
} else {
|
|
4515
|
-
const occupantMarker = createOccupant(feature2, location, {
|
|
4516
|
-
textMarkerType,
|
|
4517
|
-
extrudeConfig
|
|
4518
|
-
});
|
|
4519
|
-
if (occupantMarker instanceof import_maptalks_gl.ui.UIMarker) {
|
|
4520
|
-
occupantMarker.addTo(this.map);
|
|
4521
|
-
} else {
|
|
4522
|
-
occupantMarker?.on("click", this.handleClickElement);
|
|
4523
|
-
occupantMarker?.addTo(layer);
|
|
4524
|
-
}
|
|
4525
|
-
if (isMainLocation) {
|
|
4526
|
-
geometry = occupantMarker;
|
|
4527
|
-
} else {
|
|
4528
|
-
elements[`${feature2.id}_${index}`] = {
|
|
4529
|
-
geometry: occupantMarker,
|
|
4530
|
-
properties: location.properties,
|
|
4531
|
-
featureType: "occupant",
|
|
4532
|
-
feature: feature2
|
|
4533
|
-
};
|
|
4534
|
-
}
|
|
4535
|
-
}
|
|
4536
|
-
});
|
|
4537
|
-
}
|
|
4538
|
-
}
|
|
4539
|
-
break;
|
|
4540
|
-
}
|
|
4541
|
-
case "fixture": {
|
|
4542
|
-
const models = await create3DFixture(feature2, this.threeLayer);
|
|
4543
|
-
models.forEach((model) => {
|
|
4544
|
-
model.on("click", this.handleClickElement);
|
|
4545
|
-
object3ds.push(model);
|
|
4546
|
-
this.#glbObjects.push(model);
|
|
4547
|
-
});
|
|
4548
|
-
if (!featureExtrudeConfig) {
|
|
4549
|
-
geometry = createFixture(feature2)?.addTo(layer);
|
|
4550
|
-
} else {
|
|
4551
|
-
const locatedLevel = feature2?.properties?.level;
|
|
4552
|
-
const levelExtrudeConfig = getExtrudeConfigByFeature(
|
|
4553
|
-
extrudeConfig,
|
|
4554
|
-
locatedLevel
|
|
4555
|
-
);
|
|
4556
|
-
const levelHeight = import_lodash7.default.get(levelExtrudeConfig, "height", 0);
|
|
4557
|
-
const option = { ...featureExtrudeConfig, altitude: levelHeight };
|
|
4558
|
-
const extrudedFixture = createExtrudedUnit(
|
|
4559
|
-
feature2,
|
|
4560
|
-
this.threeLayer,
|
|
4561
|
-
option
|
|
4562
|
-
);
|
|
4563
|
-
object3ds.push(extrudedFixture);
|
|
4564
|
-
}
|
|
4565
|
-
break;
|
|
4566
|
-
}
|
|
4567
|
-
case "footprint": {
|
|
4568
|
-
const objects = await create3DFootprint(
|
|
4569
|
-
feature2,
|
|
4570
|
-
this.threeLayer,
|
|
4571
|
-
featureExtrudeConfig
|
|
4572
|
-
);
|
|
4573
|
-
objects.forEach((object) => {
|
|
4574
|
-
object.on("click", () => {
|
|
4575
|
-
const {
|
|
4576
|
-
geometry: { coordinates }
|
|
4577
|
-
} = (0, import_center4.default)(feature2);
|
|
4578
|
-
this.camera.flyToAndZoomIn(coordinates, { pitch: 45 });
|
|
4579
|
-
});
|
|
4580
|
-
object3ds.push(object);
|
|
4581
|
-
this.#objects.push(object);
|
|
4582
|
-
});
|
|
4583
|
-
if (feature2.properties.logo) {
|
|
4584
|
-
const footprintMarker = create3DBillboard(
|
|
4585
|
-
feature2,
|
|
4586
|
-
this.threeLayer
|
|
4587
|
-
);
|
|
4588
|
-
object3ds.push(footprintMarker);
|
|
4589
|
-
this.#billboardObjects.push(footprintMarker);
|
|
4590
|
-
}
|
|
4591
|
-
break;
|
|
4592
|
-
}
|
|
4593
4413
|
default:
|
|
4594
4414
|
break;
|
|
4595
4415
|
}
|
|
@@ -4658,27 +4478,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4658
4478
|
changeLevelByOrdinal(ordinal) {
|
|
4659
4479
|
this.rendererManager.changeLevelByOrdinal(ordinal);
|
|
4660
4480
|
}
|
|
4661
|
-
getFeatureExtent = (feature2, scaleFactor = 1) => {
|
|
4662
|
-
const [minX, minY, maxX, maxY] = index_default(
|
|
4663
|
-
(0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
|
|
4664
|
-
);
|
|
4665
|
-
return new import_maptalks_gl.Extent(minX, minY, maxX, maxY);
|
|
4666
|
-
};
|
|
4667
|
-
getExtentCenter = (extent) => {
|
|
4668
|
-
return extent.getCenter();
|
|
4669
|
-
};
|
|
4670
|
-
getExtentZoom = (extent, options = {
|
|
4671
|
-
isFraction: false,
|
|
4672
|
-
padding: {
|
|
4673
|
-
paddingLeft: 0,
|
|
4674
|
-
paddingRight: 0,
|
|
4675
|
-
paddingTop: 0,
|
|
4676
|
-
paddingBottom: 0
|
|
4677
|
-
}
|
|
4678
|
-
}) => {
|
|
4679
|
-
const { isFraction = false, padding } = options;
|
|
4680
|
-
return this.map.getFitZoom(extent, isFraction, padding);
|
|
4681
|
-
};
|
|
4682
4481
|
findVenueInView = () => {
|
|
4683
4482
|
const mapCenter = this.map.getCenter();
|
|
4684
4483
|
const result = this.#venues.reduce((closest, venue) => {
|
|
@@ -4691,9 +4490,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4691
4490
|
}, null);
|
|
4692
4491
|
return result;
|
|
4693
4492
|
};
|
|
4694
|
-
flyTo = (center2, options) => {
|
|
4695
|
-
this.camera.flyTo(center2, options);
|
|
4696
|
-
};
|
|
4697
4493
|
getLineStringBearing = (feature2) => {
|
|
4698
4494
|
const { geometry } = feature2;
|
|
4699
4495
|
const path = new import_maptalks_gl.LineString(geometry.coordinates);
|
|
@@ -5209,33 +5005,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
5209
5005
|
/**
|
|
5210
5006
|
* render (frame)
|
|
5211
5007
|
*/
|
|
5212
|
-
getTargetViewCenter = (targetView, options = { offset: { top: 0, left: 0, right: 0, bottom: 0 } }) => {
|
|
5213
|
-
const map = this.map;
|
|
5214
|
-
const { offset } = options;
|
|
5215
|
-
const { top = 0, left = 0, right = 0, bottom = 0 } = offset;
|
|
5216
|
-
const originalState = {
|
|
5217
|
-
bearing: map.getBearing(),
|
|
5218
|
-
center: map.getCenter(),
|
|
5219
|
-
pitch: map.getPitch(),
|
|
5220
|
-
zoom: map.getZoom()
|
|
5221
|
-
};
|
|
5222
|
-
const finalView = {
|
|
5223
|
-
bearing: import_lodash7.default.isNil(targetView.bearing) ? map.getBearing() : targetView.bearing,
|
|
5224
|
-
center: import_lodash7.default.isNil(targetView.center) ? map.getCenter() : targetView.center,
|
|
5225
|
-
pitch: import_lodash7.default.isNil(targetView.pitch) ? map.getPitch() : targetView.pitch,
|
|
5226
|
-
zoom: import_lodash7.default.isNil(targetView.zoom) ? map.getZoom() : targetView.zoom
|
|
5227
|
-
};
|
|
5228
|
-
map.setView(finalView);
|
|
5229
|
-
const projectedTargetCenter = map.coordinateToContainerPoint(finalView.center).add(right / 2 - left / 2, bottom / 2 - top / 2);
|
|
5230
|
-
const adjustedTargetCenter = map.containerPointToCoordinate(
|
|
5231
|
-
projectedTargetCenter
|
|
5232
|
-
);
|
|
5233
|
-
map.setView(originalState);
|
|
5234
|
-
return adjustedTargetCenter;
|
|
5235
|
-
};
|
|
5236
|
-
setMaxExtent(extent) {
|
|
5237
|
-
return this.map.setMaxExtent(extent);
|
|
5238
|
-
}
|
|
5239
5008
|
render() {
|
|
5240
5009
|
const view = this.map.getView();
|
|
5241
5010
|
const currBearing = view.bearing;
|
|
@@ -5244,7 +5013,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
5244
5013
|
this.threeLayer.redraw();
|
|
5245
5014
|
}
|
|
5246
5015
|
if (this.threeLayer) {
|
|
5247
|
-
const
|
|
5016
|
+
const currentView = this.camera.getView();
|
|
5017
|
+
const objectOpacity = import_lodash7.default.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
5248
5018
|
this.#objects.forEach((object) => {
|
|
5249
5019
|
object.getObject3d().traverse((child) => {
|
|
5250
5020
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -5255,7 +5025,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5255
5025
|
if (this.#billboardObjects) {
|
|
5256
5026
|
this.#billboardObjects.forEach((object) => {
|
|
5257
5027
|
const objectScale = import_lodash7.default.clamp(
|
|
5258
|
-
20 - 1 *
|
|
5028
|
+
20 - 1 * currentView.zoom,
|
|
5259
5029
|
1,
|
|
5260
5030
|
1.05
|
|
5261
5031
|
);
|
|
@@ -5308,6 +5078,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5308
5078
|
MARKER_LAYER_NAME,
|
|
5309
5079
|
NONIMDF_FEATURE_TYPES,
|
|
5310
5080
|
ORIGIN_MARKER_ID,
|
|
5081
|
+
OccupantHelpers,
|
|
5311
5082
|
POI_MARKER_LAYER_NAME,
|
|
5312
5083
|
QueryObserver,
|
|
5313
5084
|
USER_LOCATION_ELEMENT_ID,
|
|
@@ -5335,6 +5106,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
5335
5106
|
getRelatedLocationsByOccupant,
|
|
5336
5107
|
getSuitablyValueBetweenBearings,
|
|
5337
5108
|
isClickableFeature,
|
|
5109
|
+
isValidCoordinate,
|
|
5110
|
+
isValidLineString,
|
|
5111
|
+
isValidLineStringCoordinates,
|
|
5112
|
+
isValidMultiPolygon,
|
|
5113
|
+
isValidMultiPolygonCoordinates,
|
|
5114
|
+
isValidPoint,
|
|
5115
|
+
isValidPolygon,
|
|
5116
|
+
isValidPolygonCoordinates,
|
|
5117
|
+
matchFilter,
|
|
5118
|
+
matchFilters,
|
|
5338
5119
|
safeFetchFeature,
|
|
5339
5120
|
styledFeatureGenerator
|
|
5340
5121
|
});
|