@lumikmz/kmz-file 0.10.0 → 0.11.0
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.mjs +66 -4
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -111,6 +111,32 @@ function encodeTtsParam(p) {
|
|
|
111
111
|
function encodeActionParams(action) {
|
|
112
112
|
const a = action;
|
|
113
113
|
switch (a.actionActuatorFunc) {
|
|
114
|
+
case "targetDetection": {
|
|
115
|
+
const p = a.actionActuatorFuncParam;
|
|
116
|
+
return {
|
|
117
|
+
...p.focalLength !== void 0 ? { "wpml:focalLength": String(p.focalLength) } : {},
|
|
118
|
+
"wpml:payloadPositionIndex": String(p.payloadPositionIndex),
|
|
119
|
+
"wpml:useGlobalPayloadLensIndex": formatBool(p.useGlobalPayloadLensIndex),
|
|
120
|
+
"wpml:payloadLensIndex": formatLensList(p.payloadLensIndex),
|
|
121
|
+
"wpml:actionUUID": p.actionUUID,
|
|
122
|
+
...p.irGainMode !== void 0 ? { "wpml:irGainMode": p.irGainMode } : {},
|
|
123
|
+
...p.irColorPalette !== void 0 ? { "wpml:irColorPalette": p.irColorPalette } : {},
|
|
124
|
+
"wpml:customTitle": p.customTitle,
|
|
125
|
+
"wpml:customText": p.customText,
|
|
126
|
+
"wpml:modelIndex": String(p.modelIndex),
|
|
127
|
+
"wpml:modelScore": String(p.modelScore),
|
|
128
|
+
"wpml:alarmInterval": String(p.alarmInterval),
|
|
129
|
+
"wpml:useThirdModel": formatBool(p.useThirdModel),
|
|
130
|
+
"wpml:algorithmType": p.algorithmType,
|
|
131
|
+
"wpml:targetParam": {
|
|
132
|
+
"wpml:maxThreshold": String(p.targetParam.maxThreshold),
|
|
133
|
+
"wpml:minThreshold": String(p.targetParam.minThreshold),
|
|
134
|
+
"wpml:useMaxThreshold": formatBool(p.targetParam.useMaxThreshold),
|
|
135
|
+
"wpml:useMinThreshold": formatBool(p.targetParam.useMinThreshold),
|
|
136
|
+
"wpml:targetType": p.targetParam.targetType
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
114
140
|
case "takePhoto": {
|
|
115
141
|
const p = a.actionActuatorFuncParam;
|
|
116
142
|
return {
|
|
@@ -381,7 +407,8 @@ function encodeMissionConfig(config) {
|
|
|
381
407
|
const payloads = config.payloadInfo.map((p) => ({
|
|
382
408
|
"wpml:payloadEnumValue": String(p.payloadEnumValue),
|
|
383
409
|
...p.payloadSubEnumValue !== void 0 ? { "wpml:payloadSubEnumValue": String(p.payloadSubEnumValue) } : {},
|
|
384
|
-
"wpml:payloadPositionIndex": String(p.payloadPositionIndex)
|
|
410
|
+
"wpml:payloadPositionIndex": String(p.payloadPositionIndex),
|
|
411
|
+
...p.equivalentFocalLength !== void 0 ? { "wpml:equivalentFocalLength": String(p.equivalentFocalLength) } : {}
|
|
385
412
|
}));
|
|
386
413
|
return {
|
|
387
414
|
"wpml:flyToWaylineMode": config.flyToWaylineMode,
|
|
@@ -532,7 +559,9 @@ function encodeTargetDetectionPlacemark(p) {
|
|
|
532
559
|
"wpml:height": String(p.height),
|
|
533
560
|
"wpml:mappingHeadingParam": encodeMappingHeadingParam(p.mappingHeadingParam),
|
|
534
561
|
"wpml:gimbalPitchAngle": String(p.gimbalPitchAngle),
|
|
535
|
-
"wpml:recordEnable": formatBool(p.recordEnable)
|
|
562
|
+
"wpml:recordEnable": formatBool(p.recordEnable),
|
|
563
|
+
...p.targetDetectionActionEnable !== void 0 ? { "wpml:targetDetectionActionEnable": formatBool(p.targetDetectionActionEnable) } : {},
|
|
564
|
+
...p.action ? { "wpml:action": encodeAction(p.action) } : {}
|
|
536
565
|
};
|
|
537
566
|
}
|
|
538
567
|
function encodeMappingStripPlacemark(p) {
|
|
@@ -721,6 +750,36 @@ function decodeAction(raw) {
|
|
|
721
750
|
const id = parseNum(raw["wpml:actionId"], "actionId");
|
|
722
751
|
const func = raw["wpml:actionActuatorFunc"];
|
|
723
752
|
switch (func) {
|
|
753
|
+
case "targetDetection": {
|
|
754
|
+
const target = need(p["wpml:targetParam"], "targetParam");
|
|
755
|
+
return {
|
|
756
|
+
actionId: id,
|
|
757
|
+
actionActuatorFunc: "targetDetection",
|
|
758
|
+
actionActuatorFuncParam: {
|
|
759
|
+
...p["wpml:focalLength"] !== void 0 ? { focalLength: parseNum(p["wpml:focalLength"], "focalLength") } : {},
|
|
760
|
+
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex"),
|
|
761
|
+
useGlobalPayloadLensIndex: parseBool(p["wpml:useGlobalPayloadLensIndex"], "useGlobalPayloadLensIndex"),
|
|
762
|
+
payloadLensIndex: parseLensList(p["wpml:payloadLensIndex"]),
|
|
763
|
+
actionUUID: need(p["wpml:actionUUID"], "actionUUID"),
|
|
764
|
+
...p["wpml:irGainMode"] !== void 0 ? { irGainMode: p["wpml:irGainMode"] } : {},
|
|
765
|
+
...p["wpml:irColorPalette"] !== void 0 ? { irColorPalette: p["wpml:irColorPalette"] } : {},
|
|
766
|
+
customTitle: need(p["wpml:customTitle"], "customTitle"),
|
|
767
|
+
customText: need(p["wpml:customText"], "customText"),
|
|
768
|
+
modelIndex: parseNum(p["wpml:modelIndex"], "modelIndex"),
|
|
769
|
+
modelScore: parseNum(p["wpml:modelScore"], "modelScore"),
|
|
770
|
+
alarmInterval: parseNum(p["wpml:alarmInterval"], "alarmInterval"),
|
|
771
|
+
useThirdModel: parseBool(p["wpml:useThirdModel"], "useThirdModel"),
|
|
772
|
+
algorithmType: need(p["wpml:algorithmType"], "algorithmType"),
|
|
773
|
+
targetParam: {
|
|
774
|
+
maxThreshold: parseNum(target["wpml:maxThreshold"], "maxThreshold"),
|
|
775
|
+
minThreshold: parseNum(target["wpml:minThreshold"], "minThreshold"),
|
|
776
|
+
useMaxThreshold: parseBool(target["wpml:useMaxThreshold"], "useMaxThreshold"),
|
|
777
|
+
useMinThreshold: parseBool(target["wpml:useMinThreshold"], "useMinThreshold"),
|
|
778
|
+
targetType: target["wpml:targetType"]
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
}
|
|
724
783
|
case "takePhoto": return {
|
|
725
784
|
actionId: id,
|
|
726
785
|
actionActuatorFunc: "takePhoto",
|
|
@@ -1028,7 +1087,8 @@ function decodeMissionConfig(raw) {
|
|
|
1028
1087
|
payloadInfo: toArray(raw["wpml:payloadInfo"]).map((p) => ({
|
|
1029
1088
|
payloadEnumValue: parseNum(p["wpml:payloadEnumValue"], "payloadEnumValue"),
|
|
1030
1089
|
...p["wpml:payloadSubEnumValue"] !== void 0 ? { payloadSubEnumValue: parseOptNum(p["wpml:payloadSubEnumValue"]) } : {},
|
|
1031
|
-
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex")
|
|
1090
|
+
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex"),
|
|
1091
|
+
...p["wpml:equivalentFocalLength"] !== void 0 ? { equivalentFocalLength: parseOptNum(p["wpml:equivalentFocalLength"]) } : {}
|
|
1032
1092
|
})),
|
|
1033
1093
|
...raw["wpml:waylineAvoidLimitAreaMode"] !== void 0 ? { waylineAvoidLimitAreaMode: parseOptBool(raw["wpml:waylineAvoidLimitAreaMode"]) ?? false } : {},
|
|
1034
1094
|
...reroute ? { autoRerouteInfo: {
|
|
@@ -1165,7 +1225,9 @@ function decodeTargetDetectionPlacemark(p) {
|
|
|
1165
1225
|
height: meters(parseNum(p["wpml:height"], "height")),
|
|
1166
1226
|
mappingHeadingParam: decodeMappingHeadingParam(p["wpml:mappingHeadingParam"]),
|
|
1167
1227
|
gimbalPitchAngle: degrees(parseNum(p["wpml:gimbalPitchAngle"], "gimbalPitchAngle")),
|
|
1168
|
-
recordEnable: parseBool(p["wpml:recordEnable"], "recordEnable")
|
|
1228
|
+
recordEnable: parseBool(p["wpml:recordEnable"], "recordEnable"),
|
|
1229
|
+
...p["wpml:targetDetectionActionEnable"] !== void 0 ? { targetDetectionActionEnable: parseBool(p["wpml:targetDetectionActionEnable"], "targetDetectionActionEnable") } : {},
|
|
1230
|
+
...p["wpml:action"] ? { action: decodeAction(p["wpml:action"]) } : {}
|
|
1169
1231
|
};
|
|
1170
1232
|
}
|
|
1171
1233
|
function decodeMappingStripPlacemark(p) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumikmz/kmz-file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "DJI KMZ file pack/unpack — Rust WASM + spec-aligned TypeScript codec",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lumikmz/kmz": "0.
|
|
27
|
+
"@lumikmz/kmz": "0.11.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vite-plus": "latest",
|