venue-js 1.3.0 → 1.4.0-next.1
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 +13 -6
- package/dist/index.d.ts +13 -6
- package/dist/index.js +100 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ import { Map, Coordinate as Coordinate$1 } from 'maptalks-gl';
|
|
|
8
8
|
import { BaseObject, ThreeLayer } from 'maptalks.three';
|
|
9
9
|
import * as maptalks from 'maptalks';
|
|
10
10
|
import { Coordinate, Extent, Marker, ui, LineString as LineString$1, Polygon as Polygon$1, MultiPolygon as MultiPolygon$1, MultiLineString } from 'maptalks';
|
|
11
|
-
import { BaseObjectOptionType, ExtrudePolygonOptionType, ExtrudeLineOptionType } from 'maptalks.three/dist/type';
|
|
11
|
+
import { BaseObjectOptionType, BarOptionType, ExtrudePolygonOptionType, ExtrudeLineOptionType } from 'maptalks.three/dist/type';
|
|
12
12
|
import { PolygonOptionsType } from 'maptalks/dist/geometry/Polygon';
|
|
13
13
|
import { LineStringOptionsType } from 'maptalks/dist/geometry/LineString';
|
|
14
14
|
import { MapViewType, MapAnimationOptionsType, MapPaddingType } from 'maptalks/dist/map/Map';
|
|
@@ -827,6 +827,15 @@ declare class TextSpriteMarker extends BaseObject {
|
|
|
827
827
|
setAltitude(altitude: number): this;
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
+
type ImageMarkerOptions = BaseObjectOptionType & {
|
|
831
|
+
src: string;
|
|
832
|
+
bottomHeight?: number;
|
|
833
|
+
leg?: Omit<BarOptionType, 'height'> & {
|
|
834
|
+
color: string;
|
|
835
|
+
};
|
|
836
|
+
};
|
|
837
|
+
type AnyMarkerOptions = TextMarkerOptions | ImageMarkerOptions;
|
|
838
|
+
|
|
830
839
|
type Stop = [zoom: number, value: number];
|
|
831
840
|
type MapElement = maptalks.Geometry | BaseObject;
|
|
832
841
|
/** 2D */
|
|
@@ -868,17 +877,15 @@ type BaseRenderManagerOptions = {
|
|
|
868
877
|
};
|
|
869
878
|
type RendererManagerOptions = BaseRenderManagerOptions & {
|
|
870
879
|
type: "2D";
|
|
871
|
-
elements
|
|
880
|
+
elements?: Element2DRendererOptions;
|
|
872
881
|
} | BaseRenderManagerOptions & {
|
|
873
882
|
type: "3D";
|
|
874
|
-
elements
|
|
883
|
+
elements?: Element3DRendererOptions;
|
|
875
884
|
};
|
|
876
885
|
type HighlightElementOptions = {
|
|
877
886
|
reset: boolean;
|
|
878
887
|
};
|
|
879
888
|
|
|
880
|
-
type AnyMarkerOptions = TextMarkerOptions;
|
|
881
|
-
|
|
882
889
|
declare class RendererManager extends EventTarget {
|
|
883
890
|
#private;
|
|
884
891
|
map: maptalks$1.Map;
|
|
@@ -906,7 +913,7 @@ declare class RendererManager extends EventTarget {
|
|
|
906
913
|
* ======================================================================== */
|
|
907
914
|
_getMarkersByOrdinal: (ordinal: number) => BaseObject[] | maptalks$1.ui.UIMarker[];
|
|
908
915
|
_addMarkersToManager: (id: any, markers: any, ordinal: any) => void;
|
|
909
|
-
createMarker(coordinate: Position, ordinal: number,
|
|
916
|
+
createMarker(type: 'text' | 'image', coordinate: Position, ordinal: number, textOrPath: string, options: AnyMarkerOptions): void;
|
|
910
917
|
clearMarkers(): void;
|
|
911
918
|
}
|
|
912
919
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Map, Coordinate as Coordinate$1 } from 'maptalks-gl';
|
|
|
8
8
|
import { BaseObject, ThreeLayer } from 'maptalks.three';
|
|
9
9
|
import * as maptalks from 'maptalks';
|
|
10
10
|
import { Coordinate, Extent, Marker, ui, LineString as LineString$1, Polygon as Polygon$1, MultiPolygon as MultiPolygon$1, MultiLineString } from 'maptalks';
|
|
11
|
-
import { BaseObjectOptionType, ExtrudePolygonOptionType, ExtrudeLineOptionType } from 'maptalks.three/dist/type';
|
|
11
|
+
import { BaseObjectOptionType, BarOptionType, ExtrudePolygonOptionType, ExtrudeLineOptionType } from 'maptalks.three/dist/type';
|
|
12
12
|
import { PolygonOptionsType } from 'maptalks/dist/geometry/Polygon';
|
|
13
13
|
import { LineStringOptionsType } from 'maptalks/dist/geometry/LineString';
|
|
14
14
|
import { MapViewType, MapAnimationOptionsType, MapPaddingType } from 'maptalks/dist/map/Map';
|
|
@@ -827,6 +827,15 @@ declare class TextSpriteMarker extends BaseObject {
|
|
|
827
827
|
setAltitude(altitude: number): this;
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
+
type ImageMarkerOptions = BaseObjectOptionType & {
|
|
831
|
+
src: string;
|
|
832
|
+
bottomHeight?: number;
|
|
833
|
+
leg?: Omit<BarOptionType, 'height'> & {
|
|
834
|
+
color: string;
|
|
835
|
+
};
|
|
836
|
+
};
|
|
837
|
+
type AnyMarkerOptions = TextMarkerOptions | ImageMarkerOptions;
|
|
838
|
+
|
|
830
839
|
type Stop = [zoom: number, value: number];
|
|
831
840
|
type MapElement = maptalks.Geometry | BaseObject;
|
|
832
841
|
/** 2D */
|
|
@@ -868,17 +877,15 @@ type BaseRenderManagerOptions = {
|
|
|
868
877
|
};
|
|
869
878
|
type RendererManagerOptions = BaseRenderManagerOptions & {
|
|
870
879
|
type: "2D";
|
|
871
|
-
elements
|
|
880
|
+
elements?: Element2DRendererOptions;
|
|
872
881
|
} | BaseRenderManagerOptions & {
|
|
873
882
|
type: "3D";
|
|
874
|
-
elements
|
|
883
|
+
elements?: Element3DRendererOptions;
|
|
875
884
|
};
|
|
876
885
|
type HighlightElementOptions = {
|
|
877
886
|
reset: boolean;
|
|
878
887
|
};
|
|
879
888
|
|
|
880
|
-
type AnyMarkerOptions = TextMarkerOptions;
|
|
881
|
-
|
|
882
889
|
declare class RendererManager extends EventTarget {
|
|
883
890
|
#private;
|
|
884
891
|
map: maptalks$1.Map;
|
|
@@ -906,7 +913,7 @@ declare class RendererManager extends EventTarget {
|
|
|
906
913
|
* ======================================================================== */
|
|
907
914
|
_getMarkersByOrdinal: (ordinal: number) => BaseObject[] | maptalks$1.ui.UIMarker[];
|
|
908
915
|
_addMarkersToManager: (id: any, markers: any, ordinal: any) => void;
|
|
909
|
-
createMarker(coordinate: Position, ordinal: number,
|
|
916
|
+
createMarker(type: 'text' | 'image', coordinate: Position, ordinal: number, textOrPath: string, options: AnyMarkerOptions): void;
|
|
910
917
|
clearMarkers(): void;
|
|
911
918
|
}
|
|
912
919
|
|
package/dist/index.js
CHANGED
|
@@ -405,6 +405,7 @@ var getOccupantMarkerLocations = (occupant, options) => {
|
|
|
405
405
|
var import_query_core = require("@tanstack/query-core");
|
|
406
406
|
|
|
407
407
|
// src/data/populator/index.ts
|
|
408
|
+
var import_lodash_es2 = require("lodash-es");
|
|
408
409
|
var import_boolean_within = require("@turf/boolean-within");
|
|
409
410
|
var createPopulator = ({
|
|
410
411
|
internalFindById,
|
|
@@ -488,7 +489,14 @@ var createPopulator = ({
|
|
|
488
489
|
const anchor = await internalFindById(kiosk.properties.anchor_id);
|
|
489
490
|
const units = await internalFilterByType("unit");
|
|
490
491
|
const unit = units.find(
|
|
491
|
-
(unit2) =>
|
|
492
|
+
(unit2) => {
|
|
493
|
+
try {
|
|
494
|
+
return unit2.properties.category === "walkway" && unit2.properties.level_id === kiosk.properties.level_id && (0, import_boolean_within.booleanWithin)(kiosk, unit2);
|
|
495
|
+
} catch (e) {
|
|
496
|
+
console.log(`Cannot find kiosk(${kiosk.id})'s units:`, e.message);
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
492
500
|
);
|
|
493
501
|
let section = null;
|
|
494
502
|
if (anchor) {
|
|
@@ -551,7 +559,7 @@ var createPopulator = ({
|
|
|
551
559
|
...occupant.properties,
|
|
552
560
|
anchor: anchor ? await populateAnchor(anchor) : null,
|
|
553
561
|
local_categories: await Promise.all(
|
|
554
|
-
localCategories.map(populateTaxonomy)
|
|
562
|
+
(0, import_lodash_es2.compact)(localCategories).map(populateTaxonomy)
|
|
555
563
|
),
|
|
556
564
|
venue,
|
|
557
565
|
promotions,
|
|
@@ -2729,9 +2737,9 @@ var CameraManager = class {
|
|
|
2729
2737
|
};
|
|
2730
2738
|
|
|
2731
2739
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
2732
|
-
var
|
|
2740
|
+
var import_lodash_es4 = require("lodash-es");
|
|
2733
2741
|
var import_center3 = require("@turf/center");
|
|
2734
|
-
var
|
|
2742
|
+
var THREE4 = __toESM(require("three"));
|
|
2735
2743
|
|
|
2736
2744
|
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
2737
2745
|
var maptalks4 = __toESM(require("maptalks-gl"));
|
|
@@ -2750,7 +2758,7 @@ var maptalks3 = __toESM(require("maptalks-gl"));
|
|
|
2750
2758
|
var import_maptalks6 = require("maptalks.three");
|
|
2751
2759
|
var import_three5 = require("three");
|
|
2752
2760
|
var import_d3plus_shape = require("d3plus-shape");
|
|
2753
|
-
var
|
|
2761
|
+
var import_lodash_es3 = require("lodash-es");
|
|
2754
2762
|
var OPTIONS3 = {
|
|
2755
2763
|
// Allowing click through and prevent interaction
|
|
2756
2764
|
interactive: false,
|
|
@@ -2768,9 +2776,9 @@ var defaultFlatLabelOptions = {
|
|
|
2768
2776
|
textBaseline: "middle",
|
|
2769
2777
|
fillStyle: "#000"
|
|
2770
2778
|
};
|
|
2771
|
-
var defaultRectAngleToCalc = (0,
|
|
2779
|
+
var defaultRectAngleToCalc = (0, import_lodash_es3.range)(-90, 92, 2);
|
|
2772
2780
|
var getMaterial = (text, flatLabelOptions) => {
|
|
2773
|
-
const options = (0,
|
|
2781
|
+
const options = (0, import_lodash_es3.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
|
|
2774
2782
|
const {
|
|
2775
2783
|
fontSize: initialFontSize,
|
|
2776
2784
|
fontFamily,
|
|
@@ -2823,12 +2831,12 @@ var getMaterial = (text, flatLabelOptions) => {
|
|
|
2823
2831
|
const maxWidth = SIZE - 2 * margin;
|
|
2824
2832
|
texts = wrapText(ctx, text, maxWidth);
|
|
2825
2833
|
}
|
|
2826
|
-
let textWidth = (0,
|
|
2834
|
+
let textWidth = (0, import_lodash_es3.max)(texts.map((text2) => ctx.measureText(text2).width));
|
|
2827
2835
|
let scale3 = 1;
|
|
2828
2836
|
while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
|
|
2829
2837
|
scale3 -= scaleStep;
|
|
2830
2838
|
ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
|
|
2831
|
-
textWidth = (0,
|
|
2839
|
+
textWidth = (0, import_lodash_es3.max)(texts.map((text2) => ctx.measureText(text2).width));
|
|
2832
2840
|
}
|
|
2833
2841
|
const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
|
|
2834
2842
|
if (scale3 > scaleMin) {
|
|
@@ -2896,7 +2904,7 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
|
|
|
2896
2904
|
strokeStyle,
|
|
2897
2905
|
lineWidth
|
|
2898
2906
|
});
|
|
2899
|
-
const rectAngles = (0,
|
|
2907
|
+
const rectAngles = (0, import_lodash_es3.isArray)(angle) ? angle : [angle];
|
|
2900
2908
|
material.needsUpdate = true;
|
|
2901
2909
|
const rect = (0, import_d3plus_shape.largestRect)(bound, {
|
|
2902
2910
|
cache: true,
|
|
@@ -2969,32 +2977,32 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
|
|
|
2969
2977
|
return { x: this.#offsetX, y: this.#offsetY };
|
|
2970
2978
|
}
|
|
2971
2979
|
set offsetX(value) {
|
|
2972
|
-
if ((0,
|
|
2980
|
+
if ((0, import_lodash_es3.isNumber)(value)) {
|
|
2973
2981
|
this.#offsetX = value;
|
|
2974
2982
|
this.#updatePosition();
|
|
2975
2983
|
}
|
|
2976
2984
|
}
|
|
2977
2985
|
set offsetY(value) {
|
|
2978
|
-
if ((0,
|
|
2986
|
+
if ((0, import_lodash_es3.isNumber)(value)) {
|
|
2979
2987
|
this.#offsetY = value;
|
|
2980
2988
|
this.#updatePosition();
|
|
2981
2989
|
}
|
|
2982
2990
|
}
|
|
2983
2991
|
set angle(newAngle) {
|
|
2984
|
-
if ((0,
|
|
2992
|
+
if ((0, import_lodash_es3.isNumber)(newAngle)) {
|
|
2985
2993
|
this.#angle = newAngle;
|
|
2986
2994
|
this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
|
|
2987
2995
|
}
|
|
2988
2996
|
}
|
|
2989
2997
|
setOffset(offsetX, offsetY) {
|
|
2990
|
-
if ((0,
|
|
2998
|
+
if ((0, import_lodash_es3.isNumber)(offsetX) && (0, import_lodash_es3.isNumber)(offsetY)) {
|
|
2991
2999
|
this.#offsetX = offsetX;
|
|
2992
3000
|
this.#offsetY = offsetY;
|
|
2993
3001
|
this.#updatePosition();
|
|
2994
3002
|
}
|
|
2995
3003
|
}
|
|
2996
3004
|
addOffset(deltaX, deltaY) {
|
|
2997
|
-
if ((0,
|
|
3005
|
+
if ((0, import_lodash_es3.isNumber)(deltaX) && (0, import_lodash_es3.isNumber)(deltaY)) {
|
|
2998
3006
|
this.#offsetX += deltaX;
|
|
2999
3007
|
this.#offsetY += deltaY;
|
|
3000
3008
|
this.#updatePosition();
|
|
@@ -3076,7 +3084,7 @@ var DEFAULT_POLYGON_OPTION = {
|
|
|
3076
3084
|
offset: 0,
|
|
3077
3085
|
altitude: 0
|
|
3078
3086
|
};
|
|
3079
|
-
var get3DRendererOption = (featureType, category, options) => {
|
|
3087
|
+
var get3DRendererOption = (featureType, category, options = {}) => {
|
|
3080
3088
|
try {
|
|
3081
3089
|
const option = options[featureType] ?? element3DRendererOptions[featureType];
|
|
3082
3090
|
return (category && option.byCategory?.[category]) ?? option?.default ?? DEFAULT_POLYGON_OPTION;
|
|
@@ -3537,6 +3545,12 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3537
3545
|
marker.addTo(this.map);
|
|
3538
3546
|
return marker;
|
|
3539
3547
|
};
|
|
3548
|
+
createTextMarker = (position, label, options) => {
|
|
3549
|
+
return null;
|
|
3550
|
+
};
|
|
3551
|
+
createImageMarker = (position, src, options) => {
|
|
3552
|
+
return null;
|
|
3553
|
+
};
|
|
3540
3554
|
removeMarker = (marker) => {
|
|
3541
3555
|
marker.remove();
|
|
3542
3556
|
};
|
|
@@ -3548,6 +3562,7 @@ var Marker2DRenderer = class extends EventTarget {
|
|
|
3548
3562
|
|
|
3549
3563
|
// src/IndoorMap/renderer/3d/Marker3DRenderer.ts
|
|
3550
3564
|
var maptalks7 = __toESM(require("maptalks-gl"));
|
|
3565
|
+
var THREE3 = __toESM(require("three"));
|
|
3551
3566
|
|
|
3552
3567
|
// src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
|
|
3553
3568
|
var import_maptalks8 = require("maptalks");
|
|
@@ -3747,21 +3762,35 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
|
3747
3762
|
};
|
|
3748
3763
|
|
|
3749
3764
|
// src/IndoorMap/renderer/3d/Marker3DRenderer.ts
|
|
3750
|
-
var HEIGHT_METER2 = 4;
|
|
3751
|
-
var MULTIORDINAL_HEIGHT_METER3 = 9;
|
|
3752
3765
|
var Marker3DRenderer = class extends EventTarget {
|
|
3753
3766
|
isReady = false;
|
|
3754
3767
|
threeLayer;
|
|
3755
3768
|
map;
|
|
3756
|
-
materialByKey;
|
|
3757
3769
|
constructor(map, options, layer) {
|
|
3758
3770
|
super();
|
|
3759
3771
|
this.map = map;
|
|
3760
3772
|
this.threeLayer = layer;
|
|
3761
3773
|
}
|
|
3762
|
-
|
|
3774
|
+
createPointMaterialFromSvg(svgPath, size = 40) {
|
|
3775
|
+
return new THREE3.PointsMaterial({
|
|
3776
|
+
size,
|
|
3777
|
+
sizeAttenuation: false,
|
|
3778
|
+
// Always same size in screen pixels (Screen pixel)
|
|
3779
|
+
// color: fillStyle,
|
|
3780
|
+
alphaTest: 0.5,
|
|
3781
|
+
// vertexColors: THREE.VertexColors,
|
|
3782
|
+
// color: 0xffffff,
|
|
3783
|
+
transparent: true,
|
|
3784
|
+
blending: THREE3.NormalBlending,
|
|
3785
|
+
depthTest: true,
|
|
3786
|
+
// POI is hidden behind building
|
|
3787
|
+
depthWrite: true,
|
|
3788
|
+
map: new THREE3.TextureLoader().load(svgPath)
|
|
3789
|
+
});
|
|
3790
|
+
}
|
|
3791
|
+
createTextMarker = (position, label, options) => {
|
|
3763
3792
|
const combinedOptions = {
|
|
3764
|
-
altitude:
|
|
3793
|
+
altitude: 0,
|
|
3765
3794
|
text: label,
|
|
3766
3795
|
...options ?? {}
|
|
3767
3796
|
};
|
|
@@ -3770,17 +3799,37 @@ var Marker3DRenderer = class extends EventTarget {
|
|
|
3770
3799
|
this.threeLayer.addMesh([marker]);
|
|
3771
3800
|
return marker;
|
|
3772
3801
|
};
|
|
3773
|
-
createImageMarker = () => {
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3802
|
+
createImageMarker = (position, src, options) => {
|
|
3803
|
+
const [lng, lat] = position;
|
|
3804
|
+
let meshes = [];
|
|
3805
|
+
const height = options.height ?? 0;
|
|
3806
|
+
const { leg, ...markerOptions } = options;
|
|
3807
|
+
const { color: legColor = "#000000", ...legOptions } = leg ?? {};
|
|
3808
|
+
const material = this.createPointMaterialFromSvg(src, 40);
|
|
3809
|
+
const marker = this.threeLayer.toPoint(new maptalks7.Coordinate(lng, lat), { height, ...markerOptions }, material);
|
|
3810
|
+
marker.getObject3d().renderOrder = 10;
|
|
3811
|
+
meshes.push(marker);
|
|
3812
|
+
if (options.leg) {
|
|
3813
|
+
const legMaterial = new THREE3.MeshLambertMaterial({ color: legColor, transparent: true });
|
|
3814
|
+
const leg2 = this.threeLayer.toBar(new maptalks7.Coordinate(lng, lat), { ...legOptions, height }, legMaterial);
|
|
3815
|
+
const legObj = leg2.getObject3d();
|
|
3816
|
+
legObj.traverse((o) => {
|
|
3817
|
+
if (o.isMesh && o.material) {
|
|
3818
|
+
o.material.depthWrite = false;
|
|
3819
|
+
o.material.depthTest = true;
|
|
3820
|
+
o.renderOrder = 0;
|
|
3821
|
+
}
|
|
3822
|
+
});
|
|
3823
|
+
meshes = [leg2, ...meshes];
|
|
3824
|
+
}
|
|
3825
|
+
this.threeLayer.addMesh(meshes);
|
|
3826
|
+
return meshes;
|
|
3777
3827
|
};
|
|
3778
3828
|
removeMarker = (marker) => {
|
|
3779
3829
|
marker.remove();
|
|
3780
3830
|
};
|
|
3781
3831
|
showMarkers(elements, ordinalDiff = 0) {
|
|
3782
3832
|
elements.forEach((element) => {
|
|
3783
|
-
element.setAltitude(ordinalDiff * MULTIORDINAL_HEIGHT_METER3);
|
|
3784
3833
|
element.show();
|
|
3785
3834
|
});
|
|
3786
3835
|
}
|
|
@@ -4319,7 +4368,11 @@ function inBBox(pt, bbox2) {
|
|
|
4319
4368
|
|
|
4320
4369
|
// src/IndoorMap/renderer/utils/findUnitOnPoint.ts
|
|
4321
4370
|
var findUnitOnPoint = (units, point2) => {
|
|
4322
|
-
|
|
4371
|
+
try {
|
|
4372
|
+
return units.find((unit) => booleanPointInPolygon(point2, polygon(unit.geometry.coordinates)));
|
|
4373
|
+
} catch (err) {
|
|
4374
|
+
return null;
|
|
4375
|
+
}
|
|
4323
4376
|
};
|
|
4324
4377
|
|
|
4325
4378
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
@@ -4389,13 +4442,13 @@ var RendererManager = class extends EventTarget {
|
|
|
4389
4442
|
}
|
|
4390
4443
|
return bad;
|
|
4391
4444
|
}
|
|
4392
|
-
const ambientLight = new
|
|
4445
|
+
const ambientLight = new THREE4.AmbientLight(16777215, 0.3);
|
|
4393
4446
|
scene.add(ambientLight);
|
|
4394
4447
|
const dirColor = 16777215;
|
|
4395
|
-
const dllight = new
|
|
4448
|
+
const dllight = new THREE4.DirectionalLight(dirColor, 0.8);
|
|
4396
4449
|
dllight.position.set(0, -10, 20).normalize();
|
|
4397
4450
|
scene.add(dllight);
|
|
4398
|
-
const hemi = new
|
|
4451
|
+
const hemi = new THREE4.HemisphereLight(16777215, 4473924, 0.4);
|
|
4399
4452
|
scene.add(hemi);
|
|
4400
4453
|
_this.elementRenderer = new Element3DRenderer(map, options.elements);
|
|
4401
4454
|
_this.markerRenderer = new Marker3DRenderer(map, {}, threeLayer);
|
|
@@ -4420,7 +4473,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4420
4473
|
if (this.#isClicked) return;
|
|
4421
4474
|
this.#isClicked = true;
|
|
4422
4475
|
const onClickElement = this.#onClickElement;
|
|
4423
|
-
if (!(0,
|
|
4476
|
+
if (!(0, import_lodash_es4.isFunction)(onClickElement)) return;
|
|
4424
4477
|
this.#onClickElement(e);
|
|
4425
4478
|
this.#isClicked = false;
|
|
4426
4479
|
};
|
|
@@ -4473,12 +4526,12 @@ var RendererManager = class extends EventTarget {
|
|
|
4473
4526
|
});
|
|
4474
4527
|
units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
|
|
4475
4528
|
const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
|
|
4476
|
-
const roomOpenings = (0,
|
|
4529
|
+
const roomOpenings = (0, import_lodash_es4.compact)(openingRelationships.map((rel) => {
|
|
4477
4530
|
const openingId = rel?.properties.intermediary[0].id;
|
|
4478
4531
|
return openings.find((o) => o.id === openingId);
|
|
4479
4532
|
}));
|
|
4480
4533
|
const innerElements = this.elementRenderer.createGeometry(unit);
|
|
4481
|
-
const wallElements =
|
|
4534
|
+
const wallElements = [];
|
|
4482
4535
|
if (innerElements || wallElements) {
|
|
4483
4536
|
const _innerElements = Array.isArray(innerElements) ? innerElements : [innerElements];
|
|
4484
4537
|
const _wallElements = Array.isArray(wallElements) ? wallElements : [wallElements];
|
|
@@ -4533,10 +4586,12 @@ var RendererManager = class extends EventTarget {
|
|
|
4533
4586
|
for (const label of groundLabels) {
|
|
4534
4587
|
const center2 = (0, import_center3.center)(polygon(label.geometry.coordinates)).geometry.coordinates;
|
|
4535
4588
|
const unit = findUnitOnPoint(units, center2);
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4589
|
+
if (unit) {
|
|
4590
|
+
const element = this.elementRenderer.createGroundLabel(label, unit);
|
|
4591
|
+
if (element) {
|
|
4592
|
+
const _elements = Array.isArray(element) ? element : [element];
|
|
4593
|
+
this.addElementsToManager(label.id, _elements, label.properties.ordinal);
|
|
4594
|
+
}
|
|
4540
4595
|
}
|
|
4541
4596
|
}
|
|
4542
4597
|
if (this.options.type === "3D") {
|
|
@@ -4559,7 +4614,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4559
4614
|
this.markerRenderer.showMarkers(markers, ordinal - baseOrdinal);
|
|
4560
4615
|
}
|
|
4561
4616
|
} else {
|
|
4562
|
-
const baseOrdinal = Array.isArray(targetOrdinal) ? (0,
|
|
4617
|
+
const baseOrdinal = Array.isArray(targetOrdinal) ? (0, import_lodash_es4.min)(targetOrdinal) : targetOrdinal;
|
|
4563
4618
|
for (const [ordinal, elements] of this.elementsByOrdinal) {
|
|
4564
4619
|
const inOrdinal = Array.isArray(targetOrdinal) ? targetOrdinal.includes(ordinal) : ordinal === targetOrdinal;
|
|
4565
4620
|
if (inOrdinal) {
|
|
@@ -4586,7 +4641,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4586
4641
|
const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
|
|
4587
4642
|
elements.forEach((element) => {
|
|
4588
4643
|
const controller = this.elementRenderer.createHighlightController(element);
|
|
4589
|
-
if (controller && (0,
|
|
4644
|
+
if (controller && (0, import_lodash_es4.isFunction)(controller.start)) {
|
|
4590
4645
|
controller.start();
|
|
4591
4646
|
this.highlightControllers.push(controller);
|
|
4592
4647
|
}
|
|
@@ -4594,7 +4649,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4594
4649
|
};
|
|
4595
4650
|
clearHighlightElements = () => {
|
|
4596
4651
|
this.highlightControllers.forEach((controller) => {
|
|
4597
|
-
if ((0,
|
|
4652
|
+
if ((0, import_lodash_es4.isFunction)(controller?.clear)) controller.clear();
|
|
4598
4653
|
});
|
|
4599
4654
|
};
|
|
4600
4655
|
/**
|
|
@@ -4618,10 +4673,11 @@ var RendererManager = class extends EventTarget {
|
|
|
4618
4673
|
this.markerRenderer.hideMarkers(markers, ordinal);
|
|
4619
4674
|
}
|
|
4620
4675
|
};
|
|
4621
|
-
createMarker(coordinate, ordinal,
|
|
4622
|
-
const
|
|
4676
|
+
createMarker(type, coordinate, ordinal, textOrPath, options) {
|
|
4677
|
+
const meshes = type === "text" ? this.markerRenderer.createTextMarker(coordinate, textOrPath, options) : this.markerRenderer.createImageMarker(coordinate, textOrPath, options);
|
|
4623
4678
|
const markerId = `${this.markersMap.size + 1}`;
|
|
4624
|
-
|
|
4679
|
+
const markerMeshes = Array.isArray(meshes) ? meshes : [meshes];
|
|
4680
|
+
this._addMarkersToManager(markerId, markerMeshes, ordinal);
|
|
4625
4681
|
}
|
|
4626
4682
|
clearMarkers() {
|
|
4627
4683
|
for (const [markerId, marker] of this.markersMap) {
|
|
@@ -4761,6 +4817,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4761
4817
|
this.#dataClient = value;
|
|
4762
4818
|
if (!this.options.camera?.defaultView?.center) {
|
|
4763
4819
|
this.#dataClient.filterByType("venue").then((venues) => {
|
|
4820
|
+
this.#venues = venues;
|
|
4764
4821
|
const venueCenters = (0, import_center4.default)(featureCollection(venues));
|
|
4765
4822
|
const [x, y] = venueCenters.geometry.coordinates;
|
|
4766
4823
|
const center2 = new import_maptalks_gl.Coordinate(x, y);
|