@lumikmz/kmz-file 0.9.1 → 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 +116 -2
- 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,
|
|
@@ -398,6 +425,7 @@ function encodeMissionConfig(config) {
|
|
|
398
425
|
...config.droneInfo.droneSubEnumValue !== void 0 ? { "wpml:droneSubEnumValue": String(config.droneInfo.droneSubEnumValue) } : {}
|
|
399
426
|
},
|
|
400
427
|
...payloads.length > 0 ? { "wpml:payloadInfo": fromArray(payloads) } : {},
|
|
428
|
+
...config.waylineAvoidLimitAreaMode !== void 0 ? { "wpml:waylineAvoidLimitAreaMode": formatBool(config.waylineAvoidLimitAreaMode) } : {},
|
|
401
429
|
...config.autoRerouteInfo ? { "wpml:autoRerouteInfo": {
|
|
402
430
|
"wpml:missionAutoRerouteMode": formatBool(config.autoRerouteInfo.missionAutoRerouteMode),
|
|
403
431
|
"wpml:transitionalAutoRerouteMode": formatBool(config.autoRerouteInfo.transitionalAutoRerouteMode)
|
|
@@ -520,6 +548,22 @@ function encodeMapping3dPlacemark(p) {
|
|
|
520
548
|
"wpml:height": String(p.height)
|
|
521
549
|
};
|
|
522
550
|
}
|
|
551
|
+
function encodeTargetDetectionPlacemark(p) {
|
|
552
|
+
return {
|
|
553
|
+
"wpml:direction": String(p.direction),
|
|
554
|
+
"wpml:margin": String(p.margin),
|
|
555
|
+
"wpml:gimbalPitchMode": p.gimbalPitchMode,
|
|
556
|
+
"wpml:overlap": encodeOverlap(p.overlap),
|
|
557
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
558
|
+
"wpml:ellipsoidHeight": String(p.ellipsoidHeight),
|
|
559
|
+
"wpml:height": String(p.height),
|
|
560
|
+
"wpml:mappingHeadingParam": encodeMappingHeadingParam(p.mappingHeadingParam),
|
|
561
|
+
"wpml:gimbalPitchAngle": String(p.gimbalPitchAngle),
|
|
562
|
+
"wpml:recordEnable": formatBool(p.recordEnable),
|
|
563
|
+
...p.targetDetectionActionEnable !== void 0 ? { "wpml:targetDetectionActionEnable": formatBool(p.targetDetectionActionEnable) } : {},
|
|
564
|
+
...p.action ? { "wpml:action": encodeAction(p.action) } : {}
|
|
565
|
+
};
|
|
566
|
+
}
|
|
523
567
|
function encodeMappingStripPlacemark(p) {
|
|
524
568
|
return {
|
|
525
569
|
LineString: { coordinates: p.LineString.coordinates },
|
|
@@ -586,12 +630,20 @@ function encodeMappingStripFolder(f) {
|
|
|
586
630
|
Placemark: encodeMappingStripPlacemark(f.Placemark)
|
|
587
631
|
};
|
|
588
632
|
}
|
|
633
|
+
function encodeTargetDetectionFolder(f) {
|
|
634
|
+
return {
|
|
635
|
+
"wpml:templateType": "targetdetection",
|
|
636
|
+
...encodeMappingFolderBase(f),
|
|
637
|
+
Placemark: encodeTargetDetectionPlacemark(f.Placemark)
|
|
638
|
+
};
|
|
639
|
+
}
|
|
589
640
|
function encodeTemplateFolder(t) {
|
|
590
641
|
switch (t.Folder.templateType) {
|
|
591
642
|
case "waypoint": return encodeWaypointFolder(t.Folder);
|
|
592
643
|
case "mapping2d": return encodeMapping2dFolder(t.Folder);
|
|
593
644
|
case "mapping3d": return encodeMapping3dFolder(t.Folder);
|
|
594
645
|
case "mappingStrip": return encodeMappingStripFolder(t.Folder);
|
|
646
|
+
case "targetdetection": return encodeTargetDetectionFolder(t.Folder);
|
|
595
647
|
}
|
|
596
648
|
}
|
|
597
649
|
function encodeTemplate(template) {
|
|
@@ -698,6 +750,36 @@ function decodeAction(raw) {
|
|
|
698
750
|
const id = parseNum(raw["wpml:actionId"], "actionId");
|
|
699
751
|
const func = raw["wpml:actionActuatorFunc"];
|
|
700
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
|
+
}
|
|
701
783
|
case "takePhoto": return {
|
|
702
784
|
actionId: id,
|
|
703
785
|
actionActuatorFunc: "takePhoto",
|
|
@@ -1005,8 +1087,10 @@ function decodeMissionConfig(raw) {
|
|
|
1005
1087
|
payloadInfo: toArray(raw["wpml:payloadInfo"]).map((p) => ({
|
|
1006
1088
|
payloadEnumValue: parseNum(p["wpml:payloadEnumValue"], "payloadEnumValue"),
|
|
1007
1089
|
...p["wpml:payloadSubEnumValue"] !== void 0 ? { payloadSubEnumValue: parseOptNum(p["wpml:payloadSubEnumValue"]) } : {},
|
|
1008
|
-
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex")
|
|
1090
|
+
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex"),
|
|
1091
|
+
...p["wpml:equivalentFocalLength"] !== void 0 ? { equivalentFocalLength: parseOptNum(p["wpml:equivalentFocalLength"]) } : {}
|
|
1009
1092
|
})),
|
|
1093
|
+
...raw["wpml:waylineAvoidLimitAreaMode"] !== void 0 ? { waylineAvoidLimitAreaMode: parseOptBool(raw["wpml:waylineAvoidLimitAreaMode"]) ?? false } : {},
|
|
1010
1094
|
...reroute ? { autoRerouteInfo: {
|
|
1011
1095
|
missionAutoRerouteMode: parseOptBool(reroute["wpml:missionAutoRerouteMode"]) ?? false,
|
|
1012
1096
|
transitionalAutoRerouteMode: parseOptBool(reroute["wpml:transitionalAutoRerouteMode"]) ?? false
|
|
@@ -1130,6 +1214,22 @@ function decodeMapping3dPlacemark(p) {
|
|
|
1130
1214
|
height: meters(parseNum(p["wpml:height"], "height"))
|
|
1131
1215
|
};
|
|
1132
1216
|
}
|
|
1217
|
+
function decodeTargetDetectionPlacemark(p) {
|
|
1218
|
+
return {
|
|
1219
|
+
direction: degrees(parseNum(p["wpml:direction"], "direction")),
|
|
1220
|
+
margin: parseNum(p["wpml:margin"], "margin"),
|
|
1221
|
+
gimbalPitchMode: "fixed",
|
|
1222
|
+
overlap: decodeOverlap(p["wpml:overlap"]),
|
|
1223
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
1224
|
+
ellipsoidHeight: meters(parseNum(p["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
1225
|
+
height: meters(parseNum(p["wpml:height"], "height")),
|
|
1226
|
+
mappingHeadingParam: decodeMappingHeadingParam(p["wpml:mappingHeadingParam"]),
|
|
1227
|
+
gimbalPitchAngle: degrees(parseNum(p["wpml:gimbalPitchAngle"], "gimbalPitchAngle")),
|
|
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"]) } : {}
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1133
1233
|
function decodeMappingStripPlacemark(p) {
|
|
1134
1234
|
let stripMergedRegions;
|
|
1135
1235
|
if (p["wpml:stripMergedRegions"] !== void 0) try {
|
|
@@ -1217,12 +1317,26 @@ function decodeMappingStripFolder(raw) {
|
|
|
1217
1317
|
missionConfig: void 0
|
|
1218
1318
|
};
|
|
1219
1319
|
}
|
|
1320
|
+
function decodeTargetDetectionFolder(raw) {
|
|
1321
|
+
return {
|
|
1322
|
+
Folder: {
|
|
1323
|
+
templateType: "targetdetection",
|
|
1324
|
+
templateId: parseNum(raw["wpml:templateId"], "templateId"),
|
|
1325
|
+
waylineCoordinateSysParam: decodeCoordinateSysParam(raw["wpml:waylineCoordinateSysParam"]),
|
|
1326
|
+
autoFlightSpeed: metersPerSecond(parseNum(raw["wpml:autoFlightSpeed"], "autoFlightSpeed")),
|
|
1327
|
+
...raw["wpml:payloadParam"] ? { payloadParam: decodePayloadParam(raw["wpml:payloadParam"]) } : {},
|
|
1328
|
+
Placemark: decodeTargetDetectionPlacemark(raw.Placemark)
|
|
1329
|
+
},
|
|
1330
|
+
missionConfig: void 0
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1220
1333
|
function decodeTemplateFolder(raw) {
|
|
1221
1334
|
switch (raw["wpml:templateType"]) {
|
|
1222
1335
|
case "waypoint": return decodeWaypointFolder(raw);
|
|
1223
1336
|
case "mapping2d": return decodeMapping2dFolder(raw);
|
|
1224
1337
|
case "mapping3d": return decodeMapping3dFolder(raw);
|
|
1225
1338
|
case "mappingStrip": return decodeMappingStripFolder(raw);
|
|
1339
|
+
case "targetdetection": return decodeTargetDetectionFolder(raw);
|
|
1226
1340
|
default: throw new KmzError(`Unknown templateType: "${String(raw["wpml:templateType"])}"`);
|
|
1227
1341
|
}
|
|
1228
1342
|
}
|
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",
|