@lumikmz/kmz-file 0.9.0 → 0.10.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 +61 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -398,6 +398,7 @@ function encodeMissionConfig(config) {
|
|
|
398
398
|
...config.droneInfo.droneSubEnumValue !== void 0 ? { "wpml:droneSubEnumValue": String(config.droneInfo.droneSubEnumValue) } : {}
|
|
399
399
|
},
|
|
400
400
|
...payloads.length > 0 ? { "wpml:payloadInfo": fromArray(payloads) } : {},
|
|
401
|
+
...config.waylineAvoidLimitAreaMode !== void 0 ? { "wpml:waylineAvoidLimitAreaMode": formatBool(config.waylineAvoidLimitAreaMode) } : {},
|
|
401
402
|
...config.autoRerouteInfo ? { "wpml:autoRerouteInfo": {
|
|
402
403
|
"wpml:missionAutoRerouteMode": formatBool(config.autoRerouteInfo.missionAutoRerouteMode),
|
|
403
404
|
"wpml:transitionalAutoRerouteMode": formatBool(config.autoRerouteInfo.transitionalAutoRerouteMode)
|
|
@@ -520,6 +521,20 @@ function encodeMapping3dPlacemark(p) {
|
|
|
520
521
|
"wpml:height": String(p.height)
|
|
521
522
|
};
|
|
522
523
|
}
|
|
524
|
+
function encodeTargetDetectionPlacemark(p) {
|
|
525
|
+
return {
|
|
526
|
+
"wpml:direction": String(p.direction),
|
|
527
|
+
"wpml:margin": String(p.margin),
|
|
528
|
+
"wpml:gimbalPitchMode": p.gimbalPitchMode,
|
|
529
|
+
"wpml:overlap": encodeOverlap(p.overlap),
|
|
530
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
531
|
+
"wpml:ellipsoidHeight": String(p.ellipsoidHeight),
|
|
532
|
+
"wpml:height": String(p.height),
|
|
533
|
+
"wpml:mappingHeadingParam": encodeMappingHeadingParam(p.mappingHeadingParam),
|
|
534
|
+
"wpml:gimbalPitchAngle": String(p.gimbalPitchAngle),
|
|
535
|
+
"wpml:recordEnable": formatBool(p.recordEnable)
|
|
536
|
+
};
|
|
537
|
+
}
|
|
523
538
|
function encodeMappingStripPlacemark(p) {
|
|
524
539
|
return {
|
|
525
540
|
LineString: { coordinates: p.LineString.coordinates },
|
|
@@ -586,12 +601,20 @@ function encodeMappingStripFolder(f) {
|
|
|
586
601
|
Placemark: encodeMappingStripPlacemark(f.Placemark)
|
|
587
602
|
};
|
|
588
603
|
}
|
|
604
|
+
function encodeTargetDetectionFolder(f) {
|
|
605
|
+
return {
|
|
606
|
+
"wpml:templateType": "targetdetection",
|
|
607
|
+
...encodeMappingFolderBase(f),
|
|
608
|
+
Placemark: encodeTargetDetectionPlacemark(f.Placemark)
|
|
609
|
+
};
|
|
610
|
+
}
|
|
589
611
|
function encodeTemplateFolder(t) {
|
|
590
612
|
switch (t.Folder.templateType) {
|
|
591
613
|
case "waypoint": return encodeWaypointFolder(t.Folder);
|
|
592
614
|
case "mapping2d": return encodeMapping2dFolder(t.Folder);
|
|
593
615
|
case "mapping3d": return encodeMapping3dFolder(t.Folder);
|
|
594
616
|
case "mappingStrip": return encodeMappingStripFolder(t.Folder);
|
|
617
|
+
case "targetdetection": return encodeTargetDetectionFolder(t.Folder);
|
|
595
618
|
}
|
|
596
619
|
}
|
|
597
620
|
function encodeTemplate(template) {
|
|
@@ -602,6 +625,10 @@ function encodeTemplate(template) {
|
|
|
602
625
|
...template.author !== void 0 ? { "wpml:author": template.author } : {},
|
|
603
626
|
...template.createTime !== void 0 ? { "wpml:createTime": String(template.createTime) } : {},
|
|
604
627
|
...template.updateTime !== void 0 ? { "wpml:updateTime": String(template.updateTime) } : {},
|
|
628
|
+
...template.jnCustom !== void 0 ? { "wpml:jnCustom": {
|
|
629
|
+
...template.jnCustom.airportId !== void 0 ? { "wpml:airportId": template.jnCustom.airportId } : {},
|
|
630
|
+
...template.jnCustom.airportSn !== void 0 ? { "wpml:airportSn": template.jnCustom.airportSn } : {}
|
|
631
|
+
} } : {},
|
|
605
632
|
"wpml:missionConfig": encodeMissionConfig(template.missionConfig),
|
|
606
633
|
Folder: encodeTemplateFolder(template)
|
|
607
634
|
}
|
|
@@ -1003,6 +1030,7 @@ function decodeMissionConfig(raw) {
|
|
|
1003
1030
|
...p["wpml:payloadSubEnumValue"] !== void 0 ? { payloadSubEnumValue: parseOptNum(p["wpml:payloadSubEnumValue"]) } : {},
|
|
1004
1031
|
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex")
|
|
1005
1032
|
})),
|
|
1033
|
+
...raw["wpml:waylineAvoidLimitAreaMode"] !== void 0 ? { waylineAvoidLimitAreaMode: parseOptBool(raw["wpml:waylineAvoidLimitAreaMode"]) ?? false } : {},
|
|
1006
1034
|
...reroute ? { autoRerouteInfo: {
|
|
1007
1035
|
missionAutoRerouteMode: parseOptBool(reroute["wpml:missionAutoRerouteMode"]) ?? false,
|
|
1008
1036
|
transitionalAutoRerouteMode: parseOptBool(reroute["wpml:transitionalAutoRerouteMode"]) ?? false
|
|
@@ -1126,6 +1154,20 @@ function decodeMapping3dPlacemark(p) {
|
|
|
1126
1154
|
height: meters(parseNum(p["wpml:height"], "height"))
|
|
1127
1155
|
};
|
|
1128
1156
|
}
|
|
1157
|
+
function decodeTargetDetectionPlacemark(p) {
|
|
1158
|
+
return {
|
|
1159
|
+
direction: degrees(parseNum(p["wpml:direction"], "direction")),
|
|
1160
|
+
margin: parseNum(p["wpml:margin"], "margin"),
|
|
1161
|
+
gimbalPitchMode: "fixed",
|
|
1162
|
+
overlap: decodeOverlap(p["wpml:overlap"]),
|
|
1163
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
1164
|
+
ellipsoidHeight: meters(parseNum(p["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
1165
|
+
height: meters(parseNum(p["wpml:height"], "height")),
|
|
1166
|
+
mappingHeadingParam: decodeMappingHeadingParam(p["wpml:mappingHeadingParam"]),
|
|
1167
|
+
gimbalPitchAngle: degrees(parseNum(p["wpml:gimbalPitchAngle"], "gimbalPitchAngle")),
|
|
1168
|
+
recordEnable: parseBool(p["wpml:recordEnable"], "recordEnable")
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1129
1171
|
function decodeMappingStripPlacemark(p) {
|
|
1130
1172
|
let stripMergedRegions;
|
|
1131
1173
|
if (p["wpml:stripMergedRegions"] !== void 0) try {
|
|
@@ -1213,12 +1255,26 @@ function decodeMappingStripFolder(raw) {
|
|
|
1213
1255
|
missionConfig: void 0
|
|
1214
1256
|
};
|
|
1215
1257
|
}
|
|
1258
|
+
function decodeTargetDetectionFolder(raw) {
|
|
1259
|
+
return {
|
|
1260
|
+
Folder: {
|
|
1261
|
+
templateType: "targetdetection",
|
|
1262
|
+
templateId: parseNum(raw["wpml:templateId"], "templateId"),
|
|
1263
|
+
waylineCoordinateSysParam: decodeCoordinateSysParam(raw["wpml:waylineCoordinateSysParam"]),
|
|
1264
|
+
autoFlightSpeed: metersPerSecond(parseNum(raw["wpml:autoFlightSpeed"], "autoFlightSpeed")),
|
|
1265
|
+
...raw["wpml:payloadParam"] ? { payloadParam: decodePayloadParam(raw["wpml:payloadParam"]) } : {},
|
|
1266
|
+
Placemark: decodeTargetDetectionPlacemark(raw.Placemark)
|
|
1267
|
+
},
|
|
1268
|
+
missionConfig: void 0
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1216
1271
|
function decodeTemplateFolder(raw) {
|
|
1217
1272
|
switch (raw["wpml:templateType"]) {
|
|
1218
1273
|
case "waypoint": return decodeWaypointFolder(raw);
|
|
1219
1274
|
case "mapping2d": return decodeMapping2dFolder(raw);
|
|
1220
1275
|
case "mapping3d": return decodeMapping3dFolder(raw);
|
|
1221
1276
|
case "mappingStrip": return decodeMappingStripFolder(raw);
|
|
1277
|
+
case "targetdetection": return decodeTargetDetectionFolder(raw);
|
|
1222
1278
|
default: throw new KmzError(`Unknown templateType: "${String(raw["wpml:templateType"])}"`);
|
|
1223
1279
|
}
|
|
1224
1280
|
}
|
|
@@ -1232,7 +1288,11 @@ function decodeTemplate(raw) {
|
|
|
1232
1288
|
missionConfig: decodeMissionConfig(doc["wpml:missionConfig"]),
|
|
1233
1289
|
...doc["wpml:author"] !== void 0 ? { author: doc["wpml:author"] } : {},
|
|
1234
1290
|
...doc["wpml:createTime"] !== void 0 ? { createTime: parseNum(doc["wpml:createTime"], "createTime") } : {},
|
|
1235
|
-
...doc["wpml:updateTime"] !== void 0 ? { updateTime: parseNum(doc["wpml:updateTime"], "updateTime") } : {}
|
|
1291
|
+
...doc["wpml:updateTime"] !== void 0 ? { updateTime: parseNum(doc["wpml:updateTime"], "updateTime") } : {},
|
|
1292
|
+
...doc["wpml:jnCustom"] !== void 0 ? { jnCustom: {
|
|
1293
|
+
...doc["wpml:jnCustom"]["wpml:airportId"] !== void 0 ? { airportId: doc["wpml:jnCustom"]["wpml:airportId"] } : {},
|
|
1294
|
+
...doc["wpml:jnCustom"]["wpml:airportSn"] !== void 0 ? { airportSn: doc["wpml:jnCustom"]["wpml:airportSn"] } : {}
|
|
1295
|
+
} } : {}
|
|
1236
1296
|
};
|
|
1237
1297
|
}
|
|
1238
1298
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumikmz/kmz-file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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.10.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vite-plus": "latest",
|