venue-js 1.2.0-next.1 → 1.2.0-next.2
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 +26 -122
- package/dist/index.d.ts +26 -122
- package/dist/index.js +224 -312
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -306
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -593,7 +593,6 @@ import {
|
|
|
593
593
|
ui as ui3,
|
|
594
594
|
Map as Map2,
|
|
595
595
|
TileLayer,
|
|
596
|
-
Extent,
|
|
597
596
|
LineString as LineString3,
|
|
598
597
|
Marker as Marker2,
|
|
599
598
|
Coordinate as Coordinate4
|
|
@@ -679,132 +678,6 @@ function isNumber(num) {
|
|
|
679
678
|
// src/IndoorMap/IndoorMap.ts
|
|
680
679
|
import turfDistance from "@turf/distance";
|
|
681
680
|
import turfCenter3 from "@turf/center";
|
|
682
|
-
|
|
683
|
-
// ../../node_modules/@turf/meta/dist/esm/index.js
|
|
684
|
-
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
685
|
-
if (geojson === null) return;
|
|
686
|
-
var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
687
|
-
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
688
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
689
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
690
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
691
|
-
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
692
|
-
var multiFeatureIndex = 0;
|
|
693
|
-
var geometryIndex = 0;
|
|
694
|
-
geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
695
|
-
if (geometry === null) continue;
|
|
696
|
-
coords = geometry.coordinates;
|
|
697
|
-
var geomType = geometry.type;
|
|
698
|
-
wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
|
|
699
|
-
switch (geomType) {
|
|
700
|
-
case null:
|
|
701
|
-
break;
|
|
702
|
-
case "Point":
|
|
703
|
-
if (callback(
|
|
704
|
-
coords,
|
|
705
|
-
coordIndex,
|
|
706
|
-
featureIndex,
|
|
707
|
-
multiFeatureIndex,
|
|
708
|
-
geometryIndex
|
|
709
|
-
) === false)
|
|
710
|
-
return false;
|
|
711
|
-
coordIndex++;
|
|
712
|
-
multiFeatureIndex++;
|
|
713
|
-
break;
|
|
714
|
-
case "LineString":
|
|
715
|
-
case "MultiPoint":
|
|
716
|
-
for (j = 0; j < coords.length; j++) {
|
|
717
|
-
if (callback(
|
|
718
|
-
coords[j],
|
|
719
|
-
coordIndex,
|
|
720
|
-
featureIndex,
|
|
721
|
-
multiFeatureIndex,
|
|
722
|
-
geometryIndex
|
|
723
|
-
) === false)
|
|
724
|
-
return false;
|
|
725
|
-
coordIndex++;
|
|
726
|
-
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
727
|
-
}
|
|
728
|
-
if (geomType === "LineString") multiFeatureIndex++;
|
|
729
|
-
break;
|
|
730
|
-
case "Polygon":
|
|
731
|
-
case "MultiLineString":
|
|
732
|
-
for (j = 0; j < coords.length; j++) {
|
|
733
|
-
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
734
|
-
if (callback(
|
|
735
|
-
coords[j][k],
|
|
736
|
-
coordIndex,
|
|
737
|
-
featureIndex,
|
|
738
|
-
multiFeatureIndex,
|
|
739
|
-
geometryIndex
|
|
740
|
-
) === false)
|
|
741
|
-
return false;
|
|
742
|
-
coordIndex++;
|
|
743
|
-
}
|
|
744
|
-
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
745
|
-
if (geomType === "Polygon") geometryIndex++;
|
|
746
|
-
}
|
|
747
|
-
if (geomType === "Polygon") multiFeatureIndex++;
|
|
748
|
-
break;
|
|
749
|
-
case "MultiPolygon":
|
|
750
|
-
for (j = 0; j < coords.length; j++) {
|
|
751
|
-
geometryIndex = 0;
|
|
752
|
-
for (k = 0; k < coords[j].length; k++) {
|
|
753
|
-
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
|
754
|
-
if (callback(
|
|
755
|
-
coords[j][k][l],
|
|
756
|
-
coordIndex,
|
|
757
|
-
featureIndex,
|
|
758
|
-
multiFeatureIndex,
|
|
759
|
-
geometryIndex
|
|
760
|
-
) === false)
|
|
761
|
-
return false;
|
|
762
|
-
coordIndex++;
|
|
763
|
-
}
|
|
764
|
-
geometryIndex++;
|
|
765
|
-
}
|
|
766
|
-
multiFeatureIndex++;
|
|
767
|
-
}
|
|
768
|
-
break;
|
|
769
|
-
case "GeometryCollection":
|
|
770
|
-
for (j = 0; j < geometry.geometries.length; j++)
|
|
771
|
-
if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
|
|
772
|
-
return false;
|
|
773
|
-
break;
|
|
774
|
-
default:
|
|
775
|
-
throw new Error("Unknown Geometry Type");
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
782
|
-
function bbox(geojson, options = {}) {
|
|
783
|
-
if (geojson.bbox != null && true !== options.recompute) {
|
|
784
|
-
return geojson.bbox;
|
|
785
|
-
}
|
|
786
|
-
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
787
|
-
coordEach(geojson, (coord) => {
|
|
788
|
-
if (result[0] > coord[0]) {
|
|
789
|
-
result[0] = coord[0];
|
|
790
|
-
}
|
|
791
|
-
if (result[1] > coord[1]) {
|
|
792
|
-
result[1] = coord[1];
|
|
793
|
-
}
|
|
794
|
-
if (result[2] < coord[0]) {
|
|
795
|
-
result[2] = coord[0];
|
|
796
|
-
}
|
|
797
|
-
if (result[3] < coord[1]) {
|
|
798
|
-
result[3] = coord[1];
|
|
799
|
-
}
|
|
800
|
-
});
|
|
801
|
-
return result;
|
|
802
|
-
}
|
|
803
|
-
var index_default = bbox;
|
|
804
|
-
|
|
805
|
-
// src/IndoorMap/IndoorMap.ts
|
|
806
|
-
import scale from "@turf/transform-scale";
|
|
807
|
-
import bboxPolygon from "@turf/bbox-polygon";
|
|
808
681
|
import { PerspectiveCamera } from "three";
|
|
809
682
|
|
|
810
683
|
// src/IndoorMap/constants.ts
|
|
@@ -3010,8 +2883,133 @@ var createHighlighExtrudeObjectController = (obj, { color }) => {
|
|
|
3010
2883
|
};
|
|
3011
2884
|
|
|
3012
2885
|
// src/IndoorMap/camera/CameraManager.ts
|
|
3013
|
-
|
|
3014
|
-
|
|
2886
|
+
import { Extent } from "maptalks";
|
|
2887
|
+
|
|
2888
|
+
// ../../node_modules/@turf/meta/dist/esm/index.js
|
|
2889
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
2890
|
+
if (geojson === null) return;
|
|
2891
|
+
var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
2892
|
+
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
2893
|
+
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
2894
|
+
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
2895
|
+
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
2896
|
+
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
2897
|
+
var multiFeatureIndex = 0;
|
|
2898
|
+
var geometryIndex = 0;
|
|
2899
|
+
geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
2900
|
+
if (geometry === null) continue;
|
|
2901
|
+
coords = geometry.coordinates;
|
|
2902
|
+
var geomType = geometry.type;
|
|
2903
|
+
wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
|
|
2904
|
+
switch (geomType) {
|
|
2905
|
+
case null:
|
|
2906
|
+
break;
|
|
2907
|
+
case "Point":
|
|
2908
|
+
if (callback(
|
|
2909
|
+
coords,
|
|
2910
|
+
coordIndex,
|
|
2911
|
+
featureIndex,
|
|
2912
|
+
multiFeatureIndex,
|
|
2913
|
+
geometryIndex
|
|
2914
|
+
) === false)
|
|
2915
|
+
return false;
|
|
2916
|
+
coordIndex++;
|
|
2917
|
+
multiFeatureIndex++;
|
|
2918
|
+
break;
|
|
2919
|
+
case "LineString":
|
|
2920
|
+
case "MultiPoint":
|
|
2921
|
+
for (j = 0; j < coords.length; j++) {
|
|
2922
|
+
if (callback(
|
|
2923
|
+
coords[j],
|
|
2924
|
+
coordIndex,
|
|
2925
|
+
featureIndex,
|
|
2926
|
+
multiFeatureIndex,
|
|
2927
|
+
geometryIndex
|
|
2928
|
+
) === false)
|
|
2929
|
+
return false;
|
|
2930
|
+
coordIndex++;
|
|
2931
|
+
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
2932
|
+
}
|
|
2933
|
+
if (geomType === "LineString") multiFeatureIndex++;
|
|
2934
|
+
break;
|
|
2935
|
+
case "Polygon":
|
|
2936
|
+
case "MultiLineString":
|
|
2937
|
+
for (j = 0; j < coords.length; j++) {
|
|
2938
|
+
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
2939
|
+
if (callback(
|
|
2940
|
+
coords[j][k],
|
|
2941
|
+
coordIndex,
|
|
2942
|
+
featureIndex,
|
|
2943
|
+
multiFeatureIndex,
|
|
2944
|
+
geometryIndex
|
|
2945
|
+
) === false)
|
|
2946
|
+
return false;
|
|
2947
|
+
coordIndex++;
|
|
2948
|
+
}
|
|
2949
|
+
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
2950
|
+
if (geomType === "Polygon") geometryIndex++;
|
|
2951
|
+
}
|
|
2952
|
+
if (geomType === "Polygon") multiFeatureIndex++;
|
|
2953
|
+
break;
|
|
2954
|
+
case "MultiPolygon":
|
|
2955
|
+
for (j = 0; j < coords.length; j++) {
|
|
2956
|
+
geometryIndex = 0;
|
|
2957
|
+
for (k = 0; k < coords[j].length; k++) {
|
|
2958
|
+
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
|
2959
|
+
if (callback(
|
|
2960
|
+
coords[j][k][l],
|
|
2961
|
+
coordIndex,
|
|
2962
|
+
featureIndex,
|
|
2963
|
+
multiFeatureIndex,
|
|
2964
|
+
geometryIndex
|
|
2965
|
+
) === false)
|
|
2966
|
+
return false;
|
|
2967
|
+
coordIndex++;
|
|
2968
|
+
}
|
|
2969
|
+
geometryIndex++;
|
|
2970
|
+
}
|
|
2971
|
+
multiFeatureIndex++;
|
|
2972
|
+
}
|
|
2973
|
+
break;
|
|
2974
|
+
case "GeometryCollection":
|
|
2975
|
+
for (j = 0; j < geometry.geometries.length; j++)
|
|
2976
|
+
if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
|
|
2977
|
+
return false;
|
|
2978
|
+
break;
|
|
2979
|
+
default:
|
|
2980
|
+
throw new Error("Unknown Geometry Type");
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
2987
|
+
function bbox(geojson, options = {}) {
|
|
2988
|
+
if (geojson.bbox != null && true !== options.recompute) {
|
|
2989
|
+
return geojson.bbox;
|
|
2990
|
+
}
|
|
2991
|
+
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
2992
|
+
coordEach(geojson, (coord) => {
|
|
2993
|
+
if (result[0] > coord[0]) {
|
|
2994
|
+
result[0] = coord[0];
|
|
2995
|
+
}
|
|
2996
|
+
if (result[1] > coord[1]) {
|
|
2997
|
+
result[1] = coord[1];
|
|
2998
|
+
}
|
|
2999
|
+
if (result[2] < coord[0]) {
|
|
3000
|
+
result[2] = coord[0];
|
|
3001
|
+
}
|
|
3002
|
+
if (result[3] < coord[1]) {
|
|
3003
|
+
result[3] = coord[1];
|
|
3004
|
+
}
|
|
3005
|
+
});
|
|
3006
|
+
return result;
|
|
3007
|
+
}
|
|
3008
|
+
var index_default = bbox;
|
|
3009
|
+
|
|
3010
|
+
// src/IndoorMap/camera/CameraManager.ts
|
|
3011
|
+
import scale from "@turf/transform-scale";
|
|
3012
|
+
import bboxPolygon from "@turf/bbox-polygon";
|
|
3015
3013
|
var CameraManager = class {
|
|
3016
3014
|
map;
|
|
3017
3015
|
constructor(map, options) {
|
|
@@ -3020,67 +3018,55 @@ var CameraManager = class {
|
|
|
3020
3018
|
this.setView(options?.defaultView);
|
|
3021
3019
|
}
|
|
3022
3020
|
}
|
|
3023
|
-
/** Private method */
|
|
3024
|
-
#animateflyTo(viewOptions = {}, options = {}, callbackOption = () => {
|
|
3025
|
-
}) {
|
|
3026
|
-
const { start, end } = {
|
|
3027
|
-
start: (frame) => {
|
|
3028
|
-
},
|
|
3029
|
-
end: (frame) => {
|
|
3030
|
-
},
|
|
3031
|
-
...callbackOption
|
|
3032
|
-
};
|
|
3033
|
-
this.map.flyTo(viewOptions, options, (frame) => {
|
|
3034
|
-
if (frame.state.playState === "running" && frame.state.progress === 0)
|
|
3035
|
-
start(frame);
|
|
3036
|
-
if (frame.state.playState === "finished") end(frame);
|
|
3037
|
-
});
|
|
3038
|
-
}
|
|
3039
3021
|
/** Public methods */
|
|
3040
3022
|
getView = () => {
|
|
3041
3023
|
return this.map.getView();
|
|
3042
3024
|
};
|
|
3043
|
-
getZoom = () => {
|
|
3044
|
-
return this.map.getView().zoom;
|
|
3045
|
-
};
|
|
3046
3025
|
setView = (value) => {
|
|
3047
3026
|
this.map.setView(value);
|
|
3048
3027
|
};
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
const {
|
|
3052
|
-
zoom = ZOOM_OUT_LEVEL,
|
|
3053
|
-
pitch = 60,
|
|
3054
|
-
duration = 600,
|
|
3055
|
-
easing = "out",
|
|
3056
|
-
bearing = currentView.bearing
|
|
3057
|
-
} = options;
|
|
3058
|
-
this.#animateflyTo(
|
|
3059
|
-
{
|
|
3060
|
-
center: center2,
|
|
3061
|
-
zoom,
|
|
3062
|
-
pitch,
|
|
3063
|
-
bearing
|
|
3064
|
-
},
|
|
3065
|
-
{ duration, easing }
|
|
3066
|
-
);
|
|
3028
|
+
animateTo = (view, options = {}, step) => {
|
|
3029
|
+
this.map.animateTo(view, options, step);
|
|
3067
3030
|
};
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
} = options;
|
|
3075
|
-
this.#animateflyTo(
|
|
3076
|
-
{
|
|
3077
|
-
center: centerPoint,
|
|
3078
|
-
zoom,
|
|
3079
|
-
pitch
|
|
3080
|
-
},
|
|
3081
|
-
{ duration, easing }
|
|
3031
|
+
setMaxExtent(extent) {
|
|
3032
|
+
return this.map.setMaxExtent(extent);
|
|
3033
|
+
}
|
|
3034
|
+
getFeatureExtent = (feature2, scaleFactor = 1) => {
|
|
3035
|
+
const [minX, minY, maxX, maxY] = index_default(
|
|
3036
|
+
scale(bboxPolygon(index_default(feature2)), scaleFactor)
|
|
3082
3037
|
);
|
|
3038
|
+
return new Extent(minX, minY, maxX, maxY);
|
|
3039
|
+
};
|
|
3040
|
+
getExtentZoom = (extent, options = {
|
|
3041
|
+
isFraction: false,
|
|
3042
|
+
padding: {
|
|
3043
|
+
paddingLeft: 0,
|
|
3044
|
+
paddingRight: 0,
|
|
3045
|
+
paddingTop: 0,
|
|
3046
|
+
paddingBottom: 0
|
|
3047
|
+
}
|
|
3048
|
+
}) => {
|
|
3049
|
+
const { isFraction = false, padding } = options;
|
|
3050
|
+
return this.map.getFitZoom(extent, isFraction, padding);
|
|
3083
3051
|
};
|
|
3052
|
+
set maxZoom(value) {
|
|
3053
|
+
this.map.setMaxZoom(value);
|
|
3054
|
+
const spatialReference = {
|
|
3055
|
+
projection: "EPSG:3857",
|
|
3056
|
+
resolutions: (function() {
|
|
3057
|
+
const resolutions = [];
|
|
3058
|
+
const d = 2 * 6378137 * Math.PI;
|
|
3059
|
+
for (let i = 0; i < value; i++) {
|
|
3060
|
+
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
3061
|
+
}
|
|
3062
|
+
return resolutions;
|
|
3063
|
+
})()
|
|
3064
|
+
};
|
|
3065
|
+
this.map.setSpatialReference(spatialReference);
|
|
3066
|
+
}
|
|
3067
|
+
set minZoom(value) {
|
|
3068
|
+
this.map.setMinZoom(value);
|
|
3069
|
+
}
|
|
3084
3070
|
};
|
|
3085
3071
|
|
|
3086
3072
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
@@ -3382,41 +3368,45 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3382
3368
|
} = getGeometryOption(feature2, this.options);
|
|
3383
3369
|
const _this = this;
|
|
3384
3370
|
const createPolygon = (geometry, feature3) => {
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3371
|
+
try {
|
|
3372
|
+
const [outerRing, ...innerRings] = geometry.coordinates;
|
|
3373
|
+
const offsetFeature = offset !== 0 ? turfBuffer2(geometry, offset, { units: "meters" }) : feature3;
|
|
3374
|
+
const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#ffffff";
|
|
3375
|
+
if (color === "transparent") return;
|
|
3376
|
+
const material = this.getOrCreateMaterialByColor(color);
|
|
3377
|
+
const altitude = feature3.properties.ordinal * HEIGHT_METER;
|
|
3378
|
+
const height = feature3.properties.height ?? heightOptions ?? HEIGHT_METER;
|
|
3379
|
+
const bottomHeight = feature3.properties.bottomHeight ?? bottomHeightOptions ?? 0;
|
|
3380
|
+
const extrudedPolygon = this.threeLayer.toExtrudePolygon(
|
|
3381
|
+
offsetFeature,
|
|
3382
|
+
{ asynchronous: true, ...options, height, bottomHeight, altitude },
|
|
3383
|
+
material
|
|
3384
|
+
);
|
|
3385
|
+
extrudedPolygon.on("click", (e) => {
|
|
3386
|
+
console.log(e.target.options.polygon.id);
|
|
3387
|
+
});
|
|
3388
|
+
const topLineStrings = [
|
|
3389
|
+
new maptalks4.LineString(outerRing),
|
|
3390
|
+
...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
|
|
3391
|
+
];
|
|
3392
|
+
const topLines = this.threeLayer.toLines(
|
|
3393
|
+
topLineStrings,
|
|
3394
|
+
{ altitude, bottomHeight: bottomHeight + height + 1e-3, interactive: false },
|
|
3395
|
+
this.lineMaterial
|
|
3396
|
+
);
|
|
3397
|
+
const bottomLineStrings = [
|
|
3398
|
+
new maptalks4.LineString(outerRing),
|
|
3399
|
+
...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
|
|
3400
|
+
];
|
|
3401
|
+
const bottomLines = this.threeLayer.toLines(
|
|
3402
|
+
bottomLineStrings,
|
|
3403
|
+
{ altitude, bottomHeight, interactive: false },
|
|
3404
|
+
this.lineMaterial
|
|
3405
|
+
);
|
|
3406
|
+
return [extrudedPolygon, topLines, bottomLines];
|
|
3407
|
+
} catch (err) {
|
|
3408
|
+
throw new Error(`Cannot create polygon, ${err.message}`);
|
|
3409
|
+
}
|
|
3420
3410
|
};
|
|
3421
3411
|
try {
|
|
3422
3412
|
switch (feature2.geometry.type) {
|
|
@@ -3436,7 +3426,7 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3436
3426
|
}
|
|
3437
3427
|
}
|
|
3438
3428
|
} catch (err) {
|
|
3439
|
-
console.log(`error createGeometry`, { feature: feature2, options });
|
|
3429
|
+
console.log(`error createGeometry`, err, { feature: feature2, options });
|
|
3440
3430
|
}
|
|
3441
3431
|
};
|
|
3442
3432
|
async createEscalator(f, coordinate, options) {
|
|
@@ -4006,6 +3996,8 @@ var RendererManager = class extends EventTarget {
|
|
|
4006
3996
|
}
|
|
4007
3997
|
const thisOrdinal = escalator.properties.ordinal;
|
|
4008
3998
|
const relationship = escalatorRelationships[0];
|
|
3999
|
+
if (!relationship.properties.origin?.id) throw new Error(`relationship (id=${relationship.id}) - origin not exists`);
|
|
4000
|
+
if (!relationship.properties.destination?.id) throw new Error(`relationship (id=${relationship.id}) - destination not exists`);
|
|
4009
4001
|
const bothOpeningIds = [relationship.properties.origin.id, relationship.properties.destination.id];
|
|
4010
4002
|
const bothOpenings = await Promise.all(
|
|
4011
4003
|
bothOpeningIds.map((id) => this.#dataClient.findById("opening", id, { populate: true }))
|
|
@@ -4021,7 +4013,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4021
4013
|
this.addElementsToManager(escalator.id, _elements, escalator.properties.ordinal);
|
|
4022
4014
|
}
|
|
4023
4015
|
} catch (err) {
|
|
4024
|
-
console.log(`cannot create escalator`, err);
|
|
4016
|
+
console.log(`cannot create escalator`, err.message);
|
|
4025
4017
|
}
|
|
4026
4018
|
}
|
|
4027
4019
|
this.changeLevelByOrdinal(this.currentOrdinals);
|
|
@@ -4157,7 +4149,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4157
4149
|
layers: []
|
|
4158
4150
|
});
|
|
4159
4151
|
this.rendererManager = new RendererManager(this.map, options.dataClient, options.renderer);
|
|
4160
|
-
this.camera = new CameraManager(this.map);
|
|
4152
|
+
this.camera = new CameraManager(this.map, options.camera);
|
|
4161
4153
|
this.locale = locale;
|
|
4162
4154
|
this.pixelRatio = pixelRatio;
|
|
4163
4155
|
this.onMapReady = onMapReady;
|
|
@@ -4175,12 +4167,12 @@ var IndoorMap = class extends EventTarget {
|
|
|
4175
4167
|
this.camera.setView({ center: center2, pitch: 60, zoom: 19 });
|
|
4176
4168
|
});
|
|
4177
4169
|
}
|
|
4178
|
-
on(eventName, handler) {
|
|
4179
|
-
this.map.on(eventName, handler);
|
|
4180
|
-
}
|
|
4181
4170
|
/**
|
|
4182
4171
|
* Events
|
|
4183
4172
|
*/
|
|
4173
|
+
on(eventName, handler) {
|
|
4174
|
+
this.map.on(eventName, handler);
|
|
4175
|
+
}
|
|
4184
4176
|
handleMapClick = ({ coordinate }) => {
|
|
4185
4177
|
const { x, y } = coordinate;
|
|
4186
4178
|
console.log(
|
|
@@ -4236,40 +4228,12 @@ var IndoorMap = class extends EventTarget {
|
|
|
4236
4228
|
this.map.off("moveend", this.#findAndSetVenueInView);
|
|
4237
4229
|
}
|
|
4238
4230
|
}
|
|
4239
|
-
get ordinals() {
|
|
4240
|
-
return this.#ordinals || [];
|
|
4241
|
-
}
|
|
4242
|
-
set ordinals(value) {
|
|
4243
|
-
if (!Array.isArray(value)) throw new Error("ordinals must be Array");
|
|
4244
|
-
this.#ordinals = value;
|
|
4245
|
-
}
|
|
4246
4231
|
set billboards(value) {
|
|
4247
4232
|
this.#billboards = value;
|
|
4248
4233
|
}
|
|
4249
|
-
set mapConfig(value) {
|
|
4250
|
-
this.#mapConfig = value;
|
|
4251
|
-
}
|
|
4252
4234
|
set mapDecorations(value) {
|
|
4253
4235
|
this.#mapDecorations = value;
|
|
4254
4236
|
}
|
|
4255
|
-
set maxZoom(value) {
|
|
4256
|
-
this.map.setMaxZoom(value);
|
|
4257
|
-
const spatialReference = {
|
|
4258
|
-
projection: "EPSG:3857",
|
|
4259
|
-
resolutions: (function() {
|
|
4260
|
-
const resolutions = [];
|
|
4261
|
-
const d = 2 * 6378137 * Math.PI;
|
|
4262
|
-
for (let i = 0; i < value; i++) {
|
|
4263
|
-
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
4264
|
-
}
|
|
4265
|
-
return resolutions;
|
|
4266
|
-
})()
|
|
4267
|
-
};
|
|
4268
|
-
this.map.setSpatialReference(spatialReference);
|
|
4269
|
-
}
|
|
4270
|
-
set minZoom(value) {
|
|
4271
|
-
this.map.setMinZoom(value);
|
|
4272
|
-
}
|
|
4273
4237
|
set groundLabels(value) {
|
|
4274
4238
|
this.#groundLabels = value;
|
|
4275
4239
|
}
|
|
@@ -4305,9 +4269,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4305
4269
|
this.#onClickElement(e);
|
|
4306
4270
|
this.#isClicked = false;
|
|
4307
4271
|
};
|
|
4308
|
-
setCenter(center2, padding) {
|
|
4309
|
-
this.map.setCenter(center2, padding);
|
|
4310
|
-
}
|
|
4311
4272
|
async #legacy_createElements() {
|
|
4312
4273
|
const {
|
|
4313
4274
|
// 2D
|
|
@@ -4529,7 +4490,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4529
4490
|
const {
|
|
4530
4491
|
geometry: { coordinates }
|
|
4531
4492
|
} = turfCenter3(feature2);
|
|
4532
|
-
this.camera.
|
|
4493
|
+
this.camera.animateTo({ center: coordinates, pitch: 45 });
|
|
4533
4494
|
});
|
|
4534
4495
|
object3ds.push(object);
|
|
4535
4496
|
this.#objects.push(object);
|
|
@@ -4612,27 +4573,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4612
4573
|
changeLevelByOrdinal(ordinal) {
|
|
4613
4574
|
this.rendererManager.changeLevelByOrdinal(ordinal);
|
|
4614
4575
|
}
|
|
4615
|
-
getFeatureExtent = (feature2, scaleFactor = 1) => {
|
|
4616
|
-
const [minX, minY, maxX, maxY] = index_default(
|
|
4617
|
-
scale(bboxPolygon(index_default(feature2)), scaleFactor)
|
|
4618
|
-
);
|
|
4619
|
-
return new Extent(minX, minY, maxX, maxY);
|
|
4620
|
-
};
|
|
4621
|
-
getExtentCenter = (extent) => {
|
|
4622
|
-
return extent.getCenter();
|
|
4623
|
-
};
|
|
4624
|
-
getExtentZoom = (extent, options = {
|
|
4625
|
-
isFraction: false,
|
|
4626
|
-
padding: {
|
|
4627
|
-
paddingLeft: 0,
|
|
4628
|
-
paddingRight: 0,
|
|
4629
|
-
paddingTop: 0,
|
|
4630
|
-
paddingBottom: 0
|
|
4631
|
-
}
|
|
4632
|
-
}) => {
|
|
4633
|
-
const { isFraction = false, padding } = options;
|
|
4634
|
-
return this.map.getFitZoom(extent, isFraction, padding);
|
|
4635
|
-
};
|
|
4636
4576
|
findVenueInView = () => {
|
|
4637
4577
|
const mapCenter = this.map.getCenter();
|
|
4638
4578
|
const result = this.#venues.reduce((closest, venue) => {
|
|
@@ -4645,9 +4585,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4645
4585
|
}, null);
|
|
4646
4586
|
return result;
|
|
4647
4587
|
};
|
|
4648
|
-
flyTo = (center2, options) => {
|
|
4649
|
-
this.camera.flyTo(center2, options);
|
|
4650
|
-
};
|
|
4651
4588
|
getLineStringBearing = (feature2) => {
|
|
4652
4589
|
const { geometry } = feature2;
|
|
4653
4590
|
const path = new LineString3(geometry.coordinates);
|
|
@@ -5163,33 +5100,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
5163
5100
|
/**
|
|
5164
5101
|
* render (frame)
|
|
5165
5102
|
*/
|
|
5166
|
-
getTargetViewCenter = (targetView, options = { offset: { top: 0, left: 0, right: 0, bottom: 0 } }) => {
|
|
5167
|
-
const map = this.map;
|
|
5168
|
-
const { offset } = options;
|
|
5169
|
-
const { top = 0, left = 0, right = 0, bottom = 0 } = offset;
|
|
5170
|
-
const originalState = {
|
|
5171
|
-
bearing: map.getBearing(),
|
|
5172
|
-
center: map.getCenter(),
|
|
5173
|
-
pitch: map.getPitch(),
|
|
5174
|
-
zoom: map.getZoom()
|
|
5175
|
-
};
|
|
5176
|
-
const finalView = {
|
|
5177
|
-
bearing: _6.isNil(targetView.bearing) ? map.getBearing() : targetView.bearing,
|
|
5178
|
-
center: _6.isNil(targetView.center) ? map.getCenter() : targetView.center,
|
|
5179
|
-
pitch: _6.isNil(targetView.pitch) ? map.getPitch() : targetView.pitch,
|
|
5180
|
-
zoom: _6.isNil(targetView.zoom) ? map.getZoom() : targetView.zoom
|
|
5181
|
-
};
|
|
5182
|
-
map.setView(finalView);
|
|
5183
|
-
const projectedTargetCenter = map.coordinateToContainerPoint(finalView.center).add(right / 2 - left / 2, bottom / 2 - top / 2);
|
|
5184
|
-
const adjustedTargetCenter = map.containerPointToCoordinate(
|
|
5185
|
-
projectedTargetCenter
|
|
5186
|
-
);
|
|
5187
|
-
map.setView(originalState);
|
|
5188
|
-
return adjustedTargetCenter;
|
|
5189
|
-
};
|
|
5190
|
-
setMaxExtent(extent) {
|
|
5191
|
-
return this.map.setMaxExtent(extent);
|
|
5192
|
-
}
|
|
5193
5103
|
render() {
|
|
5194
5104
|
const view = this.map.getView();
|
|
5195
5105
|
const currBearing = view.bearing;
|
|
@@ -5198,7 +5108,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
5198
5108
|
this.threeLayer.redraw();
|
|
5199
5109
|
}
|
|
5200
5110
|
if (this.threeLayer) {
|
|
5201
|
-
const
|
|
5111
|
+
const currentView = this.camera.getView();
|
|
5112
|
+
const objectOpacity = _6.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
5202
5113
|
this.#objects.forEach((object) => {
|
|
5203
5114
|
object.getObject3d().traverse((child) => {
|
|
5204
5115
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -5209,7 +5120,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5209
5120
|
if (this.#billboardObjects) {
|
|
5210
5121
|
this.#billboardObjects.forEach((object) => {
|
|
5211
5122
|
const objectScale = _6.clamp(
|
|
5212
|
-
20 - 1 *
|
|
5123
|
+
20 - 1 * currentView.zoom,
|
|
5213
5124
|
1,
|
|
5214
5125
|
1.05
|
|
5215
5126
|
);
|