web3dlink 2.1.14 → 2.1.16
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/web3dlink.js +321 -4
- package/dist/web3dlink.js.map +1 -1
- package/package.json +1 -1
package/dist/web3dlink.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), name = "web3dlink", version$1 = "2.1.
|
|
2
|
+
var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), name = "web3dlink", version$1 = "2.1.16", description = "LarkSR / ZS 推流 GameAPI SDK", type = "module", main = "./dist/web3dlink.js", module$1 = "./dist/web3dlink.js", exports$1 = { ".": {
|
|
3
3
|
import: "./dist/web3dlink.js",
|
|
4
4
|
default: "./dist/web3dlink.js"
|
|
5
5
|
} }, files = ["dist"], scripts = {
|
|
@@ -746,7 +746,7 @@ function viewLock(e = {}) {
|
|
|
746
746
|
}
|
|
747
747
|
//#endregion
|
|
748
748
|
//#region api/camera/cameraApi.js
|
|
749
|
-
var validator$
|
|
749
|
+
var validator$11 = {
|
|
750
750
|
flyTo,
|
|
751
751
|
focusToID,
|
|
752
752
|
focusToPoint,
|
|
@@ -762,7 +762,268 @@ var validator$10 = {
|
|
|
762
762
|
this.commandManager = e;
|
|
763
763
|
}
|
|
764
764
|
_handleSend(e, t = {}) {
|
|
765
|
-
let n = `camera.${e}`, r = validator$
|
|
765
|
+
let n = `camera.${e}`, r = validator$11[e], i = r ? r(t) : {
|
|
766
|
+
errors: [],
|
|
767
|
+
normalized: t
|
|
768
|
+
};
|
|
769
|
+
return this.commandManager.sendWithDefault(i, n);
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region api/cesium/validate.js
|
|
774
|
+
function validatePointsArray(e, t = {}) {
|
|
775
|
+
let { minLength: n = 2, exactLength: r = null, field: i = "points" } = t, a = [], o = [];
|
|
776
|
+
return !e || !Array.isArray(e) ? (a.push(`[${i}] 为必填项,且必须是数组类型`), {
|
|
777
|
+
errors: a,
|
|
778
|
+
validPoints: o
|
|
779
|
+
}) : (r !== null && e.length !== r ? a.push(`[${i}] 长度必须为 ${r}`) : r === null && e.length < n && a.push(`[${i}] 至少需要 ${n} 个坐标点`), e.forEach((e, t) => {
|
|
780
|
+
if (!Array.isArray(e) || e.length < 3) {
|
|
781
|
+
a.push(`[${i}[${t}]] 坐标点格式错误,应为 [经度, 纬度, 高度]`);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
let [n, r, s] = e;
|
|
785
|
+
isValidNumber(n, -180, 180) || a.push(`[${i}[${t}][0]] 经度取值范围:-180~180`), isValidNumber(r, -90, 90) || a.push(`[${i}[${t}][1]] 纬度取值范围:-90~90`), isValidNumber(s) || a.push(`[${i}[${t}][2]] 高度必须是数字类型`), isValidNumber(n, -180, 180) && isValidNumber(r, -90, 90) && isValidNumber(s) && o.push([
|
|
786
|
+
n,
|
|
787
|
+
r,
|
|
788
|
+
s
|
|
789
|
+
]);
|
|
790
|
+
}), {
|
|
791
|
+
errors: a,
|
|
792
|
+
validPoints: o
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
function applyValidPoints(e, t, n) {
|
|
796
|
+
(n.exactLength != null && t.length === n.exactLength || n.exactLength == null && t.length >= (n.minLength || 0)) && (e.points = t);
|
|
797
|
+
}
|
|
798
|
+
function addMultiLine(e = {}) {
|
|
799
|
+
let t = [], n = { ...e };
|
|
800
|
+
t.push(...validateRequiredString({
|
|
801
|
+
normalized: n,
|
|
802
|
+
field: "name",
|
|
803
|
+
value: e.name
|
|
804
|
+
}));
|
|
805
|
+
let r = {
|
|
806
|
+
minLength: 2,
|
|
807
|
+
field: "points"
|
|
808
|
+
}, { errors: i, validPoints: a } = validatePointsArray(e.points, r);
|
|
809
|
+
return t.push(...i), applyValidPoints(n, a, r), t.push(...validateOptionalColor({
|
|
810
|
+
normalized: n,
|
|
811
|
+
field: "color",
|
|
812
|
+
value: e.color,
|
|
813
|
+
defaultValue: "#FF0000CC"
|
|
814
|
+
})), t.push(...validateOptionalNumber({
|
|
815
|
+
normalized: n,
|
|
816
|
+
field: "lineWidth",
|
|
817
|
+
value: e.lineWidth,
|
|
818
|
+
defaultValue: 1,
|
|
819
|
+
min: 0
|
|
820
|
+
})), {
|
|
821
|
+
errors: t,
|
|
822
|
+
normalized: n
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function addMultiPolygon(e = {}) {
|
|
826
|
+
let t = [], n = { ...e };
|
|
827
|
+
t.push(...validateRequiredString({
|
|
828
|
+
normalized: n,
|
|
829
|
+
field: "name",
|
|
830
|
+
value: e.name
|
|
831
|
+
})), t.push(...verifyEnumerationValue({
|
|
832
|
+
normalized: n,
|
|
833
|
+
field: "polygonType",
|
|
834
|
+
value: e.polygonType,
|
|
835
|
+
defaultValue: "rectangle",
|
|
836
|
+
type: "string",
|
|
837
|
+
list: [
|
|
838
|
+
"rectangle",
|
|
839
|
+
"circle",
|
|
840
|
+
"polygon"
|
|
841
|
+
]
|
|
842
|
+
}));
|
|
843
|
+
let r = n.polygonType, i = {
|
|
844
|
+
minLength: 2,
|
|
845
|
+
field: "points"
|
|
846
|
+
};
|
|
847
|
+
r === "rectangle" || r === "circle" ? i = {
|
|
848
|
+
exactLength: 2,
|
|
849
|
+
field: "points"
|
|
850
|
+
} : r === "polygon" && (i = {
|
|
851
|
+
minLength: 3,
|
|
852
|
+
field: "points"
|
|
853
|
+
});
|
|
854
|
+
let { errors: a, validPoints: o } = validatePointsArray(e.points, i);
|
|
855
|
+
return t.push(...a), applyValidPoints(n, o, i), t.push(...validateOptionalColor({
|
|
856
|
+
normalized: n,
|
|
857
|
+
field: "color",
|
|
858
|
+
value: e.color,
|
|
859
|
+
defaultValue: "#0099FF99"
|
|
860
|
+
})), {
|
|
861
|
+
errors: t,
|
|
862
|
+
normalized: n
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
function removeDrawn(e = {}) {
|
|
866
|
+
let t = [], n = { ...e };
|
|
867
|
+
return t.push(...validateRequiredString({
|
|
868
|
+
normalized: n,
|
|
869
|
+
field: "name",
|
|
870
|
+
value: e.name
|
|
871
|
+
})), {
|
|
872
|
+
errors: t,
|
|
873
|
+
normalized: n
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
function removeAllDrawn(e = {}) {
|
|
877
|
+
return {
|
|
878
|
+
errors: [],
|
|
879
|
+
normalized: { ...e }
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
function addTexturedQuad(e = {}) {
|
|
883
|
+
let t = [], n = { ...e };
|
|
884
|
+
t.push(...validateRequiredString({
|
|
885
|
+
normalized: n,
|
|
886
|
+
field: "name",
|
|
887
|
+
value: e.name
|
|
888
|
+
}));
|
|
889
|
+
let r = {
|
|
890
|
+
exactLength: 4,
|
|
891
|
+
field: "points"
|
|
892
|
+
}, { errors: i, validPoints: a } = validatePointsArray(e.points, r);
|
|
893
|
+
return t.push(...i), applyValidPoints(n, a, r), t.push(...validateRequiredString({
|
|
894
|
+
normalized: n,
|
|
895
|
+
field: "texture",
|
|
896
|
+
value: e.texture
|
|
897
|
+
})), {
|
|
898
|
+
errors: t,
|
|
899
|
+
normalized: n
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
function startMouseDraw(e = {}) {
|
|
903
|
+
let t = [], n = { ...e };
|
|
904
|
+
return t.push(...verifyEnumerationValue({
|
|
905
|
+
normalized: n,
|
|
906
|
+
field: "drawMode",
|
|
907
|
+
value: e.drawMode,
|
|
908
|
+
defaultValue: "polyline",
|
|
909
|
+
type: "string",
|
|
910
|
+
list: [
|
|
911
|
+
"polyline",
|
|
912
|
+
"rectangle",
|
|
913
|
+
"circle",
|
|
914
|
+
"polygon"
|
|
915
|
+
]
|
|
916
|
+
})), t.push(...validateOptionalColor({
|
|
917
|
+
normalized: n,
|
|
918
|
+
field: "color",
|
|
919
|
+
value: e.color,
|
|
920
|
+
defaultValue: "#FF0000CC"
|
|
921
|
+
})), t.push(...validateOptionalNumber({
|
|
922
|
+
normalized: n,
|
|
923
|
+
field: "lineWidth",
|
|
924
|
+
value: e.lineWidth,
|
|
925
|
+
defaultValue: 3,
|
|
926
|
+
min: 0
|
|
927
|
+
})), t.push(...validateOptionalString({
|
|
928
|
+
normalized: n,
|
|
929
|
+
field: "name",
|
|
930
|
+
value: e.name
|
|
931
|
+
})), {
|
|
932
|
+
errors: t,
|
|
933
|
+
normalized: n
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function stopMouseDraw(e = {}) {
|
|
937
|
+
return {
|
|
938
|
+
errors: [],
|
|
939
|
+
normalized: { ...e }
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
function getDrawnInfoByName(e = {}) {
|
|
943
|
+
let t = [], n = { ...e };
|
|
944
|
+
return t.push(...validateRequiredString({
|
|
945
|
+
normalized: n,
|
|
946
|
+
field: "name",
|
|
947
|
+
value: e.name
|
|
948
|
+
})), {
|
|
949
|
+
errors: t,
|
|
950
|
+
normalized: n
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
function getAllDrawnInfo(e = {}) {
|
|
954
|
+
return {
|
|
955
|
+
errors: [],
|
|
956
|
+
normalized: { ...e }
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
function measureDistance(e = {}) {
|
|
960
|
+
let t = [], n = { ...e };
|
|
961
|
+
t.push(...validateRequiredString({
|
|
962
|
+
normalized: n,
|
|
963
|
+
field: "name",
|
|
964
|
+
value: e.name
|
|
965
|
+
}));
|
|
966
|
+
let r = {
|
|
967
|
+
minLength: 2,
|
|
968
|
+
field: "points"
|
|
969
|
+
}, { errors: i, validPoints: a } = validatePointsArray(e.points, r);
|
|
970
|
+
return t.push(...i), applyValidPoints(n, a, r), {
|
|
971
|
+
errors: t,
|
|
972
|
+
normalized: n
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
function measureArea(e = {}) {
|
|
976
|
+
let t = [], n = { ...e };
|
|
977
|
+
t.push(...validateRequiredString({
|
|
978
|
+
normalized: n,
|
|
979
|
+
field: "name",
|
|
980
|
+
value: e.name
|
|
981
|
+
})), t.push(...verifyEnumerationValue({
|
|
982
|
+
normalized: n,
|
|
983
|
+
field: "polyType",
|
|
984
|
+
value: e.polyType,
|
|
985
|
+
defaultValue: "rectangle",
|
|
986
|
+
type: "string",
|
|
987
|
+
list: [
|
|
988
|
+
"rectangle",
|
|
989
|
+
"circle",
|
|
990
|
+
"polygon"
|
|
991
|
+
]
|
|
992
|
+
}));
|
|
993
|
+
let r = n.polyType, i = {
|
|
994
|
+
minLength: 2,
|
|
995
|
+
field: "points"
|
|
996
|
+
};
|
|
997
|
+
r === "polygon" && (i = {
|
|
998
|
+
minLength: 3,
|
|
999
|
+
field: "points"
|
|
1000
|
+
});
|
|
1001
|
+
let { errors: a, validPoints: o } = validatePointsArray(e.points, i);
|
|
1002
|
+
return t.push(...a), applyValidPoints(n, o, i), {
|
|
1003
|
+
errors: t,
|
|
1004
|
+
normalized: n
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
//#endregion
|
|
1008
|
+
//#region api/cesium/cesiumApi.js
|
|
1009
|
+
var validator$10 = {
|
|
1010
|
+
addMultiLine,
|
|
1011
|
+
addMultiPolygon,
|
|
1012
|
+
removeDrawn,
|
|
1013
|
+
removeAllDrawn,
|
|
1014
|
+
addTexturedQuad,
|
|
1015
|
+
startMouseDraw,
|
|
1016
|
+
stopMouseDraw,
|
|
1017
|
+
getDrawnInfoByName,
|
|
1018
|
+
getAllDrawnInfo,
|
|
1019
|
+
measureDistance,
|
|
1020
|
+
measureArea
|
|
1021
|
+
}, CesiumAPI = class {
|
|
1022
|
+
constructor(e) {
|
|
1023
|
+
this.commandManager = e;
|
|
1024
|
+
}
|
|
1025
|
+
_handleSend(e, t = {}) {
|
|
1026
|
+
let n = `cesium.${e}`, r = validator$10[e], i = r ? r(t) : {
|
|
766
1027
|
errors: [],
|
|
767
1028
|
normalized: t
|
|
768
1029
|
};
|
|
@@ -2143,6 +2404,58 @@ function sediment(e) {
|
|
|
2143
2404
|
normalized: n
|
|
2144
2405
|
};
|
|
2145
2406
|
}
|
|
2407
|
+
function materialParams(e = {}) {
|
|
2408
|
+
let t = [], n = { ...e };
|
|
2409
|
+
return t.push(...validateRequiredString({
|
|
2410
|
+
normalized: n,
|
|
2411
|
+
field: "key",
|
|
2412
|
+
value: e.key
|
|
2413
|
+
})), t.push(...validateOptionalNumber({
|
|
2414
|
+
normalized: n,
|
|
2415
|
+
field: "heightOffset",
|
|
2416
|
+
value: e.heightOffset,
|
|
2417
|
+
defaultValue: 0
|
|
2418
|
+
})), t.push(...validateOptionalNumber({
|
|
2419
|
+
normalized: n,
|
|
2420
|
+
field: "resolutionScale",
|
|
2421
|
+
value: e.resolutionScale,
|
|
2422
|
+
defaultValue: .2,
|
|
2423
|
+
min: 0
|
|
2424
|
+
})), t.push(...validateOptionalNumber({
|
|
2425
|
+
normalized: n,
|
|
2426
|
+
field: "cameraLODDistance",
|
|
2427
|
+
value: e.cameraLODDistance,
|
|
2428
|
+
defaultValue: 4e4,
|
|
2429
|
+
min: 0
|
|
2430
|
+
})), t.push(...validateOptionalNumber({
|
|
2431
|
+
normalized: n,
|
|
2432
|
+
field: "cameraLODNum",
|
|
2433
|
+
value: e.cameraLODNum,
|
|
2434
|
+
defaultValue: 4,
|
|
2435
|
+
min: 0
|
|
2436
|
+
})), t.push(...validateOptionalNumber({
|
|
2437
|
+
normalized: n,
|
|
2438
|
+
field: "cameraRemapMaxOffest",
|
|
2439
|
+
value: e.cameraRemapMaxOffest,
|
|
2440
|
+
defaultValue: 40,
|
|
2441
|
+
min: 0
|
|
2442
|
+
})), t.push(...validateOptionalNumber({
|
|
2443
|
+
normalized: n,
|
|
2444
|
+
field: "flowAmplitude",
|
|
2445
|
+
value: e.flowAmplitude,
|
|
2446
|
+
defaultValue: .5,
|
|
2447
|
+
min: 0
|
|
2448
|
+
})), t.push(...validateOptionalNumber({
|
|
2449
|
+
normalized: n,
|
|
2450
|
+
field: "flowFrequency",
|
|
2451
|
+
value: e.flowFrequency,
|
|
2452
|
+
defaultValue: .5,
|
|
2453
|
+
min: 0
|
|
2454
|
+
})), {
|
|
2455
|
+
errors: t,
|
|
2456
|
+
normalized: n
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2146
2459
|
function close$1(e) {
|
|
2147
2460
|
let t = [], n = { ...e };
|
|
2148
2461
|
return t.push(...validateRequiredString({
|
|
@@ -2161,6 +2474,7 @@ var validator$6 = {
|
|
|
2161
2474
|
waterFlow,
|
|
2162
2475
|
waterDepth,
|
|
2163
2476
|
sediment,
|
|
2477
|
+
materialParams,
|
|
2164
2478
|
close: close$1
|
|
2165
2479
|
}, HydrodynamicForceApi = class {
|
|
2166
2480
|
constructor(e) {
|
|
@@ -3285,11 +3599,14 @@ var OtherApi = class {
|
|
|
3285
3599
|
}
|
|
3286
3600
|
}, GameAPI = class {
|
|
3287
3601
|
constructor(e) {
|
|
3288
|
-
this._cameraApi = new CameraAPI(e), this._markerApi = new MarkerApi(e), this._floodPeakApi = new FloodPeakApi(e), this._animationApiApi = new AnimationApi(e), this._hydrodynamicForceApi = new HydrodynamicForceApi(e), this._sceneModelApi = new SceneModelAPI(e), this._atmosphericEffectsApi = new AtmosphericEffectsApi(e), this._toolApi = new ToolAPI(e), this._lineApi = new LineApi(e), this._levelApi = new LevelApi(e), this._vtkApi = new VtkApi(e), this._otherApi = new OtherApi(e);
|
|
3602
|
+
this._cameraApi = new CameraAPI(e), this._cesiumApi = new CesiumAPI(e), this._markerApi = new MarkerApi(e), this._floodPeakApi = new FloodPeakApi(e), this._animationApiApi = new AnimationApi(e), this._hydrodynamicForceApi = new HydrodynamicForceApi(e), this._sceneModelApi = new SceneModelAPI(e), this._atmosphericEffectsApi = new AtmosphericEffectsApi(e), this._toolApi = new ToolAPI(e), this._lineApi = new LineApi(e), this._levelApi = new LevelApi(e), this._vtkApi = new VtkApi(e), this._otherApi = new OtherApi(e);
|
|
3289
3603
|
}
|
|
3290
3604
|
async camera(e, t) {
|
|
3291
3605
|
return this._cameraApi._handleSend(e, t);
|
|
3292
3606
|
}
|
|
3607
|
+
async cesium(e, t) {
|
|
3608
|
+
return this._cesiumApi._handleSend(e, t);
|
|
3609
|
+
}
|
|
3293
3610
|
async marker(e, t) {
|
|
3294
3611
|
return this._markerApi._handleSend(e, t);
|
|
3295
3612
|
}
|