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.js
CHANGED
|
@@ -751,132 +751,6 @@ function isNumber(num) {
|
|
|
751
751
|
// src/IndoorMap/IndoorMap.ts
|
|
752
752
|
var import_distance = __toESM(require("@turf/distance"));
|
|
753
753
|
var import_center4 = __toESM(require("@turf/center"));
|
|
754
|
-
|
|
755
|
-
// ../../node_modules/@turf/meta/dist/esm/index.js
|
|
756
|
-
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
757
|
-
if (geojson === null) return;
|
|
758
|
-
var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
759
|
-
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
760
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
761
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
762
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
763
|
-
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
764
|
-
var multiFeatureIndex = 0;
|
|
765
|
-
var geometryIndex = 0;
|
|
766
|
-
geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
767
|
-
if (geometry === null) continue;
|
|
768
|
-
coords = geometry.coordinates;
|
|
769
|
-
var geomType = geometry.type;
|
|
770
|
-
wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
|
|
771
|
-
switch (geomType) {
|
|
772
|
-
case null:
|
|
773
|
-
break;
|
|
774
|
-
case "Point":
|
|
775
|
-
if (callback(
|
|
776
|
-
coords,
|
|
777
|
-
coordIndex,
|
|
778
|
-
featureIndex,
|
|
779
|
-
multiFeatureIndex,
|
|
780
|
-
geometryIndex
|
|
781
|
-
) === false)
|
|
782
|
-
return false;
|
|
783
|
-
coordIndex++;
|
|
784
|
-
multiFeatureIndex++;
|
|
785
|
-
break;
|
|
786
|
-
case "LineString":
|
|
787
|
-
case "MultiPoint":
|
|
788
|
-
for (j = 0; j < coords.length; j++) {
|
|
789
|
-
if (callback(
|
|
790
|
-
coords[j],
|
|
791
|
-
coordIndex,
|
|
792
|
-
featureIndex,
|
|
793
|
-
multiFeatureIndex,
|
|
794
|
-
geometryIndex
|
|
795
|
-
) === false)
|
|
796
|
-
return false;
|
|
797
|
-
coordIndex++;
|
|
798
|
-
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
799
|
-
}
|
|
800
|
-
if (geomType === "LineString") multiFeatureIndex++;
|
|
801
|
-
break;
|
|
802
|
-
case "Polygon":
|
|
803
|
-
case "MultiLineString":
|
|
804
|
-
for (j = 0; j < coords.length; j++) {
|
|
805
|
-
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
806
|
-
if (callback(
|
|
807
|
-
coords[j][k],
|
|
808
|
-
coordIndex,
|
|
809
|
-
featureIndex,
|
|
810
|
-
multiFeatureIndex,
|
|
811
|
-
geometryIndex
|
|
812
|
-
) === false)
|
|
813
|
-
return false;
|
|
814
|
-
coordIndex++;
|
|
815
|
-
}
|
|
816
|
-
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
817
|
-
if (geomType === "Polygon") geometryIndex++;
|
|
818
|
-
}
|
|
819
|
-
if (geomType === "Polygon") multiFeatureIndex++;
|
|
820
|
-
break;
|
|
821
|
-
case "MultiPolygon":
|
|
822
|
-
for (j = 0; j < coords.length; j++) {
|
|
823
|
-
geometryIndex = 0;
|
|
824
|
-
for (k = 0; k < coords[j].length; k++) {
|
|
825
|
-
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
|
826
|
-
if (callback(
|
|
827
|
-
coords[j][k][l],
|
|
828
|
-
coordIndex,
|
|
829
|
-
featureIndex,
|
|
830
|
-
multiFeatureIndex,
|
|
831
|
-
geometryIndex
|
|
832
|
-
) === false)
|
|
833
|
-
return false;
|
|
834
|
-
coordIndex++;
|
|
835
|
-
}
|
|
836
|
-
geometryIndex++;
|
|
837
|
-
}
|
|
838
|
-
multiFeatureIndex++;
|
|
839
|
-
}
|
|
840
|
-
break;
|
|
841
|
-
case "GeometryCollection":
|
|
842
|
-
for (j = 0; j < geometry.geometries.length; j++)
|
|
843
|
-
if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
|
|
844
|
-
return false;
|
|
845
|
-
break;
|
|
846
|
-
default:
|
|
847
|
-
throw new Error("Unknown Geometry Type");
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
854
|
-
function bbox(geojson, options = {}) {
|
|
855
|
-
if (geojson.bbox != null && true !== options.recompute) {
|
|
856
|
-
return geojson.bbox;
|
|
857
|
-
}
|
|
858
|
-
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
859
|
-
coordEach(geojson, (coord) => {
|
|
860
|
-
if (result[0] > coord[0]) {
|
|
861
|
-
result[0] = coord[0];
|
|
862
|
-
}
|
|
863
|
-
if (result[1] > coord[1]) {
|
|
864
|
-
result[1] = coord[1];
|
|
865
|
-
}
|
|
866
|
-
if (result[2] < coord[0]) {
|
|
867
|
-
result[2] = coord[0];
|
|
868
|
-
}
|
|
869
|
-
if (result[3] < coord[1]) {
|
|
870
|
-
result[3] = coord[1];
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
|
-
return result;
|
|
874
|
-
}
|
|
875
|
-
var index_default = bbox;
|
|
876
|
-
|
|
877
|
-
// src/IndoorMap/IndoorMap.ts
|
|
878
|
-
var import_transform_scale = __toESM(require("@turf/transform-scale"));
|
|
879
|
-
var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
|
|
880
754
|
var import_three8 = require("three");
|
|
881
755
|
|
|
882
756
|
// src/IndoorMap/constants.ts
|
|
@@ -3056,8 +2930,133 @@ var createHighlighExtrudeObjectController = (obj, { color }) => {
|
|
|
3056
2930
|
};
|
|
3057
2931
|
|
|
3058
2932
|
// src/IndoorMap/camera/CameraManager.ts
|
|
3059
|
-
var
|
|
3060
|
-
|
|
2933
|
+
var import_maptalks6 = require("maptalks");
|
|
2934
|
+
|
|
2935
|
+
// ../../node_modules/@turf/meta/dist/esm/index.js
|
|
2936
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
2937
|
+
if (geojson === null) return;
|
|
2938
|
+
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;
|
|
2939
|
+
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
2940
|
+
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
2941
|
+
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
2942
|
+
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
2943
|
+
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
2944
|
+
var multiFeatureIndex = 0;
|
|
2945
|
+
var geometryIndex = 0;
|
|
2946
|
+
geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
2947
|
+
if (geometry === null) continue;
|
|
2948
|
+
coords = geometry.coordinates;
|
|
2949
|
+
var geomType = geometry.type;
|
|
2950
|
+
wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
|
|
2951
|
+
switch (geomType) {
|
|
2952
|
+
case null:
|
|
2953
|
+
break;
|
|
2954
|
+
case "Point":
|
|
2955
|
+
if (callback(
|
|
2956
|
+
coords,
|
|
2957
|
+
coordIndex,
|
|
2958
|
+
featureIndex,
|
|
2959
|
+
multiFeatureIndex,
|
|
2960
|
+
geometryIndex
|
|
2961
|
+
) === false)
|
|
2962
|
+
return false;
|
|
2963
|
+
coordIndex++;
|
|
2964
|
+
multiFeatureIndex++;
|
|
2965
|
+
break;
|
|
2966
|
+
case "LineString":
|
|
2967
|
+
case "MultiPoint":
|
|
2968
|
+
for (j = 0; j < coords.length; j++) {
|
|
2969
|
+
if (callback(
|
|
2970
|
+
coords[j],
|
|
2971
|
+
coordIndex,
|
|
2972
|
+
featureIndex,
|
|
2973
|
+
multiFeatureIndex,
|
|
2974
|
+
geometryIndex
|
|
2975
|
+
) === false)
|
|
2976
|
+
return false;
|
|
2977
|
+
coordIndex++;
|
|
2978
|
+
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
2979
|
+
}
|
|
2980
|
+
if (geomType === "LineString") multiFeatureIndex++;
|
|
2981
|
+
break;
|
|
2982
|
+
case "Polygon":
|
|
2983
|
+
case "MultiLineString":
|
|
2984
|
+
for (j = 0; j < coords.length; j++) {
|
|
2985
|
+
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
2986
|
+
if (callback(
|
|
2987
|
+
coords[j][k],
|
|
2988
|
+
coordIndex,
|
|
2989
|
+
featureIndex,
|
|
2990
|
+
multiFeatureIndex,
|
|
2991
|
+
geometryIndex
|
|
2992
|
+
) === false)
|
|
2993
|
+
return false;
|
|
2994
|
+
coordIndex++;
|
|
2995
|
+
}
|
|
2996
|
+
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
2997
|
+
if (geomType === "Polygon") geometryIndex++;
|
|
2998
|
+
}
|
|
2999
|
+
if (geomType === "Polygon") multiFeatureIndex++;
|
|
3000
|
+
break;
|
|
3001
|
+
case "MultiPolygon":
|
|
3002
|
+
for (j = 0; j < coords.length; j++) {
|
|
3003
|
+
geometryIndex = 0;
|
|
3004
|
+
for (k = 0; k < coords[j].length; k++) {
|
|
3005
|
+
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
|
3006
|
+
if (callback(
|
|
3007
|
+
coords[j][k][l],
|
|
3008
|
+
coordIndex,
|
|
3009
|
+
featureIndex,
|
|
3010
|
+
multiFeatureIndex,
|
|
3011
|
+
geometryIndex
|
|
3012
|
+
) === false)
|
|
3013
|
+
return false;
|
|
3014
|
+
coordIndex++;
|
|
3015
|
+
}
|
|
3016
|
+
geometryIndex++;
|
|
3017
|
+
}
|
|
3018
|
+
multiFeatureIndex++;
|
|
3019
|
+
}
|
|
3020
|
+
break;
|
|
3021
|
+
case "GeometryCollection":
|
|
3022
|
+
for (j = 0; j < geometry.geometries.length; j++)
|
|
3023
|
+
if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
|
|
3024
|
+
return false;
|
|
3025
|
+
break;
|
|
3026
|
+
default:
|
|
3027
|
+
throw new Error("Unknown Geometry Type");
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
// ../../node_modules/@turf/bbox/dist/esm/index.js
|
|
3034
|
+
function bbox(geojson, options = {}) {
|
|
3035
|
+
if (geojson.bbox != null && true !== options.recompute) {
|
|
3036
|
+
return geojson.bbox;
|
|
3037
|
+
}
|
|
3038
|
+
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
3039
|
+
coordEach(geojson, (coord) => {
|
|
3040
|
+
if (result[0] > coord[0]) {
|
|
3041
|
+
result[0] = coord[0];
|
|
3042
|
+
}
|
|
3043
|
+
if (result[1] > coord[1]) {
|
|
3044
|
+
result[1] = coord[1];
|
|
3045
|
+
}
|
|
3046
|
+
if (result[2] < coord[0]) {
|
|
3047
|
+
result[2] = coord[0];
|
|
3048
|
+
}
|
|
3049
|
+
if (result[3] < coord[1]) {
|
|
3050
|
+
result[3] = coord[1];
|
|
3051
|
+
}
|
|
3052
|
+
});
|
|
3053
|
+
return result;
|
|
3054
|
+
}
|
|
3055
|
+
var index_default = bbox;
|
|
3056
|
+
|
|
3057
|
+
// src/IndoorMap/camera/CameraManager.ts
|
|
3058
|
+
var import_transform_scale = __toESM(require("@turf/transform-scale"));
|
|
3059
|
+
var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
|
|
3061
3060
|
var CameraManager = class {
|
|
3062
3061
|
map;
|
|
3063
3062
|
constructor(map, options) {
|
|
@@ -3066,73 +3065,61 @@ var CameraManager = class {
|
|
|
3066
3065
|
this.setView(options?.defaultView);
|
|
3067
3066
|
}
|
|
3068
3067
|
}
|
|
3069
|
-
/** Private method */
|
|
3070
|
-
#animateflyTo(viewOptions = {}, options = {}, callbackOption = () => {
|
|
3071
|
-
}) {
|
|
3072
|
-
const { start, end } = {
|
|
3073
|
-
start: (frame) => {
|
|
3074
|
-
},
|
|
3075
|
-
end: (frame) => {
|
|
3076
|
-
},
|
|
3077
|
-
...callbackOption
|
|
3078
|
-
};
|
|
3079
|
-
this.map.flyTo(viewOptions, options, (frame) => {
|
|
3080
|
-
if (frame.state.playState === "running" && frame.state.progress === 0)
|
|
3081
|
-
start(frame);
|
|
3082
|
-
if (frame.state.playState === "finished") end(frame);
|
|
3083
|
-
});
|
|
3084
|
-
}
|
|
3085
3068
|
/** Public methods */
|
|
3086
3069
|
getView = () => {
|
|
3087
3070
|
return this.map.getView();
|
|
3088
3071
|
};
|
|
3089
|
-
getZoom = () => {
|
|
3090
|
-
return this.map.getView().zoom;
|
|
3091
|
-
};
|
|
3092
3072
|
setView = (value) => {
|
|
3093
3073
|
this.map.setView(value);
|
|
3094
3074
|
};
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
const {
|
|
3098
|
-
zoom = ZOOM_OUT_LEVEL,
|
|
3099
|
-
pitch = 60,
|
|
3100
|
-
duration = 600,
|
|
3101
|
-
easing = "out",
|
|
3102
|
-
bearing = currentView.bearing
|
|
3103
|
-
} = options;
|
|
3104
|
-
this.#animateflyTo(
|
|
3105
|
-
{
|
|
3106
|
-
center: center2,
|
|
3107
|
-
zoom,
|
|
3108
|
-
pitch,
|
|
3109
|
-
bearing
|
|
3110
|
-
},
|
|
3111
|
-
{ duration, easing }
|
|
3112
|
-
);
|
|
3075
|
+
animateTo = (view, options = {}, step) => {
|
|
3076
|
+
this.map.animateTo(view, options, step);
|
|
3113
3077
|
};
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
} = options;
|
|
3121
|
-
this.#animateflyTo(
|
|
3122
|
-
{
|
|
3123
|
-
center: centerPoint,
|
|
3124
|
-
zoom,
|
|
3125
|
-
pitch
|
|
3126
|
-
},
|
|
3127
|
-
{ duration, easing }
|
|
3078
|
+
setMaxExtent(extent) {
|
|
3079
|
+
return this.map.setMaxExtent(extent);
|
|
3080
|
+
}
|
|
3081
|
+
getFeatureExtent = (feature2, scaleFactor = 1) => {
|
|
3082
|
+
const [minX, minY, maxX, maxY] = index_default(
|
|
3083
|
+
(0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
|
|
3128
3084
|
);
|
|
3085
|
+
return new import_maptalks6.Extent(minX, minY, maxX, maxY);
|
|
3129
3086
|
};
|
|
3087
|
+
getExtentZoom = (extent, options = {
|
|
3088
|
+
isFraction: false,
|
|
3089
|
+
padding: {
|
|
3090
|
+
paddingLeft: 0,
|
|
3091
|
+
paddingRight: 0,
|
|
3092
|
+
paddingTop: 0,
|
|
3093
|
+
paddingBottom: 0
|
|
3094
|
+
}
|
|
3095
|
+
}) => {
|
|
3096
|
+
const { isFraction = false, padding } = options;
|
|
3097
|
+
return this.map.getFitZoom(extent, isFraction, padding);
|
|
3098
|
+
};
|
|
3099
|
+
set maxZoom(value) {
|
|
3100
|
+
this.map.setMaxZoom(value);
|
|
3101
|
+
const spatialReference = {
|
|
3102
|
+
projection: "EPSG:3857",
|
|
3103
|
+
resolutions: (function() {
|
|
3104
|
+
const resolutions = [];
|
|
3105
|
+
const d = 2 * 6378137 * Math.PI;
|
|
3106
|
+
for (let i = 0; i < value; i++) {
|
|
3107
|
+
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
3108
|
+
}
|
|
3109
|
+
return resolutions;
|
|
3110
|
+
})()
|
|
3111
|
+
};
|
|
3112
|
+
this.map.setSpatialReference(spatialReference);
|
|
3113
|
+
}
|
|
3114
|
+
set minZoom(value) {
|
|
3115
|
+
this.map.setMinZoom(value);
|
|
3116
|
+
}
|
|
3130
3117
|
};
|
|
3131
3118
|
|
|
3132
3119
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
3133
3120
|
var import_min = __toESM(require("lodash/min"));
|
|
3134
3121
|
var import_center3 = require("@turf/center");
|
|
3135
|
-
var
|
|
3122
|
+
var import_maptalks9 = require("maptalks.three");
|
|
3136
3123
|
var THREE3 = __toESM(require("three"));
|
|
3137
3124
|
|
|
3138
3125
|
// src/IndoorMap/renderer/3d/Element3DRenderer.ts
|
|
@@ -3168,9 +3155,9 @@ var element3DRendererOptions = {
|
|
|
3168
3155
|
};
|
|
3169
3156
|
|
|
3170
3157
|
// src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
|
|
3171
|
-
var
|
|
3158
|
+
var import_maptalks7 = require("maptalks");
|
|
3172
3159
|
var THREE = __toESM(require("three"));
|
|
3173
|
-
var
|
|
3160
|
+
var import_maptalks8 = require("maptalks.three");
|
|
3174
3161
|
var import_lodash6 = require("lodash");
|
|
3175
3162
|
|
|
3176
3163
|
// src/IndoorMap/renderer/utils/interpolateStops.ts
|
|
@@ -3208,12 +3195,12 @@ var OPTIONS4 = {
|
|
|
3208
3195
|
altitude: 0,
|
|
3209
3196
|
opacity: 1
|
|
3210
3197
|
};
|
|
3211
|
-
var TextSpriteMarker = class extends
|
|
3198
|
+
var TextSpriteMarker = class extends import_maptalks8.BaseObject {
|
|
3212
3199
|
#altitudeOffset = 0;
|
|
3213
3200
|
constructor(coordinate, options, layer, properties = {}) {
|
|
3214
|
-
options =
|
|
3201
|
+
options = import_maptalks7.Util.extend({}, OPTIONS4, options, { layer });
|
|
3215
3202
|
super();
|
|
3216
|
-
this._coordinate = new
|
|
3203
|
+
this._coordinate = new import_maptalks7.Coordinate(coordinate);
|
|
3217
3204
|
this._initOptions(options);
|
|
3218
3205
|
this._createGroup();
|
|
3219
3206
|
this.properties = { ...properties };
|
|
@@ -3428,41 +3415,45 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3428
3415
|
} = getGeometryOption(feature2, this.options);
|
|
3429
3416
|
const _this = this;
|
|
3430
3417
|
const createPolygon = (geometry, feature3) => {
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3418
|
+
try {
|
|
3419
|
+
const [outerRing, ...innerRings] = geometry.coordinates;
|
|
3420
|
+
const offsetFeature = offset !== 0 ? (0, import_buffer2.default)(geometry, offset, { units: "meters" }) : feature3;
|
|
3421
|
+
const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#ffffff";
|
|
3422
|
+
if (color === "transparent") return;
|
|
3423
|
+
const material = this.getOrCreateMaterialByColor(color);
|
|
3424
|
+
const altitude = feature3.properties.ordinal * HEIGHT_METER;
|
|
3425
|
+
const height = feature3.properties.height ?? heightOptions ?? HEIGHT_METER;
|
|
3426
|
+
const bottomHeight = feature3.properties.bottomHeight ?? bottomHeightOptions ?? 0;
|
|
3427
|
+
const extrudedPolygon = this.threeLayer.toExtrudePolygon(
|
|
3428
|
+
offsetFeature,
|
|
3429
|
+
{ asynchronous: true, ...options, height, bottomHeight, altitude },
|
|
3430
|
+
material
|
|
3431
|
+
);
|
|
3432
|
+
extrudedPolygon.on("click", (e) => {
|
|
3433
|
+
console.log(e.target.options.polygon.id);
|
|
3434
|
+
});
|
|
3435
|
+
const topLineStrings = [
|
|
3436
|
+
new maptalks4.LineString(outerRing),
|
|
3437
|
+
...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
|
|
3438
|
+
];
|
|
3439
|
+
const topLines = this.threeLayer.toLines(
|
|
3440
|
+
topLineStrings,
|
|
3441
|
+
{ altitude, bottomHeight: bottomHeight + height + 1e-3, interactive: false },
|
|
3442
|
+
this.lineMaterial
|
|
3443
|
+
);
|
|
3444
|
+
const bottomLineStrings = [
|
|
3445
|
+
new maptalks4.LineString(outerRing),
|
|
3446
|
+
...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
|
|
3447
|
+
];
|
|
3448
|
+
const bottomLines = this.threeLayer.toLines(
|
|
3449
|
+
bottomLineStrings,
|
|
3450
|
+
{ altitude, bottomHeight, interactive: false },
|
|
3451
|
+
this.lineMaterial
|
|
3452
|
+
);
|
|
3453
|
+
return [extrudedPolygon, topLines, bottomLines];
|
|
3454
|
+
} catch (err) {
|
|
3455
|
+
throw new Error(`Cannot create polygon, ${err.message}`);
|
|
3456
|
+
}
|
|
3466
3457
|
};
|
|
3467
3458
|
try {
|
|
3468
3459
|
switch (feature2.geometry.type) {
|
|
@@ -3482,7 +3473,7 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3482
3473
|
}
|
|
3483
3474
|
}
|
|
3484
3475
|
} catch (err) {
|
|
3485
|
-
console.log(`error createGeometry`, { feature: feature2, options });
|
|
3476
|
+
console.log(`error createGeometry`, err, { feature: feature2, options });
|
|
3486
3477
|
}
|
|
3487
3478
|
};
|
|
3488
3479
|
async createEscalator(f, coordinate, options) {
|
|
@@ -3943,7 +3934,7 @@ var RendererManager = class extends EventTarget {
|
|
|
3943
3934
|
this.markersByOrdinal = /* @__PURE__ */ new Map();
|
|
3944
3935
|
this.#dataClient = dataClient;
|
|
3945
3936
|
if (options.type === "3D") {
|
|
3946
|
-
const threeLayer = new
|
|
3937
|
+
const threeLayer = new import_maptalks9.ThreeLayer("elements", {
|
|
3947
3938
|
forceRenderOnMoving: true,
|
|
3948
3939
|
forceRenderOnRotating: true
|
|
3949
3940
|
});
|
|
@@ -4052,6 +4043,8 @@ var RendererManager = class extends EventTarget {
|
|
|
4052
4043
|
}
|
|
4053
4044
|
const thisOrdinal = escalator.properties.ordinal;
|
|
4054
4045
|
const relationship = escalatorRelationships[0];
|
|
4046
|
+
if (!relationship.properties.origin?.id) throw new Error(`relationship (id=${relationship.id}) - origin not exists`);
|
|
4047
|
+
if (!relationship.properties.destination?.id) throw new Error(`relationship (id=${relationship.id}) - destination not exists`);
|
|
4055
4048
|
const bothOpeningIds = [relationship.properties.origin.id, relationship.properties.destination.id];
|
|
4056
4049
|
const bothOpenings = await Promise.all(
|
|
4057
4050
|
bothOpeningIds.map((id) => this.#dataClient.findById("opening", id, { populate: true }))
|
|
@@ -4067,7 +4060,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4067
4060
|
this.addElementsToManager(escalator.id, _elements, escalator.properties.ordinal);
|
|
4068
4061
|
}
|
|
4069
4062
|
} catch (err) {
|
|
4070
|
-
console.log(`cannot create escalator`, err);
|
|
4063
|
+
console.log(`cannot create escalator`, err.message);
|
|
4071
4064
|
}
|
|
4072
4065
|
}
|
|
4073
4066
|
this.changeLevelByOrdinal(this.currentOrdinals);
|
|
@@ -4203,7 +4196,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4203
4196
|
layers: []
|
|
4204
4197
|
});
|
|
4205
4198
|
this.rendererManager = new RendererManager(this.map, options.dataClient, options.renderer);
|
|
4206
|
-
this.camera = new CameraManager(this.map);
|
|
4199
|
+
this.camera = new CameraManager(this.map, options.camera);
|
|
4207
4200
|
this.locale = locale;
|
|
4208
4201
|
this.pixelRatio = pixelRatio;
|
|
4209
4202
|
this.onMapReady = onMapReady;
|
|
@@ -4221,12 +4214,12 @@ var IndoorMap = class extends EventTarget {
|
|
|
4221
4214
|
this.camera.setView({ center: center2, pitch: 60, zoom: 19 });
|
|
4222
4215
|
});
|
|
4223
4216
|
}
|
|
4224
|
-
on(eventName, handler) {
|
|
4225
|
-
this.map.on(eventName, handler);
|
|
4226
|
-
}
|
|
4227
4217
|
/**
|
|
4228
4218
|
* Events
|
|
4229
4219
|
*/
|
|
4220
|
+
on(eventName, handler) {
|
|
4221
|
+
this.map.on(eventName, handler);
|
|
4222
|
+
}
|
|
4230
4223
|
handleMapClick = ({ coordinate }) => {
|
|
4231
4224
|
const { x, y } = coordinate;
|
|
4232
4225
|
console.log(
|
|
@@ -4282,40 +4275,12 @@ var IndoorMap = class extends EventTarget {
|
|
|
4282
4275
|
this.map.off("moveend", this.#findAndSetVenueInView);
|
|
4283
4276
|
}
|
|
4284
4277
|
}
|
|
4285
|
-
get ordinals() {
|
|
4286
|
-
return this.#ordinals || [];
|
|
4287
|
-
}
|
|
4288
|
-
set ordinals(value) {
|
|
4289
|
-
if (!Array.isArray(value)) throw new Error("ordinals must be Array");
|
|
4290
|
-
this.#ordinals = value;
|
|
4291
|
-
}
|
|
4292
4278
|
set billboards(value) {
|
|
4293
4279
|
this.#billboards = value;
|
|
4294
4280
|
}
|
|
4295
|
-
set mapConfig(value) {
|
|
4296
|
-
this.#mapConfig = value;
|
|
4297
|
-
}
|
|
4298
4281
|
set mapDecorations(value) {
|
|
4299
4282
|
this.#mapDecorations = value;
|
|
4300
4283
|
}
|
|
4301
|
-
set maxZoom(value) {
|
|
4302
|
-
this.map.setMaxZoom(value);
|
|
4303
|
-
const spatialReference = {
|
|
4304
|
-
projection: "EPSG:3857",
|
|
4305
|
-
resolutions: (function() {
|
|
4306
|
-
const resolutions = [];
|
|
4307
|
-
const d = 2 * 6378137 * Math.PI;
|
|
4308
|
-
for (let i = 0; i < value; i++) {
|
|
4309
|
-
resolutions[i] = d / (256 * Math.pow(2, i));
|
|
4310
|
-
}
|
|
4311
|
-
return resolutions;
|
|
4312
|
-
})()
|
|
4313
|
-
};
|
|
4314
|
-
this.map.setSpatialReference(spatialReference);
|
|
4315
|
-
}
|
|
4316
|
-
set minZoom(value) {
|
|
4317
|
-
this.map.setMinZoom(value);
|
|
4318
|
-
}
|
|
4319
4284
|
set groundLabels(value) {
|
|
4320
4285
|
this.#groundLabels = value;
|
|
4321
4286
|
}
|
|
@@ -4351,9 +4316,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4351
4316
|
this.#onClickElement(e);
|
|
4352
4317
|
this.#isClicked = false;
|
|
4353
4318
|
};
|
|
4354
|
-
setCenter(center2, padding) {
|
|
4355
|
-
this.map.setCenter(center2, padding);
|
|
4356
|
-
}
|
|
4357
4319
|
async #legacy_createElements() {
|
|
4358
4320
|
const {
|
|
4359
4321
|
// 2D
|
|
@@ -4575,7 +4537,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4575
4537
|
const {
|
|
4576
4538
|
geometry: { coordinates }
|
|
4577
4539
|
} = (0, import_center4.default)(feature2);
|
|
4578
|
-
this.camera.
|
|
4540
|
+
this.camera.animateTo({ center: coordinates, pitch: 45 });
|
|
4579
4541
|
});
|
|
4580
4542
|
object3ds.push(object);
|
|
4581
4543
|
this.#objects.push(object);
|
|
@@ -4658,27 +4620,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4658
4620
|
changeLevelByOrdinal(ordinal) {
|
|
4659
4621
|
this.rendererManager.changeLevelByOrdinal(ordinal);
|
|
4660
4622
|
}
|
|
4661
|
-
getFeatureExtent = (feature2, scaleFactor = 1) => {
|
|
4662
|
-
const [minX, minY, maxX, maxY] = index_default(
|
|
4663
|
-
(0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
|
|
4664
|
-
);
|
|
4665
|
-
return new import_maptalks_gl.Extent(minX, minY, maxX, maxY);
|
|
4666
|
-
};
|
|
4667
|
-
getExtentCenter = (extent) => {
|
|
4668
|
-
return extent.getCenter();
|
|
4669
|
-
};
|
|
4670
|
-
getExtentZoom = (extent, options = {
|
|
4671
|
-
isFraction: false,
|
|
4672
|
-
padding: {
|
|
4673
|
-
paddingLeft: 0,
|
|
4674
|
-
paddingRight: 0,
|
|
4675
|
-
paddingTop: 0,
|
|
4676
|
-
paddingBottom: 0
|
|
4677
|
-
}
|
|
4678
|
-
}) => {
|
|
4679
|
-
const { isFraction = false, padding } = options;
|
|
4680
|
-
return this.map.getFitZoom(extent, isFraction, padding);
|
|
4681
|
-
};
|
|
4682
4623
|
findVenueInView = () => {
|
|
4683
4624
|
const mapCenter = this.map.getCenter();
|
|
4684
4625
|
const result = this.#venues.reduce((closest, venue) => {
|
|
@@ -4691,9 +4632,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4691
4632
|
}, null);
|
|
4692
4633
|
return result;
|
|
4693
4634
|
};
|
|
4694
|
-
flyTo = (center2, options) => {
|
|
4695
|
-
this.camera.flyTo(center2, options);
|
|
4696
|
-
};
|
|
4697
4635
|
getLineStringBearing = (feature2) => {
|
|
4698
4636
|
const { geometry } = feature2;
|
|
4699
4637
|
const path = new import_maptalks_gl.LineString(geometry.coordinates);
|
|
@@ -5209,33 +5147,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
5209
5147
|
/**
|
|
5210
5148
|
* render (frame)
|
|
5211
5149
|
*/
|
|
5212
|
-
getTargetViewCenter = (targetView, options = { offset: { top: 0, left: 0, right: 0, bottom: 0 } }) => {
|
|
5213
|
-
const map = this.map;
|
|
5214
|
-
const { offset } = options;
|
|
5215
|
-
const { top = 0, left = 0, right = 0, bottom = 0 } = offset;
|
|
5216
|
-
const originalState = {
|
|
5217
|
-
bearing: map.getBearing(),
|
|
5218
|
-
center: map.getCenter(),
|
|
5219
|
-
pitch: map.getPitch(),
|
|
5220
|
-
zoom: map.getZoom()
|
|
5221
|
-
};
|
|
5222
|
-
const finalView = {
|
|
5223
|
-
bearing: import_lodash7.default.isNil(targetView.bearing) ? map.getBearing() : targetView.bearing,
|
|
5224
|
-
center: import_lodash7.default.isNil(targetView.center) ? map.getCenter() : targetView.center,
|
|
5225
|
-
pitch: import_lodash7.default.isNil(targetView.pitch) ? map.getPitch() : targetView.pitch,
|
|
5226
|
-
zoom: import_lodash7.default.isNil(targetView.zoom) ? map.getZoom() : targetView.zoom
|
|
5227
|
-
};
|
|
5228
|
-
map.setView(finalView);
|
|
5229
|
-
const projectedTargetCenter = map.coordinateToContainerPoint(finalView.center).add(right / 2 - left / 2, bottom / 2 - top / 2);
|
|
5230
|
-
const adjustedTargetCenter = map.containerPointToCoordinate(
|
|
5231
|
-
projectedTargetCenter
|
|
5232
|
-
);
|
|
5233
|
-
map.setView(originalState);
|
|
5234
|
-
return adjustedTargetCenter;
|
|
5235
|
-
};
|
|
5236
|
-
setMaxExtent(extent) {
|
|
5237
|
-
return this.map.setMaxExtent(extent);
|
|
5238
|
-
}
|
|
5239
5150
|
render() {
|
|
5240
5151
|
const view = this.map.getView();
|
|
5241
5152
|
const currBearing = view.bearing;
|
|
@@ -5244,7 +5155,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
5244
5155
|
this.threeLayer.redraw();
|
|
5245
5156
|
}
|
|
5246
5157
|
if (this.threeLayer) {
|
|
5247
|
-
const
|
|
5158
|
+
const currentView = this.camera.getView();
|
|
5159
|
+
const objectOpacity = import_lodash7.default.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
5248
5160
|
this.#objects.forEach((object) => {
|
|
5249
5161
|
object.getObject3d().traverse((child) => {
|
|
5250
5162
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -5255,7 +5167,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5255
5167
|
if (this.#billboardObjects) {
|
|
5256
5168
|
this.#billboardObjects.forEach((object) => {
|
|
5257
5169
|
const objectScale = import_lodash7.default.clamp(
|
|
5258
|
-
20 - 1 *
|
|
5170
|
+
20 - 1 * currentView.zoom,
|
|
5259
5171
|
1,
|
|
5260
5172
|
1.05
|
|
5261
5173
|
);
|