venue-js 1.2.0-next.13 → 1.2.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +30 -38
- package/dist/index.d.ts +30 -38
- package/dist/index.js +1243 -644
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1211 -612
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -1
package/dist/index.mjs
CHANGED
|
@@ -81,7 +81,8 @@ var defaultFeatureQueryOptionsMap = {
|
|
|
81
81
|
// refresh every 5 min
|
|
82
82
|
},
|
|
83
83
|
element: {},
|
|
84
|
-
page: {}
|
|
84
|
+
page: {},
|
|
85
|
+
model3d: {}
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
// src/data/api/delivery-project.ts
|
|
@@ -97,6 +98,14 @@ async function fetchDeliveryApi(projectId, apiKey, featureType, baseUrl = DEFAUL
|
|
|
97
98
|
const items = await res.json();
|
|
98
99
|
return items;
|
|
99
100
|
}
|
|
101
|
+
case "model3d": {
|
|
102
|
+
const res = await fetch(
|
|
103
|
+
`${baseUrl}/delivery/projects/${projectId}/${featureType}.geojson?api-key=${apiKey}`
|
|
104
|
+
);
|
|
105
|
+
if (res.status !== 200) return [];
|
|
106
|
+
const items = await res.json();
|
|
107
|
+
return items.features;
|
|
108
|
+
}
|
|
100
109
|
case "sponsored-content": {
|
|
101
110
|
const res = await fetch(
|
|
102
111
|
`${baseUrl}/delivery/projects/${projectId}/sponsored-content.json?api-key=${apiKey}`
|
|
@@ -207,16 +216,16 @@ function isValidLinearRingCoordinates(ring) {
|
|
|
207
216
|
}
|
|
208
217
|
return ring.every(isValidCoordinate) && ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1];
|
|
209
218
|
}
|
|
210
|
-
var isValidPolygonCoordinates = (
|
|
211
|
-
if (Array.isArray(
|
|
212
|
-
return isValidLinearRingCoordinates(
|
|
219
|
+
var isValidPolygonCoordinates = (polygon2) => {
|
|
220
|
+
if (Array.isArray(polygon2[0]) && (polygon2[0].length === 0 || typeof polygon2[0][0] === "number")) {
|
|
221
|
+
return isValidLinearRingCoordinates(polygon2);
|
|
213
222
|
}
|
|
214
|
-
if (Array.isArray(
|
|
215
|
-
if (!isValidLinearRingCoordinates(
|
|
223
|
+
if (Array.isArray(polygon2) && polygon2.length > 0 && Array.isArray(polygon2[0])) {
|
|
224
|
+
if (!isValidLinearRingCoordinates(polygon2[0])) {
|
|
216
225
|
return false;
|
|
217
226
|
}
|
|
218
|
-
for (let i = 1; i <
|
|
219
|
-
if (!isValidLinearRingCoordinates(
|
|
227
|
+
for (let i = 1; i < polygon2.length; i++) {
|
|
228
|
+
if (!isValidLinearRingCoordinates(polygon2[i])) {
|
|
220
229
|
return false;
|
|
221
230
|
}
|
|
222
231
|
}
|
|
@@ -259,7 +268,7 @@ var isValidPoint = (geometry) => {
|
|
|
259
268
|
function isInFilter(filter) {
|
|
260
269
|
return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
|
|
261
270
|
}
|
|
262
|
-
var someIntersect = (a, b) => a.some((
|
|
271
|
+
var someIntersect = (a, b) => a.some((v2) => b.includes(v2));
|
|
263
272
|
function matchFilter(value, filter) {
|
|
264
273
|
if (Array.isArray(value)) {
|
|
265
274
|
if (isInFilter(filter)) return someIntersect(value, filter.$in);
|
|
@@ -746,6 +755,28 @@ function point(coordinates, properties, options = {}) {
|
|
|
746
755
|
};
|
|
747
756
|
return feature(geom, properties, options);
|
|
748
757
|
}
|
|
758
|
+
function polygon(coordinates, properties, options = {}) {
|
|
759
|
+
for (const ring of coordinates) {
|
|
760
|
+
if (ring.length < 4) {
|
|
761
|
+
throw new Error(
|
|
762
|
+
"Each LinearRing of a Polygon must have 4 or more Positions."
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
if (ring[ring.length - 1].length !== ring[0].length) {
|
|
766
|
+
throw new Error("First and last Position are not equivalent.");
|
|
767
|
+
}
|
|
768
|
+
for (let j = 0; j < ring[ring.length - 1].length; j++) {
|
|
769
|
+
if (ring[ring.length - 1][j] !== ring[0][j]) {
|
|
770
|
+
throw new Error("First and last Position are not equivalent.");
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
const geom = {
|
|
775
|
+
type: "Polygon",
|
|
776
|
+
coordinates
|
|
777
|
+
};
|
|
778
|
+
return feature(geom, properties, options);
|
|
779
|
+
}
|
|
749
780
|
function lineString(coordinates, properties, options = {}) {
|
|
750
781
|
if (coordinates.length < 2) {
|
|
751
782
|
throw new Error("coordinates must be an array of two or more positions");
|
|
@@ -767,6 +798,13 @@ function featureCollection(features, options = {}) {
|
|
|
767
798
|
fc.features = features;
|
|
768
799
|
return fc;
|
|
769
800
|
}
|
|
801
|
+
function multiPoint(coordinates, properties, options = {}) {
|
|
802
|
+
const geom = {
|
|
803
|
+
type: "MultiPoint",
|
|
804
|
+
coordinates
|
|
805
|
+
};
|
|
806
|
+
return feature(geom, properties, options);
|
|
807
|
+
}
|
|
770
808
|
function isNumber(num) {
|
|
771
809
|
return !isNaN(num) && num !== null && !Array.isArray(num);
|
|
772
810
|
}
|
|
@@ -775,7 +813,7 @@ function isNumber(num) {
|
|
|
775
813
|
import turfDistance from "@turf/distance";
|
|
776
814
|
import turfCenter3 from "@turf/center";
|
|
777
815
|
import { PerspectiveCamera } from "three";
|
|
778
|
-
import { ThreeLayer as
|
|
816
|
+
import { ThreeLayer as ThreeLayer5 } from "maptalks.three";
|
|
779
817
|
|
|
780
818
|
// src/IndoorMap/constants.ts
|
|
781
819
|
var defaultLayerOption = { enableAltitude: true };
|
|
@@ -911,7 +949,7 @@ var Billboard = class extends BaseObject {
|
|
|
911
949
|
this._initOptions(options);
|
|
912
950
|
const {
|
|
913
951
|
altitude = OPTIONS.altitude,
|
|
914
|
-
scale:
|
|
952
|
+
scale: scale3 = OPTIONS.scale,
|
|
915
953
|
alphaTest = OPTIONS.alphaTest,
|
|
916
954
|
legColor = OPTIONS.legColor,
|
|
917
955
|
showLeg = OPTIONS.showLeg
|
|
@@ -945,8 +983,8 @@ var Billboard = class extends BaseObject {
|
|
|
945
983
|
const sprite = new Sprite(material);
|
|
946
984
|
sprite.material.sizeAttenuation = false;
|
|
947
985
|
sprite.scale.set(
|
|
948
|
-
|
|
949
|
-
|
|
986
|
+
scale3 * naturalWidth / divider,
|
|
987
|
+
scale3 * naturalHeight / divider,
|
|
950
988
|
1
|
|
951
989
|
);
|
|
952
990
|
this.getObject3d().add(sprite);
|
|
@@ -955,7 +993,7 @@ var Billboard = class extends BaseObject {
|
|
|
955
993
|
const position = layer.coordinateToVector3(coordinate, z);
|
|
956
994
|
_.set(this.properties, "default.position", position);
|
|
957
995
|
_.set(this.properties, "default.altitude", altitude);
|
|
958
|
-
_.set(this.properties, "default.scale",
|
|
996
|
+
_.set(this.properties, "default.scale", scale3);
|
|
959
997
|
this.getObject3d().position.copy(position);
|
|
960
998
|
}
|
|
961
999
|
setLineHeight(altitude) {
|
|
@@ -968,414 +1006,120 @@ var Billboard = class extends BaseObject {
|
|
|
968
1006
|
}
|
|
969
1007
|
};
|
|
970
1008
|
|
|
971
|
-
// src/IndoorMap/object3d/
|
|
972
|
-
import * as maptalks2 from "maptalks";
|
|
1009
|
+
// src/IndoorMap/object3d/SpriteMarker.ts
|
|
973
1010
|
import { BaseObject as BaseObject2 } from "maptalks.three";
|
|
974
|
-
import {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
fontWeight: 600,
|
|
990
|
-
margin: 0,
|
|
991
|
-
scaleMin: 0.5,
|
|
992
|
-
lineHeight: 1.05,
|
|
993
|
-
scaleStep: 0.05,
|
|
994
|
-
textAlign: "center",
|
|
995
|
-
textBaseline: "middle",
|
|
996
|
-
fillStyle: "#000"
|
|
1011
|
+
import { Sprite as Sprite2, SpriteMaterial as SpriteMaterial2 } from "three";
|
|
1012
|
+
import _2 from "lodash";
|
|
1013
|
+
var DEFAULT_SCALE = 0.05;
|
|
1014
|
+
var DEFAULT_ALTITUDE = 0;
|
|
1015
|
+
var DEFAULT_ALPHATEST = 0.3;
|
|
1016
|
+
var DEFAULT_OPTIONS = {
|
|
1017
|
+
scale: DEFAULT_SCALE,
|
|
1018
|
+
altitude: DEFAULT_ALTITUDE,
|
|
1019
|
+
alphaTest: DEFAULT_ALPHATEST,
|
|
1020
|
+
highlight: {
|
|
1021
|
+
options: {
|
|
1022
|
+
scale: DEFAULT_SCALE * 1.25
|
|
1023
|
+
},
|
|
1024
|
+
material: null
|
|
1025
|
+
}
|
|
997
1026
|
};
|
|
998
|
-
var
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
for (let i = 1; i < words.length; i++) {
|
|
1034
|
-
const lineToMeasure = currentLine + " " + words[i];
|
|
1035
|
-
if (ctx2.measureText(lineToMeasure).width > maxWidth) {
|
|
1036
|
-
lines.push(currentLine);
|
|
1037
|
-
currentLine = words[i];
|
|
1038
|
-
} else {
|
|
1039
|
-
currentLine = lineToMeasure;
|
|
1040
|
-
}
|
|
1027
|
+
var SpriteMarker = class extends BaseObject2 {
|
|
1028
|
+
#default = null;
|
|
1029
|
+
#highlight = null;
|
|
1030
|
+
constructor(coordinate, options, material, layer, properties) {
|
|
1031
|
+
super();
|
|
1032
|
+
this._initOptions(options);
|
|
1033
|
+
this._createGroup();
|
|
1034
|
+
const {
|
|
1035
|
+
altitude = DEFAULT_OPTIONS.altitude,
|
|
1036
|
+
scale: scale3 = DEFAULT_OPTIONS.scale,
|
|
1037
|
+
highlight = DEFAULT_OPTIONS.highlight,
|
|
1038
|
+
alphaTest = DEFAULT_OPTIONS.alphaTest
|
|
1039
|
+
} = options;
|
|
1040
|
+
this.properties = { ...properties };
|
|
1041
|
+
const modifiedAltitude = altitude + 2;
|
|
1042
|
+
this.#default = { options: { scale: scale3, altitude: modifiedAltitude }, material };
|
|
1043
|
+
this.#highlight = _2.merge({}, DEFAULT_OPTIONS.highlight, highlight);
|
|
1044
|
+
if (material && material instanceof SpriteMaterial2)
|
|
1045
|
+
material.alphaTest = alphaTest;
|
|
1046
|
+
const sprite = new Sprite2(material);
|
|
1047
|
+
sprite.scale.set(scale3, scale3, scale3);
|
|
1048
|
+
const obj3d = this.getObject3d();
|
|
1049
|
+
obj3d.add(sprite);
|
|
1050
|
+
const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
|
|
1051
|
+
const position = layer.coordinateToVector3(coordinate, z);
|
|
1052
|
+
_2.set(this.properties, "default.position", position);
|
|
1053
|
+
this.getObject3d().position.copy(position);
|
|
1054
|
+
}
|
|
1055
|
+
// Different objects need to implement their own methods
|
|
1056
|
+
setSymbol(material) {
|
|
1057
|
+
if (material && material instanceof SpriteMaterial2) {
|
|
1058
|
+
const sprite = this.getObject3d().children[0];
|
|
1059
|
+
if (!sprite) return this;
|
|
1060
|
+
sprite.material = material;
|
|
1061
|
+
sprite.material.needsUpdate = true;
|
|
1041
1062
|
}
|
|
1042
|
-
|
|
1043
|
-
return lines.slice(0, MAX_LINES);
|
|
1044
|
-
};
|
|
1045
|
-
const hasManualBreaks = text.includes("\n");
|
|
1046
|
-
let texts;
|
|
1047
|
-
if (hasManualBreaks) {
|
|
1048
|
-
texts = text.split(/\n/g);
|
|
1049
|
-
} else {
|
|
1050
|
-
const maxWidth = SIZE - 2 * margin;
|
|
1051
|
-
texts = wrapText(ctx, text, maxWidth);
|
|
1063
|
+
return this;
|
|
1052
1064
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
textWidth = max(texts.map((text2) => ctx.measureText(text2).width));
|
|
1065
|
+
setScale(scaleX, scaleY = scaleX, scaleZ = scaleX) {
|
|
1066
|
+
const sprite = this.getObject3d().children[0];
|
|
1067
|
+
if (!sprite) return this;
|
|
1068
|
+
sprite.scale.set(scaleX, scaleY, scaleZ);
|
|
1069
|
+
return this;
|
|
1059
1070
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
+
// Different objects need to implement their own methods
|
|
1072
|
+
getSymbol() {
|
|
1073
|
+
return this.getObject3d()?.children[0]?.material;
|
|
1074
|
+
}
|
|
1075
|
+
highlight() {
|
|
1076
|
+
const { material, options } = this.#highlight;
|
|
1077
|
+
if (material) this.setSymbol(material);
|
|
1078
|
+
if (options.scale) this.setScale(options.scale);
|
|
1079
|
+
if (options.altitude) this.setAltitude(options.altitude);
|
|
1080
|
+
return this;
|
|
1081
|
+
}
|
|
1082
|
+
removeHighlight() {
|
|
1083
|
+
const { material, options } = this.#default;
|
|
1084
|
+
if (material) this.setSymbol(material);
|
|
1085
|
+
if (options.scale) this.setScale(options.scale);
|
|
1086
|
+
if (options.altitude) this.setAltitude(options.altitude);
|
|
1087
|
+
return this;
|
|
1071
1088
|
}
|
|
1072
|
-
const texture = new Texture(canvas);
|
|
1073
|
-
texture.needsUpdate = true;
|
|
1074
|
-
const material = new MeshPhongMaterial({
|
|
1075
|
-
map: texture,
|
|
1076
|
-
transparent: true,
|
|
1077
|
-
// @ref: https://threejs.org/docs/#api/en/materials/Material.alphaTest
|
|
1078
|
-
alphaTest: 0.3
|
|
1079
|
-
});
|
|
1080
|
-
return material;
|
|
1081
1089
|
};
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1090
|
+
|
|
1091
|
+
// src/IndoorMap/object3d/NavigationPath.ts
|
|
1092
|
+
import * as maptalks2 from "maptalks";
|
|
1093
|
+
import { BaseObject as BaseObject3 } from "maptalks.three";
|
|
1094
|
+
import { MeshBasicMaterial, ShaderMaterial, Color } from "three";
|
|
1095
|
+
var OPTIONS2 = {
|
|
1096
|
+
altitude: 0
|
|
1097
|
+
};
|
|
1098
|
+
var DEFAULT_LINE_OPTION = {
|
|
1099
|
+
color: "#000",
|
|
1100
|
+
opacity: 1
|
|
1101
|
+
};
|
|
1102
|
+
var DEFAULT_LINE_EFFECT_OPTION = {
|
|
1103
|
+
color: "#000",
|
|
1104
|
+
opacity: 1
|
|
1105
|
+
};
|
|
1106
|
+
var ENABLE_ANIMATED_PATH = true;
|
|
1107
|
+
var NavigationPath = class extends BaseObject3 {
|
|
1108
|
+
constructor(feature2, layer, properties, options, lineOptions = DEFAULT_LINE_OPTION, outlineOption = DEFAULT_LINE_EFFECT_OPTION) {
|
|
1091
1109
|
options = maptalks2.Util.extend({}, OPTIONS2, options, {
|
|
1092
|
-
layer
|
|
1093
|
-
coordinate: bound
|
|
1110
|
+
layer
|
|
1094
1111
|
});
|
|
1095
|
-
const {
|
|
1096
|
-
altitude,
|
|
1097
|
-
text,
|
|
1098
|
-
fontSize,
|
|
1099
|
-
fillStyle,
|
|
1100
|
-
textAlign,
|
|
1101
|
-
fontFamily,
|
|
1102
|
-
textBaseline,
|
|
1103
|
-
strokeStyle,
|
|
1104
|
-
lineWidth,
|
|
1105
|
-
angle = defaultRectAngleToCalc,
|
|
1106
|
-
maxFontScale,
|
|
1107
|
-
offsetX = 0,
|
|
1108
|
-
offsetY = 0,
|
|
1109
|
-
...properties
|
|
1110
|
-
} = options;
|
|
1111
1112
|
super();
|
|
1112
1113
|
this._initOptions(options);
|
|
1113
|
-
|
|
1114
|
-
this
|
|
1115
|
-
this
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
fontFamily,
|
|
1123
|
-
strokeStyle,
|
|
1124
|
-
lineWidth
|
|
1125
|
-
});
|
|
1126
|
-
const rectAngles = isArray(angle) ? angle : [angle];
|
|
1127
|
-
material.needsUpdate = true;
|
|
1128
|
-
const rect = largestRect(bound, {
|
|
1129
|
-
cache: true,
|
|
1130
|
-
/**
|
|
1131
|
-
* Black magic here:
|
|
1132
|
-
* For some reason if we allow angle -90 or 90, some polygon will use that angle even if it's wrong angle to use.
|
|
1133
|
-
* So we remove -90 and 90 from choices, and use -85 & 85 instead.
|
|
1134
|
-
*/
|
|
1135
|
-
angle: rectAngles
|
|
1136
|
-
});
|
|
1137
|
-
const { cx, cy, width, angle: calculatedAngle } = rect;
|
|
1138
|
-
this.#text = text;
|
|
1139
|
-
this.#angle = calculatedAngle;
|
|
1140
|
-
const geometry = new PlaneGeometry(1, 1);
|
|
1141
|
-
this._createMesh(geometry, material);
|
|
1142
|
-
const z = layer.altitudeToVector3(altitude, altitude).x;
|
|
1143
|
-
const basePosition = layer.coordinateToVector3({ x: cx, y: cy }, z);
|
|
1144
|
-
this.#originalPosition = basePosition.clone();
|
|
1145
|
-
const finalPosition = this.#calculateFinalPosition(basePosition);
|
|
1146
|
-
const scale2 = width / 6456122659e-13;
|
|
1147
|
-
const finalScale = maxFontScale && scale2 > maxFontScale ? maxFontScale : scale2;
|
|
1148
|
-
this.getObject3d().scale.set(finalScale, finalScale, finalScale);
|
|
1149
|
-
this.getObject3d().position.copy(finalPosition);
|
|
1150
|
-
this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
|
|
1151
|
-
}
|
|
1152
|
-
#calculateFinalPosition(basePosition) {
|
|
1153
|
-
if (this.#offsetX === 0 && this.#offsetY === 0) {
|
|
1154
|
-
return basePosition;
|
|
1155
|
-
}
|
|
1156
|
-
const offsetCoordinate = {
|
|
1157
|
-
x: this.#offsetX,
|
|
1158
|
-
y: this.#offsetY
|
|
1159
|
-
};
|
|
1160
|
-
const z = this.#layer.altitudeToVector3(0, 0).x;
|
|
1161
|
-
const offsetVector = this.#layer.coordinateToVector3(offsetCoordinate, z);
|
|
1162
|
-
const zeroVector = this.#layer.coordinateToVector3({ x: 0, y: 0 }, z);
|
|
1163
|
-
const worldOffsetX = offsetVector.x - zeroVector.x;
|
|
1164
|
-
const worldOffsetY = offsetVector.y - zeroVector.y;
|
|
1165
|
-
return {
|
|
1166
|
-
x: basePosition.x + worldOffsetX,
|
|
1167
|
-
y: basePosition.y + worldOffsetY,
|
|
1168
|
-
z: basePosition.z
|
|
1169
|
-
};
|
|
1170
|
-
}
|
|
1171
|
-
#updatePosition() {
|
|
1172
|
-
if (this.#originalPosition && this.#layer) {
|
|
1173
|
-
const finalPosition = this.#calculateFinalPosition(this.#originalPosition);
|
|
1174
|
-
this.getObject3d().position.copy(finalPosition);
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
set bearing(value) {
|
|
1178
|
-
this.#bearing = value;
|
|
1179
|
-
const degree = this.#angle + this.#bearing;
|
|
1180
|
-
const angle = degree > 90 || degree < -90 ? this.#angle + 180 : this.#angle;
|
|
1181
|
-
this.getObject3d().rotation.z = Math.PI / 180 * angle;
|
|
1182
|
-
}
|
|
1183
|
-
get angle() {
|
|
1184
|
-
return this.#angle;
|
|
1185
|
-
}
|
|
1186
|
-
get currentAngle() {
|
|
1187
|
-
return this.#angle;
|
|
1188
|
-
}
|
|
1189
|
-
get text() {
|
|
1190
|
-
return this.#text;
|
|
1191
|
-
}
|
|
1192
|
-
get offsetX() {
|
|
1193
|
-
return this.#offsetX;
|
|
1194
|
-
}
|
|
1195
|
-
get offsetY() {
|
|
1196
|
-
return this.#offsetY;
|
|
1197
|
-
}
|
|
1198
|
-
get offset() {
|
|
1199
|
-
return { x: this.#offsetX, y: this.#offsetY };
|
|
1200
|
-
}
|
|
1201
|
-
set offsetX(value) {
|
|
1202
|
-
if (isNumber2(value)) {
|
|
1203
|
-
this.#offsetX = value;
|
|
1204
|
-
this.#updatePosition();
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
set offsetY(value) {
|
|
1208
|
-
if (isNumber2(value)) {
|
|
1209
|
-
this.#offsetY = value;
|
|
1210
|
-
this.#updatePosition();
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
set angle(newAngle) {
|
|
1214
|
-
if (isNumber2(newAngle)) {
|
|
1215
|
-
this.#angle = newAngle;
|
|
1216
|
-
this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
setOffset(offsetX, offsetY) {
|
|
1220
|
-
if (isNumber2(offsetX) && isNumber2(offsetY)) {
|
|
1221
|
-
this.#offsetX = offsetX;
|
|
1222
|
-
this.#offsetY = offsetY;
|
|
1223
|
-
this.#updatePosition();
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
addOffset(deltaX, deltaY) {
|
|
1227
|
-
if (isNumber2(deltaX) && isNumber2(deltaY)) {
|
|
1228
|
-
this.#offsetX += deltaX;
|
|
1229
|
-
this.#offsetY += deltaY;
|
|
1230
|
-
this.#updatePosition();
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
resetOffset() {
|
|
1234
|
-
this.#offsetX = 0;
|
|
1235
|
-
this.#offsetY = 0;
|
|
1236
|
-
this.#updatePosition();
|
|
1237
|
-
}
|
|
1238
|
-
moveToPosition(targetX, targetY) {
|
|
1239
|
-
if (this.#originalPosition && this.#layer) {
|
|
1240
|
-
const currentCenter = this.#layer.vector3ToCoordinate(
|
|
1241
|
-
this.#originalPosition
|
|
1242
|
-
);
|
|
1243
|
-
this.#offsetX = targetX - currentCenter.x;
|
|
1244
|
-
this.#offsetY = targetY - currentCenter.y;
|
|
1245
|
-
this.#updatePosition();
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
updateText(newText, options = {}) {
|
|
1249
|
-
this.#text = newText;
|
|
1250
|
-
const materialOptions = {
|
|
1251
|
-
fillStyle: options.fillStyle || this.properties.fillStyle,
|
|
1252
|
-
fontSize: options.fontSize || this.properties.fontSize,
|
|
1253
|
-
textAlign: options.textAlign || this.properties.textAlign,
|
|
1254
|
-
textBaseline: options.textBaseline || this.properties.textBaseline,
|
|
1255
|
-
fontFamily: options.fontFamily || this.properties.fontFamily,
|
|
1256
|
-
strokeStyle: options.strokeStyle || this.properties.strokeStyle,
|
|
1257
|
-
lineWidth: options.lineWidth || this.properties.lineWidth
|
|
1258
|
-
};
|
|
1259
|
-
const newMaterial = getMaterial(newText, materialOptions);
|
|
1260
|
-
this.getObject3d().material = newMaterial;
|
|
1261
|
-
newMaterial.needsUpdate = true;
|
|
1262
|
-
}
|
|
1263
|
-
};
|
|
1264
|
-
|
|
1265
|
-
// src/IndoorMap/object3d/SpriteMarker.ts
|
|
1266
|
-
import { BaseObject as BaseObject3 } from "maptalks.three";
|
|
1267
|
-
import { Sprite as Sprite2, SpriteMaterial as SpriteMaterial2 } from "three";
|
|
1268
|
-
import _2 from "lodash";
|
|
1269
|
-
var DEFAULT_SCALE = 0.05;
|
|
1270
|
-
var DEFAULT_ALTITUDE = 0;
|
|
1271
|
-
var DEFAULT_ALPHATEST = 0.3;
|
|
1272
|
-
var DEFAULT_OPTIONS = {
|
|
1273
|
-
scale: DEFAULT_SCALE,
|
|
1274
|
-
altitude: DEFAULT_ALTITUDE,
|
|
1275
|
-
alphaTest: DEFAULT_ALPHATEST,
|
|
1276
|
-
highlight: {
|
|
1277
|
-
options: {
|
|
1278
|
-
scale: DEFAULT_SCALE * 1.25
|
|
1279
|
-
},
|
|
1280
|
-
material: null
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
var SpriteMarker = class extends BaseObject3 {
|
|
1284
|
-
#default = null;
|
|
1285
|
-
#highlight = null;
|
|
1286
|
-
constructor(coordinate, options, material, layer, properties) {
|
|
1287
|
-
super();
|
|
1288
|
-
this._initOptions(options);
|
|
1289
|
-
this._createGroup();
|
|
1290
|
-
const {
|
|
1291
|
-
altitude = DEFAULT_OPTIONS.altitude,
|
|
1292
|
-
scale: scale2 = DEFAULT_OPTIONS.scale,
|
|
1293
|
-
highlight = DEFAULT_OPTIONS.highlight,
|
|
1294
|
-
alphaTest = DEFAULT_OPTIONS.alphaTest
|
|
1295
|
-
} = options;
|
|
1296
|
-
this.properties = { ...properties };
|
|
1297
|
-
const modifiedAltitude = altitude + 2;
|
|
1298
|
-
this.#default = { options: { scale: scale2, altitude: modifiedAltitude }, material };
|
|
1299
|
-
this.#highlight = _2.merge({}, DEFAULT_OPTIONS.highlight, highlight);
|
|
1300
|
-
if (material && material instanceof SpriteMaterial2)
|
|
1301
|
-
material.alphaTest = alphaTest;
|
|
1302
|
-
const sprite = new Sprite2(material);
|
|
1303
|
-
sprite.scale.set(scale2, scale2, scale2);
|
|
1304
|
-
const obj3d = this.getObject3d();
|
|
1305
|
-
obj3d.add(sprite);
|
|
1306
|
-
const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
|
|
1307
|
-
const position = layer.coordinateToVector3(coordinate, z);
|
|
1308
|
-
_2.set(this.properties, "default.position", position);
|
|
1309
|
-
this.getObject3d().position.copy(position);
|
|
1310
|
-
}
|
|
1311
|
-
// Different objects need to implement their own methods
|
|
1312
|
-
setSymbol(material) {
|
|
1313
|
-
if (material && material instanceof SpriteMaterial2) {
|
|
1314
|
-
const sprite = this.getObject3d().children[0];
|
|
1315
|
-
if (!sprite) return this;
|
|
1316
|
-
sprite.material = material;
|
|
1317
|
-
sprite.material.needsUpdate = true;
|
|
1318
|
-
}
|
|
1319
|
-
return this;
|
|
1320
|
-
}
|
|
1321
|
-
setScale(scaleX, scaleY = scaleX, scaleZ = scaleX) {
|
|
1322
|
-
const sprite = this.getObject3d().children[0];
|
|
1323
|
-
if (!sprite) return this;
|
|
1324
|
-
sprite.scale.set(scaleX, scaleY, scaleZ);
|
|
1325
|
-
return this;
|
|
1326
|
-
}
|
|
1327
|
-
// Different objects need to implement their own methods
|
|
1328
|
-
getSymbol() {
|
|
1329
|
-
return this.getObject3d()?.children[0]?.material;
|
|
1330
|
-
}
|
|
1331
|
-
highlight() {
|
|
1332
|
-
const { material, options } = this.#highlight;
|
|
1333
|
-
if (material) this.setSymbol(material);
|
|
1334
|
-
if (options.scale) this.setScale(options.scale);
|
|
1335
|
-
if (options.altitude) this.setAltitude(options.altitude);
|
|
1336
|
-
return this;
|
|
1337
|
-
}
|
|
1338
|
-
removeHighlight() {
|
|
1339
|
-
const { material, options } = this.#default;
|
|
1340
|
-
if (material) this.setSymbol(material);
|
|
1341
|
-
if (options.scale) this.setScale(options.scale);
|
|
1342
|
-
if (options.altitude) this.setAltitude(options.altitude);
|
|
1343
|
-
return this;
|
|
1344
|
-
}
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
|
-
// src/IndoorMap/object3d/NavigationPath.ts
|
|
1348
|
-
import * as maptalks3 from "maptalks";
|
|
1349
|
-
import { BaseObject as BaseObject4 } from "maptalks.three";
|
|
1350
|
-
import { MeshBasicMaterial, ShaderMaterial, Color } from "three";
|
|
1351
|
-
var OPTIONS3 = {
|
|
1352
|
-
altitude: 0
|
|
1353
|
-
};
|
|
1354
|
-
var DEFAULT_LINE_OPTION = {
|
|
1355
|
-
color: "#000",
|
|
1356
|
-
opacity: 1
|
|
1357
|
-
};
|
|
1358
|
-
var DEFAULT_LINE_EFFECT_OPTION = {
|
|
1359
|
-
color: "#000",
|
|
1360
|
-
opacity: 1
|
|
1361
|
-
};
|
|
1362
|
-
var ENABLE_ANIMATED_PATH = true;
|
|
1363
|
-
var NavigationPath = class extends BaseObject4 {
|
|
1364
|
-
constructor(feature2, layer, properties, options, lineOptions = DEFAULT_LINE_OPTION, outlineOption = DEFAULT_LINE_EFFECT_OPTION) {
|
|
1365
|
-
options = maptalks3.Util.extend({}, OPTIONS3, options, {
|
|
1366
|
-
layer
|
|
1367
|
-
});
|
|
1368
|
-
super();
|
|
1369
|
-
this._initOptions(options);
|
|
1370
|
-
const { altitude = OPTIONS3.altitude } = options;
|
|
1371
|
-
this.properties = { ...properties };
|
|
1372
|
-
this._createGroup();
|
|
1373
|
-
const { color: lineColor, opacity: lineOpacity } = lineOptions || DEFAULT_LINE_OPTION;
|
|
1374
|
-
const staticMaterial = new MeshBasicMaterial({
|
|
1375
|
-
transparent: true,
|
|
1376
|
-
color: lineColor || "#fff",
|
|
1377
|
-
opacity: lineOpacity || 1,
|
|
1378
|
-
depthWrite: false
|
|
1114
|
+
const { altitude = OPTIONS2.altitude } = options;
|
|
1115
|
+
this.properties = { ...properties };
|
|
1116
|
+
this._createGroup();
|
|
1117
|
+
const { color: lineColor, opacity: lineOpacity } = lineOptions || DEFAULT_LINE_OPTION;
|
|
1118
|
+
const staticMaterial = new MeshBasicMaterial({
|
|
1119
|
+
transparent: true,
|
|
1120
|
+
color: lineColor || "#fff",
|
|
1121
|
+
opacity: lineOpacity || 1,
|
|
1122
|
+
depthWrite: false
|
|
1379
1123
|
});
|
|
1380
1124
|
const uniforms = {
|
|
1381
1125
|
time: { value: 0 },
|
|
@@ -1407,7 +1151,7 @@ var NavigationPath = class extends BaseObject4 {
|
|
|
1407
1151
|
}
|
|
1408
1152
|
`
|
|
1409
1153
|
});
|
|
1410
|
-
const pathGeometry =
|
|
1154
|
+
const pathGeometry = maptalks2.GeoJSON.toGeometry(feature2);
|
|
1411
1155
|
const line = layer.toPath(
|
|
1412
1156
|
pathGeometry,
|
|
1413
1157
|
{
|
|
@@ -1465,8 +1209,8 @@ var createPolygonFromLineString = (geometry) => {
|
|
|
1465
1209
|
const right = turfLineOffset(line, -0.3, { units: "meters" });
|
|
1466
1210
|
const leftCoords = left.geometry.coordinates;
|
|
1467
1211
|
const rightCoords = right.geometry.coordinates.reverse();
|
|
1468
|
-
const
|
|
1469
|
-
return [
|
|
1212
|
+
const polygon2 = [...leftCoords, ...rightCoords, leftCoords[0]];
|
|
1213
|
+
return [polygon2];
|
|
1470
1214
|
};
|
|
1471
1215
|
|
|
1472
1216
|
// src/IndoorMap/utils/svg.ts
|
|
@@ -1500,8 +1244,8 @@ var createSVGPathFromMarkerSymbol = (style) => {
|
|
|
1500
1244
|
markerFill,
|
|
1501
1245
|
markerPath
|
|
1502
1246
|
} = style;
|
|
1503
|
-
const
|
|
1504
|
-
return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${
|
|
1247
|
+
const scale3 = markerWidth / 24;
|
|
1248
|
+
return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale3})" fill="${markerFill}"/>`;
|
|
1505
1249
|
};
|
|
1506
1250
|
|
|
1507
1251
|
// src/IndoorMap/utils/createElements.js
|
|
@@ -1642,8 +1386,8 @@ var createObstructionalFixture = (feature2, style = {}, options = {}) => {
|
|
|
1642
1386
|
if (allowOverride) _4.merge(symbolStyle, properties.style);
|
|
1643
1387
|
if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
|
|
1644
1388
|
if (geometry.type === "LineString") {
|
|
1645
|
-
const
|
|
1646
|
-
return new GeometryType["Polygon"](
|
|
1389
|
+
const polygon2 = createPolygonFromLineString(geometry);
|
|
1390
|
+
return new GeometryType["Polygon"](polygon2, {
|
|
1647
1391
|
properties: {
|
|
1648
1392
|
altitude: getAltitude(properties)
|
|
1649
1393
|
},
|
|
@@ -2498,68 +2242,12 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2498
2242
|
}
|
|
2499
2243
|
return objects;
|
|
2500
2244
|
},
|
|
2501
|
-
create3DGroundLabel: (label, threeLayer) => {
|
|
2502
|
-
const text = label.properties.name;
|
|
2503
|
-
const bound = label.geometry.coordinates[0];
|
|
2504
|
-
if (_4.isNil(bound)) throw new Error("Invalid coordinates");
|
|
2505
|
-
const groundLabelSymbol = getElementSymbol("ground-label");
|
|
2506
|
-
const featureSymbol = _4.get(label, "properties", {});
|
|
2507
|
-
const groundLabelOptions = _4.merge(
|
|
2508
|
-
{},
|
|
2509
|
-
{ text },
|
|
2510
|
-
groundLabelSymbol,
|
|
2511
|
-
featureSymbol
|
|
2512
|
-
);
|
|
2513
|
-
return new GroundLabel(bound, groundLabelOptions, threeLayer);
|
|
2514
|
-
},
|
|
2515
|
-
createOccupantGroundLabel: (feature2, location, mapConfig, threeLayer) => {
|
|
2516
|
-
const text = feature2.properties.name.en;
|
|
2517
|
-
const bound = location.geometry.coordinates[0];
|
|
2518
|
-
if (_4.isNil(bound)) throw new Error("Invalid coordinates");
|
|
2519
|
-
const groundLabelSymbol = getElementSymbol("occupant-flat-label");
|
|
2520
|
-
const groundLabelOptions = getElementOptions("occupant-flat-label");
|
|
2521
|
-
const baseAltitude = getAltitude(location.properties);
|
|
2522
|
-
const extrudeHeight = _4.get(
|
|
2523
|
-
mapConfig,
|
|
2524
|
-
"extrudeConfig.unit.room.height",
|
|
2525
|
-
0
|
|
2526
|
-
);
|
|
2527
|
-
const totalAltitude = baseAltitude + extrudeHeight + 0.05;
|
|
2528
|
-
const customAngle = _4.get(feature2, "properties.style.angle");
|
|
2529
|
-
const offsetX = _4.get(feature2, "properties.style.offsetX", 0);
|
|
2530
|
-
const offsetY = _4.get(feature2, "properties.style.offsetY", 0);
|
|
2531
|
-
const featureSymbol = {
|
|
2532
|
-
name: text,
|
|
2533
|
-
ordinal: location.properties.ordinal,
|
|
2534
|
-
venue_id: feature2.properties.venue_id
|
|
2535
|
-
};
|
|
2536
|
-
const mergedGroundLabelOptions = _4.merge(
|
|
2537
|
-
{},
|
|
2538
|
-
{ text },
|
|
2539
|
-
groundLabelSymbol,
|
|
2540
|
-
groundLabelOptions,
|
|
2541
|
-
featureSymbol,
|
|
2542
|
-
{
|
|
2543
|
-
altitude: totalAltitude,
|
|
2544
|
-
offsetX,
|
|
2545
|
-
offsetY,
|
|
2546
|
-
// set custom angle
|
|
2547
|
-
...!_4.isNil(customAngle) ? { angle: customAngle } : {}
|
|
2548
|
-
}
|
|
2549
|
-
);
|
|
2550
|
-
const groundLabel = new GroundLabel(
|
|
2551
|
-
bound,
|
|
2552
|
-
mergedGroundLabelOptions,
|
|
2553
|
-
threeLayer
|
|
2554
|
-
);
|
|
2555
|
-
return groundLabel;
|
|
2556
|
-
},
|
|
2557
2245
|
create3DBillboard: (billboard, threeLayer) => {
|
|
2558
2246
|
const { id, feature_type, properties } = billboard;
|
|
2559
2247
|
const {
|
|
2560
2248
|
logo,
|
|
2561
2249
|
altitude,
|
|
2562
|
-
scale:
|
|
2250
|
+
scale: scale3,
|
|
2563
2251
|
alphaTest,
|
|
2564
2252
|
legColor,
|
|
2565
2253
|
showLeg,
|
|
@@ -2573,7 +2261,7 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2573
2261
|
};
|
|
2574
2262
|
const options = {
|
|
2575
2263
|
altitude,
|
|
2576
|
-
scale:
|
|
2264
|
+
scale: scale3,
|
|
2577
2265
|
alphaTest,
|
|
2578
2266
|
legColor,
|
|
2579
2267
|
showLeg,
|
|
@@ -2712,10 +2400,10 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2712
2400
|
transparent: true
|
|
2713
2401
|
});
|
|
2714
2402
|
if (unit.geometry.type === "LineString") {
|
|
2715
|
-
const
|
|
2403
|
+
const polygon2 = createPolygonFromLineString(unit.geometry);
|
|
2716
2404
|
const geometry = {
|
|
2717
2405
|
type: "Polygon",
|
|
2718
|
-
coordinates:
|
|
2406
|
+
coordinates: polygon2
|
|
2719
2407
|
};
|
|
2720
2408
|
return createExtrudePolygon(
|
|
2721
2409
|
geometry,
|
|
@@ -2817,9 +2505,9 @@ var getRelatedLocationsByAmenity = (feature2) => {
|
|
|
2817
2505
|
var getRelatedLocationIdsByFeature = (feature2) => {
|
|
2818
2506
|
switch (feature2?.feature_type) {
|
|
2819
2507
|
case "amenity":
|
|
2820
|
-
return getRelatedLocationsByAmenity(feature2).map((
|
|
2508
|
+
return getRelatedLocationsByAmenity(feature2).map((v2) => v2?.id);
|
|
2821
2509
|
case "occupant":
|
|
2822
|
-
return getRelatedLocationsByOccupant(feature2).map((
|
|
2510
|
+
return getRelatedLocationsByOccupant(feature2).map((v2) => v2?.id);
|
|
2823
2511
|
default:
|
|
2824
2512
|
return [];
|
|
2825
2513
|
}
|
|
@@ -2963,120 +2651,429 @@ function coordEach(geojson, callback, excludeWrapCoord) {
|
|
|
2963
2651
|
}
|
|
2964
2652
|
}
|
|
2965
2653
|
}
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
2969
|
-
function bbox(geojson, options = {}) {
|
|
2970
|
-
if (geojson.bbox != null && true !== options.recompute) {
|
|
2971
|
-
return geojson.bbox;
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
2657
|
+
function bbox(geojson, options = {}) {
|
|
2658
|
+
if (geojson.bbox != null && true !== options.recompute) {
|
|
2659
|
+
return geojson.bbox;
|
|
2660
|
+
}
|
|
2661
|
+
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
2662
|
+
coordEach(geojson, (coord) => {
|
|
2663
|
+
if (result[0] > coord[0]) {
|
|
2664
|
+
result[0] = coord[0];
|
|
2665
|
+
}
|
|
2666
|
+
if (result[1] > coord[1]) {
|
|
2667
|
+
result[1] = coord[1];
|
|
2668
|
+
}
|
|
2669
|
+
if (result[2] < coord[0]) {
|
|
2670
|
+
result[2] = coord[0];
|
|
2671
|
+
}
|
|
2672
|
+
if (result[3] < coord[1]) {
|
|
2673
|
+
result[3] = coord[1];
|
|
2674
|
+
}
|
|
2675
|
+
});
|
|
2676
|
+
return result;
|
|
2677
|
+
}
|
|
2678
|
+
var index_default = bbox;
|
|
2679
|
+
|
|
2680
|
+
// src/IndoorMap/camera/CameraManager.ts
|
|
2681
|
+
import scale from "@turf/transform-scale";
|
|
2682
|
+
import bboxPolygon from "@turf/bbox-polygon";
|
|
2683
|
+
var CameraManager = class {
|
|
2684
|
+
map;
|
|
2685
|
+
constructor(map, options) {
|
|
2686
|
+
this.map = map;
|
|
2687
|
+
if (options?.defaultView) {
|
|
2688
|
+
this.setView(options?.defaultView);
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
/** Public methods */
|
|
2692
|
+
getView = () => {
|
|
2693
|
+
return this.map.getView();
|
|
2694
|
+
};
|
|
2695
|
+
setView = (value) => {
|
|
2696
|
+
if (this.map && Object.keys(value).length !== 0) {
|
|
2697
|
+
this.map.setView(value);
|
|
2698
|
+
}
|
|
2699
|
+
};
|
|
2700
|
+
animateTo = (view, options = {}, step) => {
|
|
2701
|
+
this.map.animateTo(view, options, step);
|
|
2702
|
+
};
|
|
2703
|
+
setMaxExtent(extent) {
|
|
2704
|
+
return this.map.setMaxExtent(extent);
|
|
2705
|
+
}
|
|
2706
|
+
getFeatureExtent = (feature2, scaleFactor = 1) => {
|
|
2707
|
+
const [minX, minY, maxX, maxY] = index_default(
|
|
2708
|
+
scale(bboxPolygon(index_default(feature2)), scaleFactor)
|
|
2709
|
+
);
|
|
2710
|
+
return new Extent(minX, minY, maxX, maxY);
|
|
2711
|
+
};
|
|
2712
|
+
getExtentZoom = (extent, options = {
|
|
2713
|
+
isFraction: false,
|
|
2714
|
+
padding: {
|
|
2715
|
+
paddingLeft: 0,
|
|
2716
|
+
paddingRight: 0,
|
|
2717
|
+
paddingTop: 0,
|
|
2718
|
+
paddingBottom: 0
|
|
2719
|
+
}
|
|
2720
|
+
}) => {
|
|
2721
|
+
const { isFraction = false, padding } = options;
|
|
2722
|
+
return this.map.getFitZoom(extent, isFraction, padding);
|
|
2723
|
+
};
|
|
2724
|
+
set maxZoom(value) {
|
|
2725
|
+
this.map.setMaxZoom(value);
|
|
2726
|
+
const spatialReference = {
|
|
2727
|
+
projection: "EPSG:3857",
|
|
2728
|
+
resolutions: (function() {
|
|
2729
|
+
const resolutions = [];
|
|
2730
|
+
const d = 2 * 6378137 * Math.PI;
|
|
2731
|
+
for (let i = 0; i < value; i++) {
|
|
2732
|
+
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
2733
|
+
}
|
|
2734
|
+
return resolutions;
|
|
2735
|
+
})()
|
|
2736
|
+
};
|
|
2737
|
+
this.map.setSpatialReference(spatialReference);
|
|
2738
|
+
}
|
|
2739
|
+
set minZoom(value) {
|
|
2740
|
+
this.map.setMinZoom(value);
|
|
2741
|
+
}
|
|
2742
|
+
};
|
|
2743
|
+
|
|
2744
|
+
// src/IndoorMap/renderer/RendererManager.ts
|
|
2745
|
+
import _compact2 from "lodash/compact";
|
|
2746
|
+
import _isFunction from "lodash/isFunction";
|
|
2747
|
+
import _min from "lodash/min";
|
|
2748
|
+
import { center as turfCenter2 } from "@turf/center";
|
|
2749
|
+
import * as THREE3 from "three";
|
|
2750
|
+
|
|
2751
|
+
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
2752
|
+
import * as maptalks4 from "maptalks-gl";
|
|
2753
|
+
import * as THREE from "three";
|
|
2754
|
+
import { BaseObject as BaseObject5 } from "maptalks.three";
|
|
2755
|
+
import turfBuffer2 from "@turf/buffer";
|
|
2756
|
+
import { cleanCoords } from "@turf/clean-coords";
|
|
2757
|
+
import { polygonToLine } from "@turf/polygon-to-line";
|
|
2758
|
+
import { nearestPointOnLine } from "@turf/nearest-point-on-line";
|
|
2759
|
+
import { length } from "@turf/length";
|
|
2760
|
+
import { along } from "@turf/along";
|
|
2761
|
+
import { pointToLineDistance } from "@turf/point-to-line-distance";
|
|
2762
|
+
|
|
2763
|
+
// src/IndoorMap/renderer/3d/objects/GroundLabel.ts
|
|
2764
|
+
import * as maptalks3 from "maptalks-gl";
|
|
2765
|
+
import { BaseObject as BaseObject4 } from "maptalks.three";
|
|
2766
|
+
import {
|
|
2767
|
+
Texture,
|
|
2768
|
+
MeshPhongMaterial,
|
|
2769
|
+
PlaneGeometry
|
|
2770
|
+
} from "three";
|
|
2771
|
+
import { largestRect } from "d3plus-shape";
|
|
2772
|
+
import { max, merge, isNumber as isNumber2, isArray, range } from "lodash-es";
|
|
2773
|
+
var OPTIONS3 = {
|
|
2774
|
+
// Allowing click through and prevent interaction
|
|
2775
|
+
interactive: false,
|
|
2776
|
+
altitude: 0
|
|
2777
|
+
};
|
|
2778
|
+
var defaultFlatLabelOptions = {
|
|
2779
|
+
fontSize: 14,
|
|
2780
|
+
fontFamily: "Manrope",
|
|
2781
|
+
fontWeight: 600,
|
|
2782
|
+
margin: 0,
|
|
2783
|
+
scaleMin: 0.5,
|
|
2784
|
+
lineHeight: 1.05,
|
|
2785
|
+
scaleStep: 0.05,
|
|
2786
|
+
textAlign: "center",
|
|
2787
|
+
textBaseline: "middle",
|
|
2788
|
+
fillStyle: "#000"
|
|
2789
|
+
};
|
|
2790
|
+
var defaultRectAngleToCalc = range(-90, 92, 2);
|
|
2791
|
+
var getMaterial = (text, flatLabelOptions) => {
|
|
2792
|
+
const options = merge({}, defaultFlatLabelOptions, flatLabelOptions);
|
|
2793
|
+
const {
|
|
2794
|
+
fontSize: initialFontSize,
|
|
2795
|
+
fontFamily,
|
|
2796
|
+
fontWeight,
|
|
2797
|
+
margin,
|
|
2798
|
+
scaleMin,
|
|
2799
|
+
scaleStep,
|
|
2800
|
+
fillStyle,
|
|
2801
|
+
lineHeight,
|
|
2802
|
+
textAlign,
|
|
2803
|
+
strokeStyle,
|
|
2804
|
+
lineWidth,
|
|
2805
|
+
textBaseline
|
|
2806
|
+
} = options;
|
|
2807
|
+
const pixelMultiplier = 4;
|
|
2808
|
+
const SIZE = 100 * pixelMultiplier;
|
|
2809
|
+
const fontSize = initialFontSize * (pixelMultiplier * 1.25);
|
|
2810
|
+
const canvas = document.createElement("canvas");
|
|
2811
|
+
canvas.width = canvas.height = SIZE;
|
|
2812
|
+
const ctx = canvas.getContext("2d");
|
|
2813
|
+
ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", Arial`;
|
|
2814
|
+
ctx.textAlign = textAlign;
|
|
2815
|
+
ctx.textBaseline = textBaseline;
|
|
2816
|
+
ctx.fillStyle = fillStyle;
|
|
2817
|
+
ctx.strokeStyle = strokeStyle;
|
|
2818
|
+
ctx.lineWidth = lineWidth;
|
|
2819
|
+
const wrapText = (ctx2, text2, maxWidth) => {
|
|
2820
|
+
const words = text2.trim().split(/\s+/);
|
|
2821
|
+
if (words.length <= 1) return [text2];
|
|
2822
|
+
const lines = [];
|
|
2823
|
+
const MAX_LINES = 3;
|
|
2824
|
+
let currentLine = words[0];
|
|
2825
|
+
for (let i = 1; i < words.length; i++) {
|
|
2826
|
+
const lineToMeasure = currentLine + " " + words[i];
|
|
2827
|
+
if (ctx2.measureText(lineToMeasure).width > maxWidth) {
|
|
2828
|
+
lines.push(currentLine);
|
|
2829
|
+
currentLine = words[i];
|
|
2830
|
+
} else {
|
|
2831
|
+
currentLine = lineToMeasure;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
lines.push(currentLine);
|
|
2835
|
+
return lines.slice(0, MAX_LINES);
|
|
2836
|
+
};
|
|
2837
|
+
const hasManualBreaks = text.includes("\n");
|
|
2838
|
+
let texts;
|
|
2839
|
+
if (hasManualBreaks) {
|
|
2840
|
+
texts = text.split(/\n/g);
|
|
2841
|
+
} else {
|
|
2842
|
+
const maxWidth = SIZE - 2 * margin;
|
|
2843
|
+
texts = wrapText(ctx, text, maxWidth);
|
|
2844
|
+
}
|
|
2845
|
+
let textWidth = max(texts.map((text2) => ctx.measureText(text2).width));
|
|
2846
|
+
let scale3 = 1;
|
|
2847
|
+
while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
|
|
2848
|
+
scale3 -= scaleStep;
|
|
2849
|
+
ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
|
|
2850
|
+
textWidth = max(texts.map((text2) => ctx.measureText(text2).width));
|
|
2851
|
+
}
|
|
2852
|
+
const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
|
|
2853
|
+
if (scale3 > scaleMin) {
|
|
2854
|
+
const totalHeight = texts.length * (fontSize * scale3 * lineHeight);
|
|
2855
|
+
const startY = center2.y - totalHeight / 2 + fontSize * scale3 * lineHeight * 0.5;
|
|
2856
|
+
texts.forEach((text2, index) => {
|
|
2857
|
+
const yOffset = startY + index * (fontSize * scale3 * lineHeight);
|
|
2858
|
+
if (strokeStyle && lineWidth) {
|
|
2859
|
+
ctx.strokeText(text2, center2.x, yOffset);
|
|
2860
|
+
}
|
|
2861
|
+
ctx.fillText(text2, center2.x, yOffset);
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
const texture = new Texture(canvas);
|
|
2865
|
+
texture.needsUpdate = true;
|
|
2866
|
+
const material = new MeshPhongMaterial({
|
|
2867
|
+
map: texture,
|
|
2868
|
+
transparent: true,
|
|
2869
|
+
// @ref: https://threejs.org/docs/#api/en/materials/Material.alphaTest
|
|
2870
|
+
alphaTest: 0.3
|
|
2871
|
+
});
|
|
2872
|
+
return material;
|
|
2873
|
+
};
|
|
2874
|
+
var GroundLabel = class extends BaseObject4 {
|
|
2875
|
+
#angle = 0;
|
|
2876
|
+
#bearing = 0;
|
|
2877
|
+
#text = "";
|
|
2878
|
+
#offsetX = 0;
|
|
2879
|
+
#offsetY = 0;
|
|
2880
|
+
#originalPosition = null;
|
|
2881
|
+
#layer = null;
|
|
2882
|
+
constructor(bound, text, options, layer) {
|
|
2883
|
+
options = maptalks3.Util.extend({}, OPTIONS3, options, {
|
|
2884
|
+
layer,
|
|
2885
|
+
coordinate: bound
|
|
2886
|
+
});
|
|
2887
|
+
const {
|
|
2888
|
+
altitude = 0,
|
|
2889
|
+
bottomHeight = 0,
|
|
2890
|
+
fontSize,
|
|
2891
|
+
fillStyle,
|
|
2892
|
+
textAlign,
|
|
2893
|
+
fontFamily,
|
|
2894
|
+
textBaseline,
|
|
2895
|
+
strokeStyle,
|
|
2896
|
+
lineWidth,
|
|
2897
|
+
angle = defaultRectAngleToCalc,
|
|
2898
|
+
maxFontScale,
|
|
2899
|
+
offsetX = 0,
|
|
2900
|
+
offsetY = 0,
|
|
2901
|
+
...properties
|
|
2902
|
+
} = options;
|
|
2903
|
+
super();
|
|
2904
|
+
this._initOptions(options);
|
|
2905
|
+
this.properties = properties;
|
|
2906
|
+
this.#offsetX = offsetX;
|
|
2907
|
+
this.#offsetY = offsetY;
|
|
2908
|
+
this.#layer = layer;
|
|
2909
|
+
const material = getMaterial(text, {
|
|
2910
|
+
fillStyle,
|
|
2911
|
+
fontSize,
|
|
2912
|
+
textAlign,
|
|
2913
|
+
textBaseline,
|
|
2914
|
+
fontFamily,
|
|
2915
|
+
strokeStyle,
|
|
2916
|
+
lineWidth
|
|
2917
|
+
});
|
|
2918
|
+
const rectAngles = isArray(angle) ? angle : [angle];
|
|
2919
|
+
material.needsUpdate = true;
|
|
2920
|
+
const rect = largestRect(bound, {
|
|
2921
|
+
cache: true,
|
|
2922
|
+
/**
|
|
2923
|
+
* Black magic here:
|
|
2924
|
+
* For some reason if we allow angle -90 or 90, some polygon will use that angle even if it's wrong angle to use.
|
|
2925
|
+
* So we remove -90 and 90 from choices, and use -85 & 85 instead.
|
|
2926
|
+
*/
|
|
2927
|
+
angle: rectAngles
|
|
2928
|
+
});
|
|
2929
|
+
const { cx, cy, width, angle: calculatedAngle } = rect;
|
|
2930
|
+
this.#text = text;
|
|
2931
|
+
this.#angle = calculatedAngle;
|
|
2932
|
+
const geometry = new PlaneGeometry(1, 1);
|
|
2933
|
+
this._createMesh(geometry, material);
|
|
2934
|
+
const z = layer.altitudeToVector3(altitude + bottomHeight, altitude + bottomHeight).x;
|
|
2935
|
+
const basePosition = layer.coordinateToVector3([cx, cy], z);
|
|
2936
|
+
this.#originalPosition = basePosition.clone();
|
|
2937
|
+
const finalPosition = this.#calculateFinalPosition(basePosition);
|
|
2938
|
+
const scale3 = width / 6456122659e-13;
|
|
2939
|
+
const finalScale = maxFontScale && scale3 > maxFontScale ? maxFontScale : scale3;
|
|
2940
|
+
this.getObject3d().scale.set(finalScale, finalScale, finalScale);
|
|
2941
|
+
this.getObject3d().position.copy(finalPosition);
|
|
2942
|
+
this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
|
|
2943
|
+
}
|
|
2944
|
+
#calculateFinalPosition(basePosition) {
|
|
2945
|
+
if (this.#offsetX === 0 && this.#offsetY === 0) {
|
|
2946
|
+
return basePosition;
|
|
2947
|
+
}
|
|
2948
|
+
const offsetCoordinate = [this.#offsetX, this.#offsetY];
|
|
2949
|
+
const z = this.#layer.altitudeToVector3(0, 0).x;
|
|
2950
|
+
const offsetVector = this.#layer.coordinateToVector3(offsetCoordinate, z);
|
|
2951
|
+
const zeroVector = this.#layer.coordinateToVector3([0, 0], z);
|
|
2952
|
+
const worldOffsetX = offsetVector.x - zeroVector.x;
|
|
2953
|
+
const worldOffsetY = offsetVector.y - zeroVector.y;
|
|
2954
|
+
return {
|
|
2955
|
+
x: basePosition.x + worldOffsetX,
|
|
2956
|
+
y: basePosition.y + worldOffsetY,
|
|
2957
|
+
z: basePosition.z
|
|
2958
|
+
};
|
|
2959
|
+
}
|
|
2960
|
+
#updatePosition() {
|
|
2961
|
+
if (this.#originalPosition && this.#layer) {
|
|
2962
|
+
const finalPosition = this.#calculateFinalPosition(this.#originalPosition);
|
|
2963
|
+
this.getObject3d().position.copy(finalPosition);
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
set bearing(value) {
|
|
2967
|
+
this.#bearing = value;
|
|
2968
|
+
const degree = this.#angle + this.#bearing;
|
|
2969
|
+
const angle = degree > 90 || degree < -90 ? this.#angle + 180 : this.#angle;
|
|
2970
|
+
this.getObject3d().rotation.z = Math.PI / 180 * angle;
|
|
2971
|
+
}
|
|
2972
|
+
get angle() {
|
|
2973
|
+
return this.#angle;
|
|
2974
|
+
}
|
|
2975
|
+
get currentAngle() {
|
|
2976
|
+
return this.#angle;
|
|
2977
|
+
}
|
|
2978
|
+
get text() {
|
|
2979
|
+
return this.#text;
|
|
2980
|
+
}
|
|
2981
|
+
get offsetX() {
|
|
2982
|
+
return this.#offsetX;
|
|
2972
2983
|
}
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
}
|
|
2978
|
-
|
|
2979
|
-
|
|
2984
|
+
get offsetY() {
|
|
2985
|
+
return this.#offsetY;
|
|
2986
|
+
}
|
|
2987
|
+
get offset() {
|
|
2988
|
+
return { x: this.#offsetX, y: this.#offsetY };
|
|
2989
|
+
}
|
|
2990
|
+
set offsetX(value) {
|
|
2991
|
+
if (isNumber2(value)) {
|
|
2992
|
+
this.#offsetX = value;
|
|
2993
|
+
this.#updatePosition();
|
|
2980
2994
|
}
|
|
2981
|
-
|
|
2982
|
-
|
|
2995
|
+
}
|
|
2996
|
+
set offsetY(value) {
|
|
2997
|
+
if (isNumber2(value)) {
|
|
2998
|
+
this.#offsetY = value;
|
|
2999
|
+
this.#updatePosition();
|
|
2983
3000
|
}
|
|
2984
|
-
|
|
2985
|
-
|
|
3001
|
+
}
|
|
3002
|
+
set angle(newAngle) {
|
|
3003
|
+
if (isNumber2(newAngle)) {
|
|
3004
|
+
this.#angle = newAngle;
|
|
3005
|
+
this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
|
|
2986
3006
|
}
|
|
2987
|
-
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
import scale from "@turf/transform-scale";
|
|
2994
|
-
import bboxPolygon from "@turf/bbox-polygon";
|
|
2995
|
-
var CameraManager = class {
|
|
2996
|
-
map;
|
|
2997
|
-
constructor(map, options) {
|
|
2998
|
-
this.map = map;
|
|
2999
|
-
if (options?.defaultView) {
|
|
3000
|
-
this.setView(options?.defaultView);
|
|
3007
|
+
}
|
|
3008
|
+
setOffset(offsetX, offsetY) {
|
|
3009
|
+
if (isNumber2(offsetX) && isNumber2(offsetY)) {
|
|
3010
|
+
this.#offsetX = offsetX;
|
|
3011
|
+
this.#offsetY = offsetY;
|
|
3012
|
+
this.#updatePosition();
|
|
3001
3013
|
}
|
|
3002
3014
|
}
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
if (this.map && Object.keys(value).length !== 0) {
|
|
3009
|
-
this.map.setView(value);
|
|
3015
|
+
addOffset(deltaX, deltaY) {
|
|
3016
|
+
if (isNumber2(deltaX) && isNumber2(deltaY)) {
|
|
3017
|
+
this.#offsetX += deltaX;
|
|
3018
|
+
this.#offsetY += deltaY;
|
|
3019
|
+
this.#updatePosition();
|
|
3010
3020
|
}
|
|
3011
|
-
};
|
|
3012
|
-
animateTo = (view, options = {}, step) => {
|
|
3013
|
-
this.map.animateTo(view, options, step);
|
|
3014
|
-
};
|
|
3015
|
-
setMaxExtent(extent) {
|
|
3016
|
-
return this.map.setMaxExtent(extent);
|
|
3017
3021
|
}
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
);
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3022
|
+
resetOffset() {
|
|
3023
|
+
this.#offsetX = 0;
|
|
3024
|
+
this.#offsetY = 0;
|
|
3025
|
+
this.#updatePosition();
|
|
3026
|
+
}
|
|
3027
|
+
moveToPosition(targetX, targetY) {
|
|
3028
|
+
if (this.#originalPosition && this.#layer) {
|
|
3029
|
+
const currentCenter = this.#layer.vector3ToCoordinate(
|
|
3030
|
+
this.#originalPosition
|
|
3031
|
+
);
|
|
3032
|
+
this.#offsetX = targetX - currentCenter.x;
|
|
3033
|
+
this.#offsetY = targetY - currentCenter.y;
|
|
3034
|
+
this.#updatePosition();
|
|
3031
3035
|
}
|
|
3032
|
-
}
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
for (let i = 0; i < value; i++) {
|
|
3044
|
-
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
3045
|
-
}
|
|
3046
|
-
return resolutions;
|
|
3047
|
-
})()
|
|
3036
|
+
}
|
|
3037
|
+
updateText(newText, options = {}) {
|
|
3038
|
+
this.#text = newText;
|
|
3039
|
+
const materialOptions = {
|
|
3040
|
+
fillStyle: options.fillStyle || this.properties.fillStyle,
|
|
3041
|
+
fontSize: options.fontSize || this.properties.fontSize,
|
|
3042
|
+
textAlign: options.textAlign || this.properties.textAlign,
|
|
3043
|
+
textBaseline: options.textBaseline || this.properties.textBaseline,
|
|
3044
|
+
fontFamily: options.fontFamily || this.properties.fontFamily,
|
|
3045
|
+
strokeStyle: options.strokeStyle || this.properties.strokeStyle,
|
|
3046
|
+
lineWidth: options.lineWidth || this.properties.lineWidth
|
|
3048
3047
|
};
|
|
3049
|
-
|
|
3048
|
+
const newMaterial = getMaterial(newText, materialOptions);
|
|
3049
|
+
this.getObject3d().material = newMaterial;
|
|
3050
|
+
newMaterial.needsUpdate = true;
|
|
3050
3051
|
}
|
|
3051
|
-
|
|
3052
|
-
this.
|
|
3052
|
+
_animation() {
|
|
3053
|
+
const map = this.getMap();
|
|
3054
|
+
if (!map) return;
|
|
3055
|
+
const bearing = map.getBearing();
|
|
3056
|
+
this.bearing = bearing;
|
|
3057
|
+
}
|
|
3058
|
+
// Add bottomHeight to altitude as final altitude position
|
|
3059
|
+
setAltitude(altitude) {
|
|
3060
|
+
const bottomHeight = this.options.bottomHeight ?? 0;
|
|
3061
|
+
return super.setAltitude(altitude + bottomHeight);
|
|
3053
3062
|
}
|
|
3054
3063
|
};
|
|
3055
3064
|
|
|
3056
|
-
// src/IndoorMap/renderer/RendererManager.ts
|
|
3057
|
-
import _isFunction from "lodash/isFunction";
|
|
3058
|
-
import _min from "lodash/min";
|
|
3059
|
-
import { center as turfCenter2 } from "@turf/center";
|
|
3060
|
-
import * as THREE3 from "three";
|
|
3061
|
-
|
|
3062
|
-
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
3063
|
-
import * as maptalks4 from "maptalks-gl";
|
|
3064
|
-
import * as THREE from "three";
|
|
3065
|
-
import { BaseObject as BaseObject5 } from "maptalks.three";
|
|
3066
|
-
import turfBuffer2 from "@turf/buffer";
|
|
3067
|
-
|
|
3068
3065
|
// src/IndoorMap/renderer/3d/element3DRendererOptions.ts
|
|
3069
3066
|
var element3DRendererOptions = {
|
|
3070
3067
|
unit: {
|
|
3071
|
-
default: { color: "#ffffff", height:
|
|
3068
|
+
default: { color: "#ffffff", height: 0.2 },
|
|
3072
3069
|
byCategory: {
|
|
3073
3070
|
walkway: { color: "#cccccc", height: 0.1 },
|
|
3074
3071
|
terrace: { color: "#cccccc", height: 0.1 },
|
|
3075
3072
|
unenclosedarea: { color: "#cccccc", height: 0.2 },
|
|
3076
3073
|
nonpublic: { color: "#999999", height: 0.3 },
|
|
3077
3074
|
escalator: { height: 0.2 },
|
|
3078
|
-
parking: { height: 0.1 },
|
|
3079
|
-
room: { color: "#ffffff", height:
|
|
3075
|
+
parking: { color: "#999999", height: 0.1 },
|
|
3076
|
+
room: { color: "#ffffff", height: 0.5, bottomHeight: 0.12 }
|
|
3080
3077
|
}
|
|
3081
3078
|
},
|
|
3082
3079
|
kiosk: {
|
|
@@ -3092,30 +3089,31 @@ var element3DRendererOptions = {
|
|
|
3092
3089
|
}
|
|
3093
3090
|
};
|
|
3094
3091
|
|
|
3095
|
-
// src/IndoorMap/renderer/3d/
|
|
3092
|
+
// src/IndoorMap/renderer/3d/utils/get3DRendererOption.ts
|
|
3096
3093
|
var DEFAULT_POLYGON_OPTION = {
|
|
3097
3094
|
color: "#FFFFFF",
|
|
3098
3095
|
offset: 0,
|
|
3099
3096
|
altitude: 0
|
|
3100
3097
|
};
|
|
3101
|
-
var
|
|
3102
|
-
var MULTIORDINAL_HEIGHT_METER = 9;
|
|
3103
|
-
var getGeometryOption = (feature2, options) => {
|
|
3098
|
+
var get3DRendererOption = (featureType, category, options) => {
|
|
3104
3099
|
try {
|
|
3105
|
-
const option = options[
|
|
3106
|
-
const category = feature2.properties.category;
|
|
3100
|
+
const option = options[featureType] ?? element3DRendererOptions[featureType];
|
|
3107
3101
|
return (category && option.byCategory?.[category]) ?? option?.default ?? DEFAULT_POLYGON_OPTION;
|
|
3108
3102
|
} catch (err) {
|
|
3109
|
-
console.log(err.message, { options,
|
|
3103
|
+
console.log(err.message, { options, featureType, category });
|
|
3110
3104
|
}
|
|
3111
3105
|
};
|
|
3106
|
+
|
|
3107
|
+
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
3108
|
+
import lineSplit from "@turf/line-split";
|
|
3109
|
+
var HEIGHT_METER = 4;
|
|
3110
|
+
var MULTIORDINAL_HEIGHT_METER = 9;
|
|
3112
3111
|
var Element3DRenderer = class extends EventTarget {
|
|
3113
3112
|
options;
|
|
3114
3113
|
map;
|
|
3115
3114
|
gltfLayer;
|
|
3116
3115
|
threeLayer;
|
|
3117
3116
|
scene;
|
|
3118
|
-
// private dracoLoader: DRACOLoader
|
|
3119
3117
|
lineMaterial;
|
|
3120
3118
|
materialByColorMap;
|
|
3121
3119
|
// Renderer is Ready
|
|
@@ -3154,7 +3152,7 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3154
3152
|
bottomHeight: bottomHeightOptions,
|
|
3155
3153
|
color: colorOptions,
|
|
3156
3154
|
...options
|
|
3157
|
-
} =
|
|
3155
|
+
} = get3DRendererOption(feature2.feature_type, feature2.properties.category, this.options);
|
|
3158
3156
|
const _this = this;
|
|
3159
3157
|
const createPolygon = (geometry, feature3) => {
|
|
3160
3158
|
try {
|
|
@@ -3239,6 +3237,68 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3239
3237
|
console.log(`error createGeometry`, err, { feature: feature2, options });
|
|
3240
3238
|
}
|
|
3241
3239
|
};
|
|
3240
|
+
createRoomWall(unit, openings = []) {
|
|
3241
|
+
const polygons = unit.geometry.type === "Polygon" ? [unit.geometry.coordinates] : unit.geometry.coordinates;
|
|
3242
|
+
return polygons.map((plg) => {
|
|
3243
|
+
return plg.map((ring) => {
|
|
3244
|
+
const roomWall = cleanCoords(polygonToLine(polygon([ring])));
|
|
3245
|
+
if (openings.length === 0) {
|
|
3246
|
+
const color = "#ababab";
|
|
3247
|
+
const material = this.getOrCreateMaterialByColor(color);
|
|
3248
|
+
const extrudedWall = this.threeLayer.toExtrudeLine(
|
|
3249
|
+
new maptalks4.LineString(roomWall.geometry.coordinates),
|
|
3250
|
+
{ height: 4, width: 1 },
|
|
3251
|
+
material
|
|
3252
|
+
);
|
|
3253
|
+
return extrudedWall;
|
|
3254
|
+
}
|
|
3255
|
+
let openingPoints = [];
|
|
3256
|
+
openings.forEach((opening) => {
|
|
3257
|
+
const doorCoords = opening?.geometry?.coordinates;
|
|
3258
|
+
const p0 = point(doorCoords[0]);
|
|
3259
|
+
const p1 = point(doorCoords[doorCoords.length - 1]);
|
|
3260
|
+
const s0 = nearestPointOnLine(roomWall, p0, { units: "meters" });
|
|
3261
|
+
const s1 = nearestPointOnLine(roomWall, p1, { units: "meters" });
|
|
3262
|
+
const d0 = s0.properties.dist;
|
|
3263
|
+
const d1 = s1.properties.dist;
|
|
3264
|
+
if (d0 > 1 || d1 > 1) {
|
|
3265
|
+
} else {
|
|
3266
|
+
openingPoints = openingPoints.concat([s0.geometry.coordinates, s1.geometry.coordinates]);
|
|
3267
|
+
}
|
|
3268
|
+
});
|
|
3269
|
+
try {
|
|
3270
|
+
const split = lineSplit(roomWall, multiPoint(openingPoints));
|
|
3271
|
+
const wallsOnly = split.features.filter((seg) => {
|
|
3272
|
+
const mid = along(seg, length(seg, { units: "meters" }) / 2, { units: "meters" });
|
|
3273
|
+
for (const opening of openings) {
|
|
3274
|
+
const dist = pointToLineDistance(mid, opening, { units: "meters" });
|
|
3275
|
+
if (dist < 0.05) return false;
|
|
3276
|
+
}
|
|
3277
|
+
return true;
|
|
3278
|
+
});
|
|
3279
|
+
const wallMeshes = wallsOnly.map((feature2, i) => {
|
|
3280
|
+
const color = "#ababab";
|
|
3281
|
+
const material = this.getOrCreateMaterialByColor(color);
|
|
3282
|
+
const extrudedLine = this.threeLayer.toExtrudeLine(
|
|
3283
|
+
new maptalks4.LineString(feature2.geometry.coordinates),
|
|
3284
|
+
{ height: 3, width: 0.4, id: unit.id },
|
|
3285
|
+
material
|
|
3286
|
+
);
|
|
3287
|
+
extrudedLine.getObject3d().userData = {
|
|
3288
|
+
unitId: unit.id,
|
|
3289
|
+
coords: feature2.geometry.coordinates
|
|
3290
|
+
};
|
|
3291
|
+
return extrudedLine;
|
|
3292
|
+
}).flat();
|
|
3293
|
+
this.threeLayer.addMesh(wallMeshes);
|
|
3294
|
+
return wallMeshes;
|
|
3295
|
+
} catch (e) {
|
|
3296
|
+
console.log(e.message, { unit, roomWall });
|
|
3297
|
+
return [];
|
|
3298
|
+
}
|
|
3299
|
+
}).flat();
|
|
3300
|
+
}).flat();
|
|
3301
|
+
}
|
|
3242
3302
|
async createEscalator(f, coordinate, options) {
|
|
3243
3303
|
const model = {
|
|
3244
3304
|
url: "https://cdn.venue.in.th/static/glb/escalator.glb",
|
|
@@ -3258,14 +3318,24 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3258
3318
|
escalatorMarker.addTo(this.gltfLayer);
|
|
3259
3319
|
return escalatorMarker;
|
|
3260
3320
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3321
|
+
// Note: Move to another renderer and keep this file on Geometry only?
|
|
3322
|
+
createGroundLabel(f, unit) {
|
|
3323
|
+
const text = f.properties.name;
|
|
3324
|
+
const bound = f.geometry.coordinates[0];
|
|
3325
|
+
const { height: unitHeight } = get3DRendererOption("unit", unit.properties.category, this.options);
|
|
3326
|
+
const options = { bottomHeight: unitHeight + 5e-3 };
|
|
3327
|
+
const groundLabel = new GroundLabel(bound, text, options, this.threeLayer);
|
|
3328
|
+
this.threeLayer.addMesh(groundLabel);
|
|
3329
|
+
return groundLabel;
|
|
3330
|
+
}
|
|
3331
|
+
async createModel3d(f) {
|
|
3332
|
+
const marker = new maptalks4.GLTFMarker(f.properties.center, {
|
|
3263
3333
|
symbol: {
|
|
3264
|
-
url:
|
|
3334
|
+
url: f.properties.model
|
|
3265
3335
|
}
|
|
3266
3336
|
});
|
|
3267
|
-
|
|
3268
|
-
return
|
|
3337
|
+
marker.addTo(this.gltfLayer);
|
|
3338
|
+
return marker;
|
|
3269
3339
|
}
|
|
3270
3340
|
async createBuilding(coordinate, ordinal) {
|
|
3271
3341
|
return Promise.resolve(null);
|
|
@@ -3378,7 +3448,7 @@ var getGeometryProperties = (feature2) => ({
|
|
|
3378
3448
|
category: feature2.properties.category,
|
|
3379
3449
|
name: feature2.properties.name?.en
|
|
3380
3450
|
});
|
|
3381
|
-
var
|
|
3451
|
+
var getGeometryOption = (feature2, options) => {
|
|
3382
3452
|
try {
|
|
3383
3453
|
const option = options[feature2.feature_type] ?? element2DRendererOptions[feature2.feature_type];
|
|
3384
3454
|
const category = feature2.properties.category;
|
|
@@ -3405,7 +3475,7 @@ var Element2DRenderer = class extends EventTarget {
|
|
|
3405
3475
|
}
|
|
3406
3476
|
createGeometry = (imdfFeature) => {
|
|
3407
3477
|
const feature2 = getGeometryProperties(imdfFeature);
|
|
3408
|
-
const { symbol, ...options } =
|
|
3478
|
+
const { symbol, ...options } = getGeometryOption(imdfFeature, this.options);
|
|
3409
3479
|
const altitude = feature2.properties.ordinal * 10;
|
|
3410
3480
|
const geometry = maptalks5.Geometry.fromJSON({
|
|
3411
3481
|
feature: feature2,
|
|
@@ -3424,11 +3494,16 @@ var Element2DRenderer = class extends EventTarget {
|
|
|
3424
3494
|
return geometry;
|
|
3425
3495
|
}
|
|
3426
3496
|
};
|
|
3497
|
+
createRoomWall(unit, openings) {
|
|
3498
|
+
return null;
|
|
3499
|
+
}
|
|
3427
3500
|
async createEscalator(f, coordinates) {
|
|
3428
3501
|
return Promise.resolve(null);
|
|
3429
3502
|
}
|
|
3430
|
-
|
|
3431
|
-
|
|
3503
|
+
createGroundLabel(f, unit) {
|
|
3504
|
+
const text = f.properties.name;
|
|
3505
|
+
const bound = f.geometry.coordinates[0];
|
|
3506
|
+
return null;
|
|
3432
3507
|
}
|
|
3433
3508
|
async createBuilding(coordinate, ordinal) {
|
|
3434
3509
|
return Promise.resolve(null);
|
|
@@ -3793,6 +3868,479 @@ var angleBetweenLineStrings = (line1, line2) => {
|
|
|
3793
3868
|
return Math.atan2(dy, dx);
|
|
3794
3869
|
};
|
|
3795
3870
|
|
|
3871
|
+
// ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/util.js
|
|
3872
|
+
var epsilon = 11102230246251565e-32;
|
|
3873
|
+
var splitter = 134217729;
|
|
3874
|
+
var resulterrbound = (3 + 8 * epsilon) * epsilon;
|
|
3875
|
+
function sum(elen, e, flen, f, h) {
|
|
3876
|
+
let Q, Qnew, hh, bvirt;
|
|
3877
|
+
let enow = e[0];
|
|
3878
|
+
let fnow = f[0];
|
|
3879
|
+
let eindex = 0;
|
|
3880
|
+
let findex = 0;
|
|
3881
|
+
if (fnow > enow === fnow > -enow) {
|
|
3882
|
+
Q = enow;
|
|
3883
|
+
enow = e[++eindex];
|
|
3884
|
+
} else {
|
|
3885
|
+
Q = fnow;
|
|
3886
|
+
fnow = f[++findex];
|
|
3887
|
+
}
|
|
3888
|
+
let hindex = 0;
|
|
3889
|
+
if (eindex < elen && findex < flen) {
|
|
3890
|
+
if (fnow > enow === fnow > -enow) {
|
|
3891
|
+
Qnew = enow + Q;
|
|
3892
|
+
hh = Q - (Qnew - enow);
|
|
3893
|
+
enow = e[++eindex];
|
|
3894
|
+
} else {
|
|
3895
|
+
Qnew = fnow + Q;
|
|
3896
|
+
hh = Q - (Qnew - fnow);
|
|
3897
|
+
fnow = f[++findex];
|
|
3898
|
+
}
|
|
3899
|
+
Q = Qnew;
|
|
3900
|
+
if (hh !== 0) {
|
|
3901
|
+
h[hindex++] = hh;
|
|
3902
|
+
}
|
|
3903
|
+
while (eindex < elen && findex < flen) {
|
|
3904
|
+
if (fnow > enow === fnow > -enow) {
|
|
3905
|
+
Qnew = Q + enow;
|
|
3906
|
+
bvirt = Qnew - Q;
|
|
3907
|
+
hh = Q - (Qnew - bvirt) + (enow - bvirt);
|
|
3908
|
+
enow = e[++eindex];
|
|
3909
|
+
} else {
|
|
3910
|
+
Qnew = Q + fnow;
|
|
3911
|
+
bvirt = Qnew - Q;
|
|
3912
|
+
hh = Q - (Qnew - bvirt) + (fnow - bvirt);
|
|
3913
|
+
fnow = f[++findex];
|
|
3914
|
+
}
|
|
3915
|
+
Q = Qnew;
|
|
3916
|
+
if (hh !== 0) {
|
|
3917
|
+
h[hindex++] = hh;
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
while (eindex < elen) {
|
|
3922
|
+
Qnew = Q + enow;
|
|
3923
|
+
bvirt = Qnew - Q;
|
|
3924
|
+
hh = Q - (Qnew - bvirt) + (enow - bvirt);
|
|
3925
|
+
enow = e[++eindex];
|
|
3926
|
+
Q = Qnew;
|
|
3927
|
+
if (hh !== 0) {
|
|
3928
|
+
h[hindex++] = hh;
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
while (findex < flen) {
|
|
3932
|
+
Qnew = Q + fnow;
|
|
3933
|
+
bvirt = Qnew - Q;
|
|
3934
|
+
hh = Q - (Qnew - bvirt) + (fnow - bvirt);
|
|
3935
|
+
fnow = f[++findex];
|
|
3936
|
+
Q = Qnew;
|
|
3937
|
+
if (hh !== 0) {
|
|
3938
|
+
h[hindex++] = hh;
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
if (Q !== 0 || hindex === 0) {
|
|
3942
|
+
h[hindex++] = Q;
|
|
3943
|
+
}
|
|
3944
|
+
return hindex;
|
|
3945
|
+
}
|
|
3946
|
+
function estimate(elen, e) {
|
|
3947
|
+
let Q = e[0];
|
|
3948
|
+
for (let i = 1; i < elen; i++) Q += e[i];
|
|
3949
|
+
return Q;
|
|
3950
|
+
}
|
|
3951
|
+
function vec(n) {
|
|
3952
|
+
return new Float64Array(n);
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
// ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient2d.js
|
|
3956
|
+
var ccwerrboundA = (3 + 16 * epsilon) * epsilon;
|
|
3957
|
+
var ccwerrboundB = (2 + 12 * epsilon) * epsilon;
|
|
3958
|
+
var ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
|
|
3959
|
+
var B = vec(4);
|
|
3960
|
+
var C1 = vec(8);
|
|
3961
|
+
var C2 = vec(12);
|
|
3962
|
+
var D = vec(16);
|
|
3963
|
+
var u = vec(4);
|
|
3964
|
+
function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
|
|
3965
|
+
let acxtail, acytail, bcxtail, bcytail;
|
|
3966
|
+
let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u32;
|
|
3967
|
+
const acx = ax - cx;
|
|
3968
|
+
const bcx = bx - cx;
|
|
3969
|
+
const acy = ay - cy;
|
|
3970
|
+
const bcy = by - cy;
|
|
3971
|
+
s1 = acx * bcy;
|
|
3972
|
+
c = splitter * acx;
|
|
3973
|
+
ahi = c - (c - acx);
|
|
3974
|
+
alo = acx - ahi;
|
|
3975
|
+
c = splitter * bcy;
|
|
3976
|
+
bhi = c - (c - bcy);
|
|
3977
|
+
blo = bcy - bhi;
|
|
3978
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
3979
|
+
t1 = acy * bcx;
|
|
3980
|
+
c = splitter * acy;
|
|
3981
|
+
ahi = c - (c - acy);
|
|
3982
|
+
alo = acy - ahi;
|
|
3983
|
+
c = splitter * bcx;
|
|
3984
|
+
bhi = c - (c - bcx);
|
|
3985
|
+
blo = bcx - bhi;
|
|
3986
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
3987
|
+
_i = s0 - t0;
|
|
3988
|
+
bvirt = s0 - _i;
|
|
3989
|
+
B[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
3990
|
+
_j = s1 + _i;
|
|
3991
|
+
bvirt = _j - s1;
|
|
3992
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
3993
|
+
_i = _0 - t1;
|
|
3994
|
+
bvirt = _0 - _i;
|
|
3995
|
+
B[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
3996
|
+
u32 = _j + _i;
|
|
3997
|
+
bvirt = u32 - _j;
|
|
3998
|
+
B[2] = _j - (u32 - bvirt) + (_i - bvirt);
|
|
3999
|
+
B[3] = u32;
|
|
4000
|
+
let det = estimate(4, B);
|
|
4001
|
+
let errbound = ccwerrboundB * detsum;
|
|
4002
|
+
if (det >= errbound || -det >= errbound) {
|
|
4003
|
+
return det;
|
|
4004
|
+
}
|
|
4005
|
+
bvirt = ax - acx;
|
|
4006
|
+
acxtail = ax - (acx + bvirt) + (bvirt - cx);
|
|
4007
|
+
bvirt = bx - bcx;
|
|
4008
|
+
bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
|
|
4009
|
+
bvirt = ay - acy;
|
|
4010
|
+
acytail = ay - (acy + bvirt) + (bvirt - cy);
|
|
4011
|
+
bvirt = by - bcy;
|
|
4012
|
+
bcytail = by - (bcy + bvirt) + (bvirt - cy);
|
|
4013
|
+
if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
|
|
4014
|
+
return det;
|
|
4015
|
+
}
|
|
4016
|
+
errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
|
|
4017
|
+
det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
|
|
4018
|
+
if (det >= errbound || -det >= errbound) return det;
|
|
4019
|
+
s1 = acxtail * bcy;
|
|
4020
|
+
c = splitter * acxtail;
|
|
4021
|
+
ahi = c - (c - acxtail);
|
|
4022
|
+
alo = acxtail - ahi;
|
|
4023
|
+
c = splitter * bcy;
|
|
4024
|
+
bhi = c - (c - bcy);
|
|
4025
|
+
blo = bcy - bhi;
|
|
4026
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
4027
|
+
t1 = acytail * bcx;
|
|
4028
|
+
c = splitter * acytail;
|
|
4029
|
+
ahi = c - (c - acytail);
|
|
4030
|
+
alo = acytail - ahi;
|
|
4031
|
+
c = splitter * bcx;
|
|
4032
|
+
bhi = c - (c - bcx);
|
|
4033
|
+
blo = bcx - bhi;
|
|
4034
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
4035
|
+
_i = s0 - t0;
|
|
4036
|
+
bvirt = s0 - _i;
|
|
4037
|
+
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
4038
|
+
_j = s1 + _i;
|
|
4039
|
+
bvirt = _j - s1;
|
|
4040
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
4041
|
+
_i = _0 - t1;
|
|
4042
|
+
bvirt = _0 - _i;
|
|
4043
|
+
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
4044
|
+
u32 = _j + _i;
|
|
4045
|
+
bvirt = u32 - _j;
|
|
4046
|
+
u[2] = _j - (u32 - bvirt) + (_i - bvirt);
|
|
4047
|
+
u[3] = u32;
|
|
4048
|
+
const C1len = sum(4, B, 4, u, C1);
|
|
4049
|
+
s1 = acx * bcytail;
|
|
4050
|
+
c = splitter * acx;
|
|
4051
|
+
ahi = c - (c - acx);
|
|
4052
|
+
alo = acx - ahi;
|
|
4053
|
+
c = splitter * bcytail;
|
|
4054
|
+
bhi = c - (c - bcytail);
|
|
4055
|
+
blo = bcytail - bhi;
|
|
4056
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
4057
|
+
t1 = acy * bcxtail;
|
|
4058
|
+
c = splitter * acy;
|
|
4059
|
+
ahi = c - (c - acy);
|
|
4060
|
+
alo = acy - ahi;
|
|
4061
|
+
c = splitter * bcxtail;
|
|
4062
|
+
bhi = c - (c - bcxtail);
|
|
4063
|
+
blo = bcxtail - bhi;
|
|
4064
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
4065
|
+
_i = s0 - t0;
|
|
4066
|
+
bvirt = s0 - _i;
|
|
4067
|
+
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
4068
|
+
_j = s1 + _i;
|
|
4069
|
+
bvirt = _j - s1;
|
|
4070
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
4071
|
+
_i = _0 - t1;
|
|
4072
|
+
bvirt = _0 - _i;
|
|
4073
|
+
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
4074
|
+
u32 = _j + _i;
|
|
4075
|
+
bvirt = u32 - _j;
|
|
4076
|
+
u[2] = _j - (u32 - bvirt) + (_i - bvirt);
|
|
4077
|
+
u[3] = u32;
|
|
4078
|
+
const C2len = sum(C1len, C1, 4, u, C2);
|
|
4079
|
+
s1 = acxtail * bcytail;
|
|
4080
|
+
c = splitter * acxtail;
|
|
4081
|
+
ahi = c - (c - acxtail);
|
|
4082
|
+
alo = acxtail - ahi;
|
|
4083
|
+
c = splitter * bcytail;
|
|
4084
|
+
bhi = c - (c - bcytail);
|
|
4085
|
+
blo = bcytail - bhi;
|
|
4086
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
4087
|
+
t1 = acytail * bcxtail;
|
|
4088
|
+
c = splitter * acytail;
|
|
4089
|
+
ahi = c - (c - acytail);
|
|
4090
|
+
alo = acytail - ahi;
|
|
4091
|
+
c = splitter * bcxtail;
|
|
4092
|
+
bhi = c - (c - bcxtail);
|
|
4093
|
+
blo = bcxtail - bhi;
|
|
4094
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
4095
|
+
_i = s0 - t0;
|
|
4096
|
+
bvirt = s0 - _i;
|
|
4097
|
+
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
4098
|
+
_j = s1 + _i;
|
|
4099
|
+
bvirt = _j - s1;
|
|
4100
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
4101
|
+
_i = _0 - t1;
|
|
4102
|
+
bvirt = _0 - _i;
|
|
4103
|
+
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
4104
|
+
u32 = _j + _i;
|
|
4105
|
+
bvirt = u32 - _j;
|
|
4106
|
+
u[2] = _j - (u32 - bvirt) + (_i - bvirt);
|
|
4107
|
+
u[3] = u32;
|
|
4108
|
+
const Dlen = sum(C2len, C2, 4, u, D);
|
|
4109
|
+
return D[Dlen - 1];
|
|
4110
|
+
}
|
|
4111
|
+
function orient2d(ax, ay, bx, by, cx, cy) {
|
|
4112
|
+
const detleft = (ay - cy) * (bx - cx);
|
|
4113
|
+
const detright = (ax - cx) * (by - cy);
|
|
4114
|
+
const det = detleft - detright;
|
|
4115
|
+
const detsum = Math.abs(detleft + detright);
|
|
4116
|
+
if (Math.abs(det) >= ccwerrboundA * detsum) return det;
|
|
4117
|
+
return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
|
|
4118
|
+
}
|
|
4119
|
+
|
|
4120
|
+
// ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient3d.js
|
|
4121
|
+
var o3derrboundA = (7 + 56 * epsilon) * epsilon;
|
|
4122
|
+
var o3derrboundB = (3 + 28 * epsilon) * epsilon;
|
|
4123
|
+
var o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon;
|
|
4124
|
+
var bc = vec(4);
|
|
4125
|
+
var ca = vec(4);
|
|
4126
|
+
var ab = vec(4);
|
|
4127
|
+
var at_b = vec(4);
|
|
4128
|
+
var at_c = vec(4);
|
|
4129
|
+
var bt_c = vec(4);
|
|
4130
|
+
var bt_a = vec(4);
|
|
4131
|
+
var ct_a = vec(4);
|
|
4132
|
+
var ct_b = vec(4);
|
|
4133
|
+
var bct = vec(8);
|
|
4134
|
+
var cat = vec(8);
|
|
4135
|
+
var abt = vec(8);
|
|
4136
|
+
var u2 = vec(4);
|
|
4137
|
+
var _8 = vec(8);
|
|
4138
|
+
var _8b = vec(8);
|
|
4139
|
+
var _16 = vec(8);
|
|
4140
|
+
var _12 = vec(12);
|
|
4141
|
+
var fin = vec(192);
|
|
4142
|
+
var fin2 = vec(192);
|
|
4143
|
+
|
|
4144
|
+
// ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/incircle.js
|
|
4145
|
+
var iccerrboundA = (10 + 96 * epsilon) * epsilon;
|
|
4146
|
+
var iccerrboundB = (4 + 48 * epsilon) * epsilon;
|
|
4147
|
+
var iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon;
|
|
4148
|
+
var bc2 = vec(4);
|
|
4149
|
+
var ca2 = vec(4);
|
|
4150
|
+
var ab2 = vec(4);
|
|
4151
|
+
var aa = vec(4);
|
|
4152
|
+
var bb = vec(4);
|
|
4153
|
+
var cc = vec(4);
|
|
4154
|
+
var u3 = vec(4);
|
|
4155
|
+
var v = vec(4);
|
|
4156
|
+
var axtbc = vec(8);
|
|
4157
|
+
var aytbc = vec(8);
|
|
4158
|
+
var bxtca = vec(8);
|
|
4159
|
+
var bytca = vec(8);
|
|
4160
|
+
var cxtab = vec(8);
|
|
4161
|
+
var cytab = vec(8);
|
|
4162
|
+
var abt2 = vec(8);
|
|
4163
|
+
var bct2 = vec(8);
|
|
4164
|
+
var cat2 = vec(8);
|
|
4165
|
+
var abtt = vec(4);
|
|
4166
|
+
var bctt = vec(4);
|
|
4167
|
+
var catt = vec(4);
|
|
4168
|
+
var _82 = vec(8);
|
|
4169
|
+
var _162 = vec(16);
|
|
4170
|
+
var _16b = vec(16);
|
|
4171
|
+
var _16c = vec(16);
|
|
4172
|
+
var _32 = vec(32);
|
|
4173
|
+
var _32b = vec(32);
|
|
4174
|
+
var _48 = vec(48);
|
|
4175
|
+
var _64 = vec(64);
|
|
4176
|
+
var fin3 = vec(1152);
|
|
4177
|
+
var fin22 = vec(1152);
|
|
4178
|
+
|
|
4179
|
+
// ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/insphere.js
|
|
4180
|
+
var isperrboundA = (16 + 224 * epsilon) * epsilon;
|
|
4181
|
+
var isperrboundB = (5 + 72 * epsilon) * epsilon;
|
|
4182
|
+
var isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon;
|
|
4183
|
+
var ab3 = vec(4);
|
|
4184
|
+
var bc3 = vec(4);
|
|
4185
|
+
var cd = vec(4);
|
|
4186
|
+
var de = vec(4);
|
|
4187
|
+
var ea = vec(4);
|
|
4188
|
+
var ac = vec(4);
|
|
4189
|
+
var bd = vec(4);
|
|
4190
|
+
var ce = vec(4);
|
|
4191
|
+
var da = vec(4);
|
|
4192
|
+
var eb = vec(4);
|
|
4193
|
+
var abc = vec(24);
|
|
4194
|
+
var bcd = vec(24);
|
|
4195
|
+
var cde = vec(24);
|
|
4196
|
+
var dea = vec(24);
|
|
4197
|
+
var eab = vec(24);
|
|
4198
|
+
var abd = vec(24);
|
|
4199
|
+
var bce = vec(24);
|
|
4200
|
+
var cda = vec(24);
|
|
4201
|
+
var deb = vec(24);
|
|
4202
|
+
var eac = vec(24);
|
|
4203
|
+
var adet = vec(1152);
|
|
4204
|
+
var bdet = vec(1152);
|
|
4205
|
+
var cdet = vec(1152);
|
|
4206
|
+
var ddet = vec(1152);
|
|
4207
|
+
var edet = vec(1152);
|
|
4208
|
+
var abdet = vec(2304);
|
|
4209
|
+
var cddet = vec(2304);
|
|
4210
|
+
var cdedet = vec(3456);
|
|
4211
|
+
var deter = vec(5760);
|
|
4212
|
+
var _83 = vec(8);
|
|
4213
|
+
var _8b2 = vec(8);
|
|
4214
|
+
var _8c = vec(8);
|
|
4215
|
+
var _163 = vec(16);
|
|
4216
|
+
var _24 = vec(24);
|
|
4217
|
+
var _482 = vec(48);
|
|
4218
|
+
var _48b = vec(48);
|
|
4219
|
+
var _96 = vec(96);
|
|
4220
|
+
var _192 = vec(192);
|
|
4221
|
+
var _384x = vec(384);
|
|
4222
|
+
var _384y = vec(384);
|
|
4223
|
+
var _384z = vec(384);
|
|
4224
|
+
var _768 = vec(768);
|
|
4225
|
+
var xdet = vec(96);
|
|
4226
|
+
var ydet = vec(96);
|
|
4227
|
+
var zdet = vec(96);
|
|
4228
|
+
var fin4 = vec(1152);
|
|
4229
|
+
|
|
4230
|
+
// ../../node_modules/point-in-polygon-hao/dist/esm/index.js
|
|
4231
|
+
function pointInPolygon(p, polygon2) {
|
|
4232
|
+
var i;
|
|
4233
|
+
var ii;
|
|
4234
|
+
var k = 0;
|
|
4235
|
+
var f;
|
|
4236
|
+
var u1;
|
|
4237
|
+
var v1;
|
|
4238
|
+
var u22;
|
|
4239
|
+
var v2;
|
|
4240
|
+
var currentP;
|
|
4241
|
+
var nextP;
|
|
4242
|
+
var x = p[0];
|
|
4243
|
+
var y = p[1];
|
|
4244
|
+
var numContours = polygon2.length;
|
|
4245
|
+
for (i = 0; i < numContours; i++) {
|
|
4246
|
+
ii = 0;
|
|
4247
|
+
var contour = polygon2[i];
|
|
4248
|
+
var contourLen = contour.length - 1;
|
|
4249
|
+
currentP = contour[0];
|
|
4250
|
+
if (currentP[0] !== contour[contourLen][0] && currentP[1] !== contour[contourLen][1]) {
|
|
4251
|
+
throw new Error("First and last coordinates in a ring must be the same");
|
|
4252
|
+
}
|
|
4253
|
+
u1 = currentP[0] - x;
|
|
4254
|
+
v1 = currentP[1] - y;
|
|
4255
|
+
for (ii; ii < contourLen; ii++) {
|
|
4256
|
+
nextP = contour[ii + 1];
|
|
4257
|
+
u22 = nextP[0] - x;
|
|
4258
|
+
v2 = nextP[1] - y;
|
|
4259
|
+
if (v1 === 0 && v2 === 0) {
|
|
4260
|
+
if (u22 <= 0 && u1 >= 0 || u1 <= 0 && u22 >= 0) {
|
|
4261
|
+
return 0;
|
|
4262
|
+
}
|
|
4263
|
+
} else if (v2 >= 0 && v1 <= 0 || v2 <= 0 && v1 >= 0) {
|
|
4264
|
+
f = orient2d(u1, u22, v1, v2, 0, 0);
|
|
4265
|
+
if (f === 0) {
|
|
4266
|
+
return 0;
|
|
4267
|
+
}
|
|
4268
|
+
if (f > 0 && v2 > 0 && v1 <= 0 || f < 0 && v2 <= 0 && v1 > 0) {
|
|
4269
|
+
k++;
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
currentP = nextP;
|
|
4273
|
+
v1 = v2;
|
|
4274
|
+
u1 = u22;
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
if (k % 2 === 0) {
|
|
4278
|
+
return false;
|
|
4279
|
+
}
|
|
4280
|
+
return true;
|
|
4281
|
+
}
|
|
4282
|
+
|
|
4283
|
+
// ../../node_modules/@turf/invariant/dist/esm/index.js
|
|
4284
|
+
function getCoord(coord) {
|
|
4285
|
+
if (!coord) {
|
|
4286
|
+
throw new Error("coord is required");
|
|
4287
|
+
}
|
|
4288
|
+
if (!Array.isArray(coord)) {
|
|
4289
|
+
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
4290
|
+
return [...coord.geometry.coordinates];
|
|
4291
|
+
}
|
|
4292
|
+
if (coord.type === "Point") {
|
|
4293
|
+
return [...coord.coordinates];
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
4297
|
+
return [...coord];
|
|
4298
|
+
}
|
|
4299
|
+
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
4300
|
+
}
|
|
4301
|
+
function getGeom(geojson) {
|
|
4302
|
+
if (geojson.type === "Feature") {
|
|
4303
|
+
return geojson.geometry;
|
|
4304
|
+
}
|
|
4305
|
+
return geojson;
|
|
4306
|
+
}
|
|
4307
|
+
|
|
4308
|
+
// ../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js
|
|
4309
|
+
function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
4310
|
+
if (!point2) {
|
|
4311
|
+
throw new Error("point is required");
|
|
4312
|
+
}
|
|
4313
|
+
if (!polygon2) {
|
|
4314
|
+
throw new Error("polygon is required");
|
|
4315
|
+
}
|
|
4316
|
+
const pt = getCoord(point2);
|
|
4317
|
+
const geom = getGeom(polygon2);
|
|
4318
|
+
const type = geom.type;
|
|
4319
|
+
const bbox2 = polygon2.bbox;
|
|
4320
|
+
let polys = geom.coordinates;
|
|
4321
|
+
if (bbox2 && inBBox(pt, bbox2) === false) {
|
|
4322
|
+
return false;
|
|
4323
|
+
}
|
|
4324
|
+
if (type === "Polygon") {
|
|
4325
|
+
polys = [polys];
|
|
4326
|
+
}
|
|
4327
|
+
let result = false;
|
|
4328
|
+
for (var i = 0; i < polys.length; ++i) {
|
|
4329
|
+
const polyResult = pointInPolygon(pt, polys[i]);
|
|
4330
|
+
if (polyResult === 0) return options.ignoreBoundary ? false : true;
|
|
4331
|
+
else if (polyResult) result = true;
|
|
4332
|
+
}
|
|
4333
|
+
return result;
|
|
4334
|
+
}
|
|
4335
|
+
function inBBox(pt, bbox2) {
|
|
4336
|
+
return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
|
|
4337
|
+
}
|
|
4338
|
+
|
|
4339
|
+
// src/IndoorMap/renderer/utils/findUnitOnPoint.ts
|
|
4340
|
+
var findUnitOnPoint = (units, point2) => {
|
|
4341
|
+
return units.find((unit) => booleanPointInPolygon(point2, polygon(unit.geometry.coordinates)));
|
|
4342
|
+
};
|
|
4343
|
+
|
|
3796
4344
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
3797
4345
|
function delay(ms) {
|
|
3798
4346
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -3828,6 +4376,38 @@ var RendererManager = class extends EventTarget {
|
|
|
3828
4376
|
const groupLayer = this.map.getLayer("group");
|
|
3829
4377
|
const threeLayer = groupLayer.getLayer("three");
|
|
3830
4378
|
threeLayer.prepareToDraw = function(gl, scene, camera) {
|
|
4379
|
+
function findBadMeshes(scene2) {
|
|
4380
|
+
const bad = [];
|
|
4381
|
+
scene2.traverse((obj) => {
|
|
4382
|
+
if (!obj?.isMesh) return;
|
|
4383
|
+
const geom = obj.geometry;
|
|
4384
|
+
const pos = geom?.attributes?.position?.array;
|
|
4385
|
+
if (!pos || pos.length === 0) return;
|
|
4386
|
+
for (let i = 0; i < pos.length; i++) {
|
|
4387
|
+
const v2 = pos[i];
|
|
4388
|
+
if (!Number.isFinite(v2)) {
|
|
4389
|
+
bad.push({ mesh: obj, index: i, value: v2 });
|
|
4390
|
+
break;
|
|
4391
|
+
}
|
|
4392
|
+
}
|
|
4393
|
+
});
|
|
4394
|
+
if (bad.length) {
|
|
4395
|
+
console.group(`\u274C Found ${bad.length} meshes with invalid positions`);
|
|
4396
|
+
for (const b of bad) {
|
|
4397
|
+
console.log({
|
|
4398
|
+
name: b.mesh.name,
|
|
4399
|
+
userData: b.mesh.userData,
|
|
4400
|
+
uuid: b.mesh.uuid,
|
|
4401
|
+
badIndex: b.index,
|
|
4402
|
+
badValue: b.value
|
|
4403
|
+
});
|
|
4404
|
+
}
|
|
4405
|
+
console.groupEnd();
|
|
4406
|
+
} else {
|
|
4407
|
+
console.log("\u2705 No invalid meshes found");
|
|
4408
|
+
}
|
|
4409
|
+
return bad;
|
|
4410
|
+
}
|
|
3831
4411
|
const ambientLight = new THREE3.AmbientLight(16777215, 0.3);
|
|
3832
4412
|
scene.add(ambientLight);
|
|
3833
4413
|
const dirColor = 16777215;
|
|
@@ -3842,6 +4422,9 @@ var RendererManager = class extends EventTarget {
|
|
|
3842
4422
|
options.onRendererReady();
|
|
3843
4423
|
}
|
|
3844
4424
|
_this.#createElements();
|
|
4425
|
+
setTimeout(() => {
|
|
4426
|
+
findBadMeshes(scene);
|
|
4427
|
+
}, 3e3);
|
|
3845
4428
|
};
|
|
3846
4429
|
} else {
|
|
3847
4430
|
this.elementRenderer = new Element2DRenderer(map, options.elements);
|
|
@@ -3883,6 +4466,9 @@ var RendererManager = class extends EventTarget {
|
|
|
3883
4466
|
const levels = await this.#dataClient.filterByType("level", {
|
|
3884
4467
|
populate: true
|
|
3885
4468
|
});
|
|
4469
|
+
const openings = await this.#dataClient.filterByType("opening", {
|
|
4470
|
+
populate: true
|
|
4471
|
+
});
|
|
3886
4472
|
const relationships = await this.#dataClient.filterByType("relationship");
|
|
3887
4473
|
const fixtures = await this.#dataClient.filterByType("fixture", { populate: true });
|
|
3888
4474
|
fixtures.forEach((fixture) => {
|
|
@@ -3896,7 +4482,7 @@ var RendererManager = class extends EventTarget {
|
|
|
3896
4482
|
populate: true
|
|
3897
4483
|
});
|
|
3898
4484
|
units.filter(
|
|
3899
|
-
(
|
|
4485
|
+
(u4) => !["opentobelow", "escalator", "room"].includes(u4.properties.category)
|
|
3900
4486
|
).forEach((unit) => {
|
|
3901
4487
|
const element = this.elementRenderer.createGeometry(unit);
|
|
3902
4488
|
if (element) {
|
|
@@ -3904,6 +4490,22 @@ var RendererManager = class extends EventTarget {
|
|
|
3904
4490
|
this.addElementsToManager(unit.id, _elements, unit.properties.level.properties.ordinal);
|
|
3905
4491
|
}
|
|
3906
4492
|
});
|
|
4493
|
+
units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
|
|
4494
|
+
const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
|
|
4495
|
+
const roomOpenings = _compact2(openingRelationships.map((rel) => {
|
|
4496
|
+
const openingId = rel?.properties.intermediary[0].id;
|
|
4497
|
+
return openings.find((o) => o.id === openingId);
|
|
4498
|
+
}));
|
|
4499
|
+
const innerElements = this.elementRenderer.createGeometry(unit);
|
|
4500
|
+
const wallElements = this.elementRenderer.createRoomWall(unit, roomOpenings);
|
|
4501
|
+
if (innerElements || wallElements) {
|
|
4502
|
+
const _innerElements = Array.isArray(innerElements) ? innerElements : [innerElements];
|
|
4503
|
+
const _wallElements = Array.isArray(wallElements) ? wallElements : [wallElements];
|
|
4504
|
+
const _elements = [..._innerElements, ..._wallElements];
|
|
4505
|
+
const ordinal = unit.properties.level.properties.ordinal;
|
|
4506
|
+
this.addElementsToManager(unit.id, _elements, ordinal);
|
|
4507
|
+
}
|
|
4508
|
+
});
|
|
3907
4509
|
const kiosks = await this.#dataClient.filterByType("kiosk", {
|
|
3908
4510
|
populate: true
|
|
3909
4511
|
});
|
|
@@ -3914,7 +4516,7 @@ var RendererManager = class extends EventTarget {
|
|
|
3914
4516
|
this.addElementsToManager(kiosk.id, _elements, kiosk.properties.level.properties.ordinal);
|
|
3915
4517
|
}
|
|
3916
4518
|
});
|
|
3917
|
-
const escalators = units.filter((
|
|
4519
|
+
const escalators = units.filter((u4) => u4.properties.category === "escalator");
|
|
3918
4520
|
for (const escalator of escalators) {
|
|
3919
4521
|
try {
|
|
3920
4522
|
const escalatorRelationships = relationships.filter((r) => (r.properties?.intermediary || []).some((inter) => inter.id === escalator.id));
|
|
@@ -3946,6 +4548,22 @@ var RendererManager = class extends EventTarget {
|
|
|
3946
4548
|
console.warn(`cannot create escalator`, err.message);
|
|
3947
4549
|
}
|
|
3948
4550
|
}
|
|
4551
|
+
const groundLabels = await this.#dataClient.filterByType("label");
|
|
4552
|
+
for (const label of groundLabels) {
|
|
4553
|
+
const center2 = turfCenter2(polygon(label.geometry.coordinates)).geometry.coordinates;
|
|
4554
|
+
const unit = findUnitOnPoint(units, center2);
|
|
4555
|
+
const element = this.elementRenderer.createGroundLabel(label, unit);
|
|
4556
|
+
if (element) {
|
|
4557
|
+
const _elements = Array.isArray(element) ? element : [element];
|
|
4558
|
+
this.addElementsToManager(label.id, _elements, label.properties.ordinal);
|
|
4559
|
+
}
|
|
4560
|
+
}
|
|
4561
|
+
if (this.options.type === "3D") {
|
|
4562
|
+
const model3ds = await this.#dataClient.filterByType("model3d");
|
|
4563
|
+
for (const model3d of model3ds) {
|
|
4564
|
+
this.elementRenderer.createModel3d(model3d);
|
|
4565
|
+
}
|
|
4566
|
+
}
|
|
3949
4567
|
this.changeLevelByOrdinal(this.currentOrdinals);
|
|
3950
4568
|
this.dispatchEvent(new CustomEvent("renderermanager:elements_created"));
|
|
3951
4569
|
}
|
|
@@ -4072,7 +4690,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4072
4690
|
#billboardObjects = [];
|
|
4073
4691
|
#spriteMarkerObjects = [];
|
|
4074
4692
|
#mapDecorations = [];
|
|
4075
|
-
#groundLabels = [];
|
|
4076
4693
|
#groundObjects = [];
|
|
4077
4694
|
#navigationGeometries = {};
|
|
4078
4695
|
#venueObjects = [];
|
|
@@ -4136,7 +4753,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4136
4753
|
layers: []
|
|
4137
4754
|
});
|
|
4138
4755
|
const groupLayer = new GroupGLLayer("group", [], {}).addTo(this.map);
|
|
4139
|
-
const threeLayer = new
|
|
4756
|
+
const threeLayer = new ThreeLayer5("three", {
|
|
4140
4757
|
forceRenderOnMoving: true,
|
|
4141
4758
|
forceRenderOnRotating: true
|
|
4142
4759
|
});
|
|
@@ -4237,9 +4854,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4237
4854
|
set mapDecorations(value) {
|
|
4238
4855
|
this.#mapDecorations = value;
|
|
4239
4856
|
}
|
|
4240
|
-
set groundLabels(value) {
|
|
4241
|
-
this.#groundLabels = value;
|
|
4242
|
-
}
|
|
4243
4857
|
set pixelRatio(value) {
|
|
4244
4858
|
this.map.setDevicePixelRatio(value);
|
|
4245
4859
|
}
|
|
@@ -4283,13 +4897,11 @@ var IndoorMap = class extends EventTarget {
|
|
|
4283
4897
|
createDecoration,
|
|
4284
4898
|
// 3D
|
|
4285
4899
|
create3DFootprint,
|
|
4286
|
-
create3DGroundLabel,
|
|
4287
4900
|
create3DBillboard,
|
|
4288
4901
|
createExtrudedUnit,
|
|
4289
4902
|
create3DAmenityMarker,
|
|
4290
4903
|
create3DOccupantAmenityMarker,
|
|
4291
|
-
create3DOpeningMarker
|
|
4292
|
-
createOccupantGroundLabel
|
|
4904
|
+
create3DOpeningMarker
|
|
4293
4905
|
} = this.#styler;
|
|
4294
4906
|
let elements = {};
|
|
4295
4907
|
let object3ds = [];
|
|
@@ -4367,16 +4979,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4367
4979
|
console.warn(`Cannot create ${feature2.id}: ${err.message}`);
|
|
4368
4980
|
}
|
|
4369
4981
|
}
|
|
4370
|
-
this.#groundLabels.forEach((label) => {
|
|
4371
|
-
const text = label.properties.name;
|
|
4372
|
-
try {
|
|
4373
|
-
const groundLabel = create3DGroundLabel(label, this.threeLayer);
|
|
4374
|
-
object3ds.push(groundLabel);
|
|
4375
|
-
this.#groundObjects.push(groundLabel);
|
|
4376
|
-
} catch (error) {
|
|
4377
|
-
console.log("error creating ground label for ", text);
|
|
4378
|
-
}
|
|
4379
|
-
});
|
|
4380
4982
|
this.#mapDecorations.forEach((decoration) => {
|
|
4381
4983
|
const { id, geometry, properties } = decoration;
|
|
4382
4984
|
const geometryType = decoration?.geometry?.type;
|
|
@@ -4815,9 +5417,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4815
5417
|
child.visible = this.showVenueObject && objectOpacity > 0.4;
|
|
4816
5418
|
});
|
|
4817
5419
|
});
|
|
4818
|
-
this.#groundObjects.forEach((gLabel) => {
|
|
4819
|
-
gLabel.bearing = currBearing;
|
|
4820
|
-
});
|
|
4821
5420
|
}
|
|
4822
5421
|
this.#animationsToRun.forEach(({ callback }) => callback(this));
|
|
4823
5422
|
TWEEN.update();
|