@lumikmz/kmz-file 0.2.1 → 0.4.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/README.md +9 -13
- package/dist/index.mjs +239 -131
- package/dist/wasm_kmz.js +20 -20
- package/dist/wasm_kmz_bg.wasm +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Lazily initialize the WASM module. Idempotent — subsequent calls return the sa
|
|
|
39
39
|
```ts
|
|
40
40
|
import { init } from "@lumikmz/kmz-file";
|
|
41
41
|
|
|
42
|
-
await init();
|
|
42
|
+
await init(); // default: fetches the wasm binary alongside the JS bundle
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
You can override the loader by passing an `InitInput` (URL, `Response`, `BufferSource`, or `WebAssembly.Module`), useful when your bundler needs explicit asset wiring:
|
|
@@ -77,23 +77,17 @@ const waylines = plan(template);
|
|
|
77
77
|
const bytes: Uint8Array = pack(template, waylines);
|
|
78
78
|
|
|
79
79
|
// With resources (e.g. a megaphone audio file referenced by an action):
|
|
80
|
-
const resources: ResourceFile[] = [
|
|
81
|
-
{ path: "wpmz/res/audio/announcement.opus", data: audioBytes },
|
|
82
|
-
];
|
|
80
|
+
const resources: ResourceFile[] = [{ path: "wpmz/res/audio/announcement.opus", data: audioBytes }];
|
|
83
81
|
const bytes2 = pack(template, waylines, resources);
|
|
84
82
|
```
|
|
85
83
|
|
|
86
84
|
**Signature:**
|
|
87
85
|
|
|
88
86
|
```ts
|
|
89
|
-
function pack(
|
|
90
|
-
template: Template,
|
|
91
|
-
waylines: Waylines,
|
|
92
|
-
resources?: ResourceFile[],
|
|
93
|
-
): Uint8Array;
|
|
87
|
+
function pack(template: Template, waylines: Waylines, resources?: ResourceFile[]): Uint8Array;
|
|
94
88
|
|
|
95
89
|
interface ResourceFile {
|
|
96
|
-
path: string;
|
|
90
|
+
path: string; // path inside the KMZ archive, e.g. "wpmz/res/audio/<hash>.opus"
|
|
97
91
|
data: Uint8Array;
|
|
98
92
|
}
|
|
99
93
|
```
|
|
@@ -139,9 +133,11 @@ interface UnpackResult {
|
|
|
139
133
|
}
|
|
140
134
|
|
|
141
135
|
// WASM init types (passed through from wasm-bindgen):
|
|
142
|
-
type InitInput
|
|
136
|
+
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
143
137
|
type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
144
|
-
interface InitOutput {
|
|
138
|
+
interface InitOutput {
|
|
139
|
+
/* the raw wasm-bindgen exports */
|
|
140
|
+
}
|
|
145
141
|
```
|
|
146
142
|
|
|
147
143
|
## Resource files
|
|
@@ -251,7 +247,7 @@ Editing only the TypeScript codec (the common case) needs nothing beyond `vp pac
|
|
|
251
247
|
|
|
252
248
|
## Compatibility
|
|
253
249
|
|
|
254
|
-
[DJI WPML 1.
|
|
250
|
+
[DJI WPML 1.15](https://developer.dji.com/doc/cloud-api-tutorial/cn/api-reference/dji-wpml/overview.html). The XML namespaces and structure are pinned in [`src/codec/xml-schema.ts`](src/codec/xml-schema.ts).
|
|
255
251
|
|
|
256
252
|
## License
|
|
257
253
|
|
package/dist/index.mjs
CHANGED
|
@@ -127,7 +127,8 @@ function encodeActionParams(action) {
|
|
|
127
127
|
"wpml:focusY": String(p.focusY),
|
|
128
128
|
...p.focusRegionWidth !== void 0 ? { "wpml:focusRegionWidth": String(p.focusRegionWidth) } : {},
|
|
129
129
|
...p.focusRegionHeight !== void 0 ? { "wpml:focusRegionHeight": String(p.focusRegionHeight) } : {},
|
|
130
|
-
...p.isInfiniteFocus !== void 0 ? { "wpml:isInfiniteFocus": formatBool(p.isInfiniteFocus) } : {}
|
|
130
|
+
...p.isInfiniteFocus !== void 0 ? { "wpml:isInfiniteFocus": formatBool(p.isInfiniteFocus) } : {},
|
|
131
|
+
...p.isCalibrationFocus !== void 0 ? { "wpml:isCalibrationFocus": formatBool(p.isCalibrationFocus) } : {}
|
|
131
132
|
};
|
|
132
133
|
}
|
|
133
134
|
case "zoom": {
|
|
@@ -248,6 +249,7 @@ function encodeActionParams(action) {
|
|
|
248
249
|
...p.payloadPositionIndex !== void 0 ? { "wpml:payloadPositionIndex": String(p.payloadPositionIndex) } : {},
|
|
249
250
|
...p.payloadLensIndex && p.payloadLensIndex.length > 0 ? { "wpml:payloadLensIndex": formatLensList(p.payloadLensIndex) } : {},
|
|
250
251
|
...p.useGlobalPayloadLensIndex !== void 0 ? { "wpml:useGlobalPayloadLensIndex": formatBool(p.useGlobalPayloadLensIndex) } : {},
|
|
252
|
+
...p.actionUUID !== void 0 ? { "wpml:actionUUID": p.actionUUID } : {},
|
|
251
253
|
"wpml:panoShotSubMode": p.panoShotSubMode
|
|
252
254
|
};
|
|
253
255
|
}
|
|
@@ -282,9 +284,46 @@ function encodeActionParams(action) {
|
|
|
282
284
|
"wpml:searchlightBrightness": String(p.searchlightBrightness)
|
|
283
285
|
};
|
|
284
286
|
}
|
|
287
|
+
case "startSmartOblique":
|
|
288
|
+
case "stopSmartOblique": {
|
|
289
|
+
const p = a.actionActuatorFuncParam;
|
|
290
|
+
return { "wpml:payloadPositionIndex": String(p.payloadPositionIndex) };
|
|
291
|
+
}
|
|
292
|
+
case "startTimeLapse": {
|
|
293
|
+
const p = a.actionActuatorFuncParam;
|
|
294
|
+
return {
|
|
295
|
+
"wpml:payloadPositionIndex": String(p.payloadPositionIndex),
|
|
296
|
+
"wpml:useGlobalPayloadLensIndex": formatBool(p.useGlobalPayloadLensIndex),
|
|
297
|
+
"wpml:payloadLensIndex": p.payloadLensIndex,
|
|
298
|
+
"wpml:minShootInterval": String(p.minShootInterval)
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
case "stopTimeLapse": {
|
|
302
|
+
const p = a.actionActuatorFuncParam;
|
|
303
|
+
return {
|
|
304
|
+
"wpml:payloadPositionIndex": String(p.payloadPositionIndex),
|
|
305
|
+
"wpml:payloadLensIndex": p.payloadLensIndex
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
case "gimbalAngleLock": {
|
|
309
|
+
const p = a.actionActuatorFuncParam;
|
|
310
|
+
return { "wpml:payloadPositionIndex": String(p.payloadPositionIndex) };
|
|
311
|
+
}
|
|
312
|
+
case "setFocusType": {
|
|
313
|
+
const p = a.actionActuatorFuncParam;
|
|
314
|
+
return {
|
|
315
|
+
"wpml:cameraFocusType": p.cameraFocusType,
|
|
316
|
+
"wpml:payloadPositionIndex": String(p.payloadPositionIndex)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
case "gimbalAngleUnlock": return {};
|
|
285
320
|
}
|
|
286
321
|
}
|
|
287
322
|
function encodeAction(action) {
|
|
323
|
+
if (action.actionActuatorFunc === "gimbalAngleUnlock") return {
|
|
324
|
+
"wpml:actionId": String(action.actionId),
|
|
325
|
+
"wpml:actionActuatorFunc": "gimbalAngleUnlock"
|
|
326
|
+
};
|
|
288
327
|
return {
|
|
289
328
|
"wpml:actionId": String(action.actionId),
|
|
290
329
|
"wpml:actionActuatorFunc": action.actionActuatorFunc,
|
|
@@ -313,6 +352,7 @@ function encodeActionGroup(g) {
|
|
|
313
352
|
function encodeMissionConfig(config) {
|
|
314
353
|
const payloads = config.payloadInfo.map((p) => ({
|
|
315
354
|
"wpml:payloadEnumValue": String(p.payloadEnumValue),
|
|
355
|
+
...p.payloadSubEnumValue !== void 0 ? { "wpml:payloadSubEnumValue": String(p.payloadSubEnumValue) } : {},
|
|
316
356
|
"wpml:payloadPositionIndex": String(p.payloadPositionIndex)
|
|
317
357
|
}));
|
|
318
358
|
return {
|
|
@@ -345,7 +385,8 @@ function encodeCoordinateSysParam(p) {
|
|
|
345
385
|
...p.positioningType !== void 0 ? { "wpml:positioningType": p.positioningType } : {},
|
|
346
386
|
...p.globalShootHeight !== void 0 ? { "wpml:globalShootHeight": String(p.globalShootHeight) } : {},
|
|
347
387
|
...p.surfaceFollowModeEnable !== void 0 ? { "wpml:surfaceFollowModeEnable": formatBool(p.surfaceFollowModeEnable) } : {},
|
|
348
|
-
...p.surfaceRelativeHeight !== void 0 ? { "wpml:surfaceRelativeHeight": String(p.surfaceRelativeHeight) } : {}
|
|
388
|
+
...p.surfaceRelativeHeight !== void 0 ? { "wpml:surfaceRelativeHeight": String(p.surfaceRelativeHeight) } : {},
|
|
389
|
+
...p.isRealtimeSurfaceFollow !== void 0 ? { "wpml:isRealtimeSurfaceFollow": formatBool(p.isRealtimeSurfaceFollow) } : {}
|
|
349
390
|
};
|
|
350
391
|
}
|
|
351
392
|
function encodePayloadParam(p) {
|
|
@@ -358,7 +399,8 @@ function encodePayloadParam(p) {
|
|
|
358
399
|
...p.samplingRate !== void 0 ? { "wpml:samplingRate": String(p.samplingRate) } : {},
|
|
359
400
|
...p.scanningMode !== void 0 ? { "wpml:scanningMode": p.scanningMode } : {},
|
|
360
401
|
...p.modelColoringEnable !== void 0 ? { "wpml:modelColoringEnable": formatBool(p.modelColoringEnable) } : {},
|
|
361
|
-
"wpml:imageFormat": formatLensList(p.imageFormat)
|
|
402
|
+
"wpml:imageFormat": formatLensList(p.imageFormat),
|
|
403
|
+
...p.photoSize !== void 0 ? { "wpml:photoSize": p.photoSize } : {}
|
|
362
404
|
};
|
|
363
405
|
}
|
|
364
406
|
function encodeWaypointHeadingParam(p) {
|
|
@@ -366,7 +408,9 @@ function encodeWaypointHeadingParam(p) {
|
|
|
366
408
|
"wpml:waypointHeadingMode": p.waypointHeadingMode,
|
|
367
409
|
...p.waypointHeadingAngle !== void 0 ? { "wpml:waypointHeadingAngle": String(p.waypointHeadingAngle) } : {},
|
|
368
410
|
...p.waypointPoiPoint !== void 0 ? { "wpml:waypointPoiPoint": formatLngLatHeight(p.waypointPoiPoint) } : {},
|
|
369
|
-
"wpml:
|
|
411
|
+
...p.waypointHeadingAngleEnable !== void 0 ? { "wpml:waypointHeadingAngleEnable": formatBool(p.waypointHeadingAngleEnable) } : {},
|
|
412
|
+
"wpml:waypointHeadingPathMode": p.waypointHeadingPathMode,
|
|
413
|
+
...p.waypointHeadingPoiIndex !== void 0 ? { "wpml:waypointHeadingPoiIndex": String(p.waypointHeadingPoiIndex) } : {}
|
|
370
414
|
};
|
|
371
415
|
}
|
|
372
416
|
function encodeWaypointTurnParam(p) {
|
|
@@ -413,11 +457,59 @@ function encodeWaypointPlacemark(p) {
|
|
|
413
457
|
...groups.length > 0 ? { "wpml:actionGroup": fromArray(groups) } : {}
|
|
414
458
|
};
|
|
415
459
|
}
|
|
416
|
-
function
|
|
417
|
-
return {
|
|
460
|
+
function encodeMapping2dPlacemark(p) {
|
|
461
|
+
return {
|
|
462
|
+
...p.caliFlightEnable !== void 0 ? { "wpml:caliFlightEnable": formatBool(p.caliFlightEnable) } : {},
|
|
463
|
+
"wpml:elevationOptimizeEnable": formatBool(p.elevationOptimizeEnable),
|
|
464
|
+
...p.smartObliqueEnable !== void 0 ? { "wpml:smartObliqueEnable": formatBool(p.smartObliqueEnable) } : {},
|
|
465
|
+
...p.smartObliqueGimbalPitch !== void 0 ? { "wpml:smartObliqueGimbalPitch": String(p.smartObliqueGimbalPitch) } : {},
|
|
466
|
+
...p.quickOrthoMappingEnable !== void 0 ? { "wpml:quickOrthoMappingEnable": formatBool(p.quickOrthoMappingEnable) } : {},
|
|
467
|
+
...p.quickOrthoMappingPitch !== void 0 ? { "wpml:quickOrthoMappingPitch": String(p.quickOrthoMappingPitch) } : {},
|
|
468
|
+
...p.facadeWaylineEnable !== void 0 ? { "wpml:facadeWaylineEnable": formatBool(p.facadeWaylineEnable) } : {},
|
|
469
|
+
"wpml:shootType": p.shootType,
|
|
470
|
+
"wpml:direction": String(p.direction),
|
|
471
|
+
"wpml:margin": String(p.margin),
|
|
472
|
+
...p.mappingHeadingParam ? { "wpml:mappingHeadingParam": encodeMappingHeadingParam(p.mappingHeadingParam) } : {},
|
|
473
|
+
...p.gimbalPitchMode !== void 0 ? { "wpml:gimbalPitchMode": p.gimbalPitchMode } : {},
|
|
474
|
+
...p.gimbalPitchAngle !== void 0 ? { "wpml:gimbalPitchAngle": String(p.gimbalPitchAngle) } : {},
|
|
475
|
+
"wpml:overlap": encodeOverlap(p.overlap),
|
|
476
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
477
|
+
"wpml:ellipsoidHeight": String(p.ellipsoidHeight),
|
|
478
|
+
"wpml:height": String(p.height)
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function encodeMapping3dPlacemark(p) {
|
|
482
|
+
return {
|
|
483
|
+
...p.caliFlightEnable !== void 0 ? { "wpml:caliFlightEnable": formatBool(p.caliFlightEnable) } : {},
|
|
484
|
+
"wpml:inclinedGimbalPitch": String(p.inclinedGimbalPitch),
|
|
485
|
+
"wpml:inclinedFlightSpeed": String(p.inclinedFlightSpeed),
|
|
486
|
+
"wpml:shootType": p.shootType,
|
|
487
|
+
"wpml:direction": String(p.direction),
|
|
488
|
+
"wpml:margin": String(p.margin),
|
|
489
|
+
"wpml:overlap": encodeOverlap(p.overlap),
|
|
490
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
491
|
+
"wpml:ellipsoidHeight": String(p.ellipsoidHeight),
|
|
492
|
+
"wpml:height": String(p.height)
|
|
493
|
+
};
|
|
418
494
|
}
|
|
419
|
-
function
|
|
420
|
-
return {
|
|
495
|
+
function encodeMappingStripPlacemark(p) {
|
|
496
|
+
return {
|
|
497
|
+
LineString: { coordinates: p.LineString.coordinates },
|
|
498
|
+
"wpml:caliFlightEnable": formatBool(p.caliFlightEnable),
|
|
499
|
+
"wpml:shootType": p.shootType,
|
|
500
|
+
"wpml:direction": String(p.direction),
|
|
501
|
+
"wpml:margin": String(p.margin),
|
|
502
|
+
"wpml:singleLineEnable": formatBool(p.singleLineEnable),
|
|
503
|
+
"wpml:cuttingDistance": String(p.cuttingDistance),
|
|
504
|
+
"wpml:boundaryOptimEnable": formatBool(p.boundaryOptimEnable),
|
|
505
|
+
"wpml:leftExtend": String(p.leftExtend),
|
|
506
|
+
"wpml:rightExtend": String(p.rightExtend),
|
|
507
|
+
"wpml:includeCenterEnable": formatBool(p.includeCenterEnable),
|
|
508
|
+
"wpml:overlap": encodeOverlap(p.overlap),
|
|
509
|
+
"wpml:ellipsoidHeight": String(p.ellipsoidHeight),
|
|
510
|
+
"wpml:height": String(p.height),
|
|
511
|
+
"wpml:stripUseTemplateAltitude": formatBool(p.stripUseTemplateAltitude)
|
|
512
|
+
};
|
|
421
513
|
}
|
|
422
514
|
function encodeWaypointFolder(f) {
|
|
423
515
|
const placemarks = f.Placemark.map(encodeWaypointPlacemark);
|
|
@@ -435,73 +527,33 @@ function encodeWaypointFolder(f) {
|
|
|
435
527
|
...placemarks.length > 0 ? { Placemark: fromArray(placemarks) } : {}
|
|
436
528
|
};
|
|
437
529
|
}
|
|
438
|
-
function
|
|
530
|
+
function encodeMappingFolderBase(f) {
|
|
439
531
|
return {
|
|
440
|
-
"wpml:templateType": "mapping2d",
|
|
441
532
|
"wpml:templateId": String(f.templateId),
|
|
442
533
|
"wpml:waylineCoordinateSysParam": encodeCoordinateSysParam(f.waylineCoordinateSysParam),
|
|
443
534
|
"wpml:autoFlightSpeed": String(f.autoFlightSpeed),
|
|
444
|
-
...f.payloadParam ? { "wpml:payloadParam": encodePayloadParam(f.payloadParam) } : {}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
"wpml:
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
"wpml:overlap": encodeOverlap(f.overlap),
|
|
453
|
-
"wpml:ellipsoidHeight": String(f.ellipsoidHeight),
|
|
454
|
-
"wpml:height": String(f.height),
|
|
455
|
-
...f.facadeWaylineEnable !== void 0 ? { "wpml:facadeWaylineEnable": formatBool(f.facadeWaylineEnable) } : {},
|
|
456
|
-
...f.mappingHeadingParam ? { "wpml:mappingHeadingParam": encodeMappingHeadingParam(f.mappingHeadingParam) } : {},
|
|
457
|
-
...f.gimbalPitchMode !== void 0 ? { "wpml:gimbalPitchMode": f.gimbalPitchMode } : {},
|
|
458
|
-
...f.gimbalPitchAngle !== void 0 ? { "wpml:gimbalPitchAngle": String(f.gimbalPitchAngle) } : {},
|
|
459
|
-
...f.quickOrthoMappingEnable !== void 0 ? { "wpml:quickOrthoMappingEnable": formatBool(f.quickOrthoMappingEnable) } : {},
|
|
460
|
-
...f.quickOrthoMappingPitch !== void 0 ? { "wpml:quickOrthoMappingPitch": String(f.quickOrthoMappingPitch) } : {},
|
|
461
|
-
Placemark: encodePolygonPlacemark(f.Placemark)
|
|
535
|
+
...f.payloadParam ? { "wpml:payloadParam": encodePayloadParam(f.payloadParam) } : {}
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function encodeMapping2dFolder(f) {
|
|
539
|
+
return {
|
|
540
|
+
"wpml:templateType": "mapping2d",
|
|
541
|
+
...encodeMappingFolderBase(f),
|
|
542
|
+
Placemark: encodeMapping2dPlacemark(f.Placemark)
|
|
462
543
|
};
|
|
463
544
|
}
|
|
464
545
|
function encodeMapping3dFolder(f) {
|
|
465
546
|
return {
|
|
466
547
|
"wpml:templateType": "mapping3d",
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
"wpml:autoFlightSpeed": String(f.autoFlightSpeed),
|
|
470
|
-
...f.payloadParam ? { "wpml:payloadParam": encodePayloadParam(f.payloadParam) } : {},
|
|
471
|
-
...f.caliFlightEnable !== void 0 ? { "wpml:caliFlightEnable": formatBool(f.caliFlightEnable) } : {},
|
|
472
|
-
"wpml:inclinedGimbalPitch": String(f.inclinedGimbalPitch),
|
|
473
|
-
"wpml:inclinedFlightSpeed": String(f.inclinedFlightSpeed),
|
|
474
|
-
"wpml:shootType": f.shootType,
|
|
475
|
-
"wpml:direction": String(f.direction),
|
|
476
|
-
"wpml:margin": String(f.margin),
|
|
477
|
-
"wpml:overlap": encodeOverlap(f.overlap),
|
|
478
|
-
"wpml:ellipsoidHeight": String(f.ellipsoidHeight),
|
|
479
|
-
"wpml:height": String(f.height),
|
|
480
|
-
Placemark: encodePolygonPlacemark(f.Placemark)
|
|
548
|
+
...encodeMappingFolderBase(f),
|
|
549
|
+
Placemark: encodeMapping3dPlacemark(f.Placemark)
|
|
481
550
|
};
|
|
482
551
|
}
|
|
483
552
|
function encodeMappingStripFolder(f) {
|
|
484
553
|
return {
|
|
485
554
|
"wpml:templateType": "mappingStrip",
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
"wpml:autoFlightSpeed": String(f.autoFlightSpeed),
|
|
489
|
-
...f.payloadParam ? { "wpml:payloadParam": encodePayloadParam(f.payloadParam) } : {},
|
|
490
|
-
"wpml:caliFlightEnable": formatBool(f.caliFlightEnable),
|
|
491
|
-
"wpml:shootType": f.shootType,
|
|
492
|
-
"wpml:direction": String(f.direction),
|
|
493
|
-
"wpml:margin": String(f.margin),
|
|
494
|
-
"wpml:singleLineEnable": formatBool(f.singleLineEnable),
|
|
495
|
-
"wpml:cuttingDistance": String(f.cuttingDistance),
|
|
496
|
-
"wpml:boundaryOptimEnable": formatBool(f.boundaryOptimEnable),
|
|
497
|
-
"wpml:leftExtend": String(f.leftExtend),
|
|
498
|
-
"wpml:rightExtend": String(f.rightExtend),
|
|
499
|
-
"wpml:includeCenterEnable": formatBool(f.includeCenterEnable),
|
|
500
|
-
"wpml:overlap": encodeOverlap(f.overlap),
|
|
501
|
-
"wpml:ellipsoidHeight": String(f.ellipsoidHeight),
|
|
502
|
-
"wpml:height": String(f.height),
|
|
503
|
-
"wpml:stripUseTemplateAltitude": formatBool(f.stripUseTemplateAltitude),
|
|
504
|
-
Placemark: encodeLineStringPlacemark(f.Placemark)
|
|
555
|
+
...encodeMappingFolderBase(f),
|
|
556
|
+
Placemark: encodeMappingStripPlacemark(f.Placemark)
|
|
505
557
|
};
|
|
506
558
|
}
|
|
507
559
|
function encodeTemplateFolder(t) {
|
|
@@ -529,17 +581,7 @@ function encodeTemplate(template) {
|
|
|
529
581
|
//#region src/codec/encode-waylines.ts
|
|
530
582
|
function encodeStartActionGroup(g) {
|
|
531
583
|
const items = g.action.map(encodeAction);
|
|
532
|
-
return {
|
|
533
|
-
"wpml:actionGroupId": String(g.actionGroupId),
|
|
534
|
-
"wpml:actionGroupStartIndex": String(g.actionGroupStartIndex),
|
|
535
|
-
"wpml:actionGroupEndIndex": String(g.actionGroupEndIndex),
|
|
536
|
-
"wpml:actionGroupMode": g.actionGroupMode,
|
|
537
|
-
"wpml:actionTrigger": {
|
|
538
|
-
"wpml:actionTriggerType": g.actionTrigger.actionTriggerType,
|
|
539
|
-
...g.actionTrigger.actionTriggerParam !== void 0 ? { "wpml:actionTriggerParam": String(g.actionTrigger.actionTriggerParam) } : {}
|
|
540
|
-
},
|
|
541
|
-
...items.length > 0 ? { "wpml:action": fromArray(items) } : {}
|
|
542
|
-
};
|
|
584
|
+
return items.length > 0 ? { "wpml:action": fromArray(items) } : {};
|
|
543
585
|
}
|
|
544
586
|
function encodePlacemark(p) {
|
|
545
587
|
const groups = (p.actionGroup ?? []).map(encodeActionGroup);
|
|
@@ -552,7 +594,12 @@ function encodePlacemark(p) {
|
|
|
552
594
|
"wpml:waypointTurnParam": encodeWaypointTurnParam(p.waypointTurnParam),
|
|
553
595
|
...p.useStraightLine !== void 0 ? { "wpml:useStraightLine": formatBool(p.useStraightLine) } : {},
|
|
554
596
|
...p.isRisky !== void 0 ? { "wpml:isRisky": formatBool(p.isRisky) } : {},
|
|
555
|
-
...groups.length > 0 ? { "wpml:actionGroup": fromArray(groups) } : {}
|
|
597
|
+
...groups.length > 0 ? { "wpml:actionGroup": fromArray(groups) } : {},
|
|
598
|
+
...p.waypointGimbalHeadingParam !== void 0 ? { "wpml:waypointGimbalHeadingParam": {
|
|
599
|
+
"wpml:waypointGimbalPitchAngle": String(p.waypointGimbalHeadingParam.waypointGimbalPitchAngle),
|
|
600
|
+
"wpml:waypointGimbalYawAngle": String(p.waypointGimbalHeadingParam.waypointGimbalYawAngle)
|
|
601
|
+
} } : {},
|
|
602
|
+
...p.waypointWorkType !== void 0 ? { "wpml:waypointWorkType": String(p.waypointWorkType) } : {}
|
|
556
603
|
};
|
|
557
604
|
}
|
|
558
605
|
function encodeFolder(f) {
|
|
@@ -770,6 +817,7 @@ function decodeAction(raw) {
|
|
|
770
817
|
...p["wpml:payloadPositionIndex"] !== void 0 ? { payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex") } : {},
|
|
771
818
|
...lens.length > 0 ? { payloadLensIndex: lens } : {},
|
|
772
819
|
...p["wpml:useGlobalPayloadLensIndex"] !== void 0 ? { useGlobalPayloadLensIndex: parseBool(p["wpml:useGlobalPayloadLensIndex"], "useGlobalPayloadLensIndex") } : {},
|
|
820
|
+
...p["wpml:actionUUID"] !== void 0 ? { actionUUID: p["wpml:actionUUID"] } : {},
|
|
773
821
|
panoShotSubMode: need(p["wpml:panoShotSubMode"], "panoShotSubMode")
|
|
774
822
|
}
|
|
775
823
|
};
|
|
@@ -808,6 +856,51 @@ function decodeAction(raw) {
|
|
|
808
856
|
searchlightBrightness: parseNum(p["wpml:searchlightBrightness"], "searchlightBrightness")
|
|
809
857
|
}
|
|
810
858
|
};
|
|
859
|
+
case "startSmartOblique": return {
|
|
860
|
+
actionId: id,
|
|
861
|
+
actionActuatorFunc: "startSmartOblique",
|
|
862
|
+
actionActuatorFuncParam: { payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex") }
|
|
863
|
+
};
|
|
864
|
+
case "stopSmartOblique": return {
|
|
865
|
+
actionId: id,
|
|
866
|
+
actionActuatorFunc: "stopSmartOblique",
|
|
867
|
+
actionActuatorFuncParam: { payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex") }
|
|
868
|
+
};
|
|
869
|
+
case "startTimeLapse": return {
|
|
870
|
+
actionId: id,
|
|
871
|
+
actionActuatorFunc: "startTimeLapse",
|
|
872
|
+
actionActuatorFuncParam: {
|
|
873
|
+
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex"),
|
|
874
|
+
useGlobalPayloadLensIndex: parseBool(p["wpml:useGlobalPayloadLensIndex"], "useGlobalPayloadLensIndex"),
|
|
875
|
+
payloadLensIndex: need(p["wpml:payloadLensIndex"], "payloadLensIndex"),
|
|
876
|
+
minShootInterval: parseNum(p["wpml:minShootInterval"], "minShootInterval")
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
case "stopTimeLapse": return {
|
|
880
|
+
actionId: id,
|
|
881
|
+
actionActuatorFunc: "stopTimeLapse",
|
|
882
|
+
actionActuatorFuncParam: {
|
|
883
|
+
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex"),
|
|
884
|
+
payloadLensIndex: need(p["wpml:payloadLensIndex"], "payloadLensIndex")
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
case "gimbalAngleLock": return {
|
|
888
|
+
actionId: id,
|
|
889
|
+
actionActuatorFunc: "gimbalAngleLock",
|
|
890
|
+
actionActuatorFuncParam: { payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex") }
|
|
891
|
+
};
|
|
892
|
+
case "gimbalAngleUnlock": return {
|
|
893
|
+
actionId: id,
|
|
894
|
+
actionActuatorFunc: "gimbalAngleUnlock"
|
|
895
|
+
};
|
|
896
|
+
case "setFocusType": return {
|
|
897
|
+
actionId: id,
|
|
898
|
+
actionActuatorFunc: "setFocusType",
|
|
899
|
+
actionActuatorFuncParam: {
|
|
900
|
+
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex"),
|
|
901
|
+
cameraFocusType: need(p["wpml:cameraFocusType"], "cameraFocusType")
|
|
902
|
+
}
|
|
903
|
+
};
|
|
811
904
|
default: throw new KmzError(`Unknown actionActuatorFunc: "${String(func)}"`);
|
|
812
905
|
}
|
|
813
906
|
}
|
|
@@ -852,6 +945,7 @@ function decodeMissionConfig(raw) {
|
|
|
852
945
|
},
|
|
853
946
|
payloadInfo: toArray(raw["wpml:payloadInfo"]).map((p) => ({
|
|
854
947
|
payloadEnumValue: parseNum(p["wpml:payloadEnumValue"], "payloadEnumValue"),
|
|
948
|
+
...p["wpml:payloadSubEnumValue"] !== void 0 ? { payloadSubEnumValue: parseOptNum(p["wpml:payloadSubEnumValue"]) } : {},
|
|
855
949
|
payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex")
|
|
856
950
|
})),
|
|
857
951
|
...reroute ? { autoRerouteInfo: {
|
|
@@ -869,7 +963,8 @@ function decodeCoordinateSysParam(raw) {
|
|
|
869
963
|
...raw["wpml:positioningType"] !== void 0 ? { positioningType: raw["wpml:positioningType"] } : {},
|
|
870
964
|
...raw["wpml:globalShootHeight"] !== void 0 ? { globalShootHeight: meters(parseNum(raw["wpml:globalShootHeight"], "globalShootHeight")) } : {},
|
|
871
965
|
...raw["wpml:surfaceFollowModeEnable"] !== void 0 ? { surfaceFollowModeEnable: parseBool(raw["wpml:surfaceFollowModeEnable"], "surfaceFollowModeEnable") } : {},
|
|
872
|
-
...raw["wpml:surfaceRelativeHeight"] !== void 0 ? { surfaceRelativeHeight: meters(parseNum(raw["wpml:surfaceRelativeHeight"], "surfaceRelativeHeight")) } : {}
|
|
966
|
+
...raw["wpml:surfaceRelativeHeight"] !== void 0 ? { surfaceRelativeHeight: meters(parseNum(raw["wpml:surfaceRelativeHeight"], "surfaceRelativeHeight")) } : {},
|
|
967
|
+
...raw["wpml:isRealtimeSurfaceFollow"] !== void 0 ? { isRealtimeSurfaceFollow: parseBool(raw["wpml:isRealtimeSurfaceFollow"], "isRealtimeSurfaceFollow") } : {}
|
|
873
968
|
};
|
|
874
969
|
}
|
|
875
970
|
function decodePayloadParam(raw) {
|
|
@@ -882,7 +977,8 @@ function decodePayloadParam(raw) {
|
|
|
882
977
|
...raw["wpml:samplingRate"] !== void 0 ? { samplingRate: parseNum(raw["wpml:samplingRate"], "samplingRate") } : {},
|
|
883
978
|
...raw["wpml:scanningMode"] !== void 0 ? { scanningMode: raw["wpml:scanningMode"] } : {},
|
|
884
979
|
...raw["wpml:modelColoringEnable"] !== void 0 ? { modelColoringEnable: parseBool(raw["wpml:modelColoringEnable"], "modelColoringEnable") } : {},
|
|
885
|
-
imageFormat: parseLensList(raw["wpml:imageFormat"])
|
|
980
|
+
imageFormat: parseLensList(raw["wpml:imageFormat"]),
|
|
981
|
+
...raw["wpml:photoSize"] !== void 0 ? { photoSize: raw["wpml:photoSize"] } : {}
|
|
886
982
|
};
|
|
887
983
|
}
|
|
888
984
|
function decodeWaypointHeadingParam(raw) {
|
|
@@ -890,7 +986,9 @@ function decodeWaypointHeadingParam(raw) {
|
|
|
890
986
|
waypointHeadingMode: raw["wpml:waypointHeadingMode"],
|
|
891
987
|
...raw["wpml:waypointHeadingAngle"] !== void 0 ? { waypointHeadingAngle: degrees(parseNum(raw["wpml:waypointHeadingAngle"], "waypointHeadingAngle")) } : {},
|
|
892
988
|
...raw["wpml:waypointPoiPoint"] !== void 0 ? { waypointPoiPoint: parseLngLatHeight(raw["wpml:waypointPoiPoint"]) } : {},
|
|
893
|
-
|
|
989
|
+
...raw["wpml:waypointHeadingAngleEnable"] !== void 0 ? { waypointHeadingAngleEnable: parseBool(raw["wpml:waypointHeadingAngleEnable"], "waypointHeadingAngleEnable") } : {},
|
|
990
|
+
waypointHeadingPathMode: raw["wpml:waypointHeadingPathMode"] ?? "followBadArc",
|
|
991
|
+
...raw["wpml:waypointHeadingPoiIndex"] !== void 0 ? { waypointHeadingPoiIndex: parseNum(raw["wpml:waypointHeadingPoiIndex"], "waypointHeadingPoiIndex") } : {}
|
|
894
992
|
};
|
|
895
993
|
}
|
|
896
994
|
function decodeWaypointTurnParam(raw) {
|
|
@@ -938,8 +1036,59 @@ function decodeWaypointPlacemark(raw) {
|
|
|
938
1036
|
if (groups.length > 0) out.actionGroup = groups;
|
|
939
1037
|
return out;
|
|
940
1038
|
}
|
|
941
|
-
function
|
|
942
|
-
return {
|
|
1039
|
+
function decodeMapping2dPlacemark(p) {
|
|
1040
|
+
return {
|
|
1041
|
+
...p["wpml:caliFlightEnable"] !== void 0 ? { caliFlightEnable: parseBool(p["wpml:caliFlightEnable"], "caliFlightEnable") } : {},
|
|
1042
|
+
elevationOptimizeEnable: parseBool(p["wpml:elevationOptimizeEnable"], "elevationOptimizeEnable"),
|
|
1043
|
+
...p["wpml:smartObliqueEnable"] !== void 0 ? { smartObliqueEnable: parseBool(p["wpml:smartObliqueEnable"], "smartObliqueEnable") } : {},
|
|
1044
|
+
...p["wpml:smartObliqueGimbalPitch"] !== void 0 ? { smartObliqueGimbalPitch: degrees(parseNum(p["wpml:smartObliqueGimbalPitch"], "smartObliqueGimbalPitch")) } : {},
|
|
1045
|
+
...p["wpml:quickOrthoMappingEnable"] !== void 0 ? { quickOrthoMappingEnable: parseBool(p["wpml:quickOrthoMappingEnable"], "quickOrthoMappingEnable") } : {},
|
|
1046
|
+
...p["wpml:quickOrthoMappingPitch"] !== void 0 ? { quickOrthoMappingPitch: degrees(parseNum(p["wpml:quickOrthoMappingPitch"], "quickOrthoMappingPitch")) } : {},
|
|
1047
|
+
...p["wpml:facadeWaylineEnable"] !== void 0 ? { facadeWaylineEnable: parseBool(p["wpml:facadeWaylineEnable"], "facadeWaylineEnable") } : {},
|
|
1048
|
+
shootType: p["wpml:shootType"],
|
|
1049
|
+
direction: degrees(parseNum(p["wpml:direction"], "direction")),
|
|
1050
|
+
margin: parseNum(p["wpml:margin"], "margin"),
|
|
1051
|
+
...p["wpml:mappingHeadingParam"] ? { mappingHeadingParam: decodeMappingHeadingParam(p["wpml:mappingHeadingParam"]) } : {},
|
|
1052
|
+
...p["wpml:gimbalPitchMode"] !== void 0 ? { gimbalPitchMode: p["wpml:gimbalPitchMode"] } : {},
|
|
1053
|
+
...p["wpml:gimbalPitchAngle"] !== void 0 ? { gimbalPitchAngle: degrees(parseNum(p["wpml:gimbalPitchAngle"], "gimbalPitchAngle")) } : {},
|
|
1054
|
+
overlap: decodeOverlap(p["wpml:overlap"]),
|
|
1055
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
1056
|
+
ellipsoidHeight: meters(parseNum(p["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
1057
|
+
height: meters(parseNum(p["wpml:height"], "height"))
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
function decodeMapping3dPlacemark(p) {
|
|
1061
|
+
return {
|
|
1062
|
+
...p["wpml:caliFlightEnable"] !== void 0 ? { caliFlightEnable: parseBool(p["wpml:caliFlightEnable"], "caliFlightEnable") } : {},
|
|
1063
|
+
inclinedGimbalPitch: degrees(parseNum(p["wpml:inclinedGimbalPitch"], "inclinedGimbalPitch")),
|
|
1064
|
+
inclinedFlightSpeed: metersPerSecond(parseNum(p["wpml:inclinedFlightSpeed"], "inclinedFlightSpeed")),
|
|
1065
|
+
shootType: p["wpml:shootType"],
|
|
1066
|
+
direction: degrees(parseNum(p["wpml:direction"], "direction")),
|
|
1067
|
+
margin: parseNum(p["wpml:margin"], "margin"),
|
|
1068
|
+
overlap: decodeOverlap(p["wpml:overlap"]),
|
|
1069
|
+
Polygon: { outerBoundaryIs: { LinearRing: { coordinates: p.Polygon.outerBoundaryIs.LinearRing.coordinates } } },
|
|
1070
|
+
ellipsoidHeight: meters(parseNum(p["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
1071
|
+
height: meters(parseNum(p["wpml:height"], "height"))
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
function decodeMappingStripPlacemark(p) {
|
|
1075
|
+
return {
|
|
1076
|
+
caliFlightEnable: parseBool(p["wpml:caliFlightEnable"], "caliFlightEnable"),
|
|
1077
|
+
shootType: p["wpml:shootType"],
|
|
1078
|
+
direction: degrees(parseNum(p["wpml:direction"], "direction")),
|
|
1079
|
+
margin: parseNum(p["wpml:margin"], "margin"),
|
|
1080
|
+
singleLineEnable: parseBool(p["wpml:singleLineEnable"], "singleLineEnable"),
|
|
1081
|
+
cuttingDistance: parseNum(p["wpml:cuttingDistance"], "cuttingDistance"),
|
|
1082
|
+
boundaryOptimEnable: parseBool(p["wpml:boundaryOptimEnable"], "boundaryOptimEnable"),
|
|
1083
|
+
leftExtend: parseNum(p["wpml:leftExtend"], "leftExtend"),
|
|
1084
|
+
rightExtend: parseNum(p["wpml:rightExtend"], "rightExtend"),
|
|
1085
|
+
includeCenterEnable: parseBool(p["wpml:includeCenterEnable"], "includeCenterEnable"),
|
|
1086
|
+
overlap: decodeOverlap(p["wpml:overlap"]),
|
|
1087
|
+
LineString: { coordinates: p.LineString.coordinates },
|
|
1088
|
+
ellipsoidHeight: meters(parseNum(p["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
1089
|
+
height: meters(parseNum(p["wpml:height"], "height")),
|
|
1090
|
+
stripUseTemplateAltitude: parseBool(p["wpml:stripUseTemplateAltitude"], "stripUseTemplateAltitude")
|
|
1091
|
+
};
|
|
943
1092
|
}
|
|
944
1093
|
function decodeWaypointFolder(raw) {
|
|
945
1094
|
const placemarks = toArray(raw.Placemark).map(decodeWaypointPlacemark);
|
|
@@ -968,23 +1117,7 @@ function decodeMapping2dFolder(raw) {
|
|
|
968
1117
|
waylineCoordinateSysParam: decodeCoordinateSysParam(raw["wpml:waylineCoordinateSysParam"]),
|
|
969
1118
|
autoFlightSpeed: metersPerSecond(parseNum(raw["wpml:autoFlightSpeed"], "autoFlightSpeed")),
|
|
970
1119
|
...raw["wpml:payloadParam"] ? { payloadParam: decodePayloadParam(raw["wpml:payloadParam"]) } : {},
|
|
971
|
-
|
|
972
|
-
elevationOptimizeEnable: parseBool(raw["wpml:elevationOptimizeEnable"], "elevationOptimizeEnable"),
|
|
973
|
-
...raw["wpml:smartObliqueEnable"] !== void 0 ? { smartObliqueEnable: parseBool(raw["wpml:smartObliqueEnable"], "smartObliqueEnable") } : {},
|
|
974
|
-
...raw["wpml:smartObliqueGimbalPitch"] !== void 0 ? { smartObliqueGimbalPitch: degrees(parseNum(raw["wpml:smartObliqueGimbalPitch"], "smartObliqueGimbalPitch")) } : {},
|
|
975
|
-
shootType: raw["wpml:shootType"],
|
|
976
|
-
direction: degrees(parseNum(raw["wpml:direction"], "direction")),
|
|
977
|
-
margin: parseNum(raw["wpml:margin"], "margin"),
|
|
978
|
-
overlap: decodeOverlap(raw["wpml:overlap"]),
|
|
979
|
-
ellipsoidHeight: meters(parseNum(raw["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
980
|
-
height: meters(parseNum(raw["wpml:height"], "height")),
|
|
981
|
-
...raw["wpml:facadeWaylineEnable"] !== void 0 ? { facadeWaylineEnable: parseBool(raw["wpml:facadeWaylineEnable"], "facadeWaylineEnable") } : {},
|
|
982
|
-
...raw["wpml:mappingHeadingParam"] ? { mappingHeadingParam: decodeMappingHeadingParam(raw["wpml:mappingHeadingParam"]) } : {},
|
|
983
|
-
...raw["wpml:gimbalPitchMode"] !== void 0 ? { gimbalPitchMode: raw["wpml:gimbalPitchMode"] } : {},
|
|
984
|
-
...raw["wpml:gimbalPitchAngle"] !== void 0 ? { gimbalPitchAngle: degrees(parseNum(raw["wpml:gimbalPitchAngle"], "gimbalPitchAngle")) } : {},
|
|
985
|
-
...raw["wpml:quickOrthoMappingEnable"] !== void 0 ? { quickOrthoMappingEnable: parseBool(raw["wpml:quickOrthoMappingEnable"], "quickOrthoMappingEnable") } : {},
|
|
986
|
-
...raw["wpml:quickOrthoMappingPitch"] !== void 0 ? { quickOrthoMappingPitch: degrees(parseNum(raw["wpml:quickOrthoMappingPitch"], "quickOrthoMappingPitch")) } : {},
|
|
987
|
-
Placemark: decodePolygonPlacemark(raw.Placemark)
|
|
1120
|
+
Placemark: decodeMapping2dPlacemark(raw.Placemark)
|
|
988
1121
|
},
|
|
989
1122
|
missionConfig: void 0
|
|
990
1123
|
};
|
|
@@ -997,16 +1130,7 @@ function decodeMapping3dFolder(raw) {
|
|
|
997
1130
|
waylineCoordinateSysParam: decodeCoordinateSysParam(raw["wpml:waylineCoordinateSysParam"]),
|
|
998
1131
|
autoFlightSpeed: metersPerSecond(parseNum(raw["wpml:autoFlightSpeed"], "autoFlightSpeed")),
|
|
999
1132
|
...raw["wpml:payloadParam"] ? { payloadParam: decodePayloadParam(raw["wpml:payloadParam"]) } : {},
|
|
1000
|
-
|
|
1001
|
-
inclinedGimbalPitch: degrees(parseNum(raw["wpml:inclinedGimbalPitch"], "inclinedGimbalPitch")),
|
|
1002
|
-
inclinedFlightSpeed: metersPerSecond(parseNum(raw["wpml:inclinedFlightSpeed"], "inclinedFlightSpeed")),
|
|
1003
|
-
shootType: raw["wpml:shootType"],
|
|
1004
|
-
direction: degrees(parseNum(raw["wpml:direction"], "direction")),
|
|
1005
|
-
margin: parseNum(raw["wpml:margin"], "margin"),
|
|
1006
|
-
overlap: decodeOverlap(raw["wpml:overlap"]),
|
|
1007
|
-
ellipsoidHeight: meters(parseNum(raw["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
1008
|
-
height: meters(parseNum(raw["wpml:height"], "height")),
|
|
1009
|
-
Placemark: decodePolygonPlacemark(raw.Placemark)
|
|
1133
|
+
Placemark: decodeMapping3dPlacemark(raw.Placemark)
|
|
1010
1134
|
},
|
|
1011
1135
|
missionConfig: void 0
|
|
1012
1136
|
};
|
|
@@ -1019,21 +1143,7 @@ function decodeMappingStripFolder(raw) {
|
|
|
1019
1143
|
waylineCoordinateSysParam: decodeCoordinateSysParam(raw["wpml:waylineCoordinateSysParam"]),
|
|
1020
1144
|
autoFlightSpeed: metersPerSecond(parseNum(raw["wpml:autoFlightSpeed"], "autoFlightSpeed")),
|
|
1021
1145
|
...raw["wpml:payloadParam"] ? { payloadParam: decodePayloadParam(raw["wpml:payloadParam"]) } : {},
|
|
1022
|
-
|
|
1023
|
-
shootType: raw["wpml:shootType"],
|
|
1024
|
-
direction: degrees(parseNum(raw["wpml:direction"], "direction")),
|
|
1025
|
-
margin: parseNum(raw["wpml:margin"], "margin"),
|
|
1026
|
-
singleLineEnable: parseBool(raw["wpml:singleLineEnable"], "singleLineEnable"),
|
|
1027
|
-
cuttingDistance: parseNum(raw["wpml:cuttingDistance"], "cuttingDistance"),
|
|
1028
|
-
boundaryOptimEnable: parseBool(raw["wpml:boundaryOptimEnable"], "boundaryOptimEnable"),
|
|
1029
|
-
leftExtend: parseNum(raw["wpml:leftExtend"], "leftExtend"),
|
|
1030
|
-
rightExtend: parseNum(raw["wpml:rightExtend"], "rightExtend"),
|
|
1031
|
-
includeCenterEnable: parseBool(raw["wpml:includeCenterEnable"], "includeCenterEnable"),
|
|
1032
|
-
overlap: decodeOverlap(raw["wpml:overlap"]),
|
|
1033
|
-
ellipsoidHeight: meters(parseNum(raw["wpml:ellipsoidHeight"], "ellipsoidHeight")),
|
|
1034
|
-
height: meters(parseNum(raw["wpml:height"], "height")),
|
|
1035
|
-
stripUseTemplateAltitude: parseBool(raw["wpml:stripUseTemplateAltitude"], "stripUseTemplateAltitude"),
|
|
1036
|
-
Placemark: { LineString: { coordinates: raw.Placemark.LineString.coordinates } }
|
|
1146
|
+
Placemark: decodeMappingStripPlacemark(raw.Placemark)
|
|
1037
1147
|
},
|
|
1038
1148
|
missionConfig: void 0
|
|
1039
1149
|
};
|
|
@@ -1063,17 +1173,7 @@ function decodeTemplate(raw) {
|
|
|
1063
1173
|
//#endregion
|
|
1064
1174
|
//#region src/codec/decode-waylines.ts
|
|
1065
1175
|
function decodeStartActionGroup(raw) {
|
|
1066
|
-
return {
|
|
1067
|
-
actionGroupId: parseNum(raw["wpml:actionGroupId"], "actionGroupId"),
|
|
1068
|
-
actionGroupStartIndex: parseNum(raw["wpml:actionGroupStartIndex"], "actionGroupStartIndex"),
|
|
1069
|
-
actionGroupEndIndex: parseNum(raw["wpml:actionGroupEndIndex"], "actionGroupEndIndex"),
|
|
1070
|
-
actionGroupMode: raw["wpml:actionGroupMode"] ?? "sequence",
|
|
1071
|
-
actionTrigger: {
|
|
1072
|
-
actionTriggerType: raw["wpml:actionTrigger"]["wpml:actionTriggerType"],
|
|
1073
|
-
...raw["wpml:actionTrigger"]["wpml:actionTriggerParam"] !== void 0 ? { actionTriggerParam: parseOptNum(raw["wpml:actionTrigger"]["wpml:actionTriggerParam"]) } : {}
|
|
1074
|
-
},
|
|
1075
|
-
action: toArray(raw["wpml:action"]).map(decodeAction)
|
|
1076
|
-
};
|
|
1176
|
+
return { action: toArray(raw["wpml:action"]).map(decodeAction) };
|
|
1077
1177
|
}
|
|
1078
1178
|
function decodePlacemark(raw) {
|
|
1079
1179
|
const groups = decodeActionGroups(raw["wpml:actionGroup"]);
|
|
@@ -1088,6 +1188,14 @@ function decodePlacemark(raw) {
|
|
|
1088
1188
|
if (raw["wpml:useStraightLine"] !== void 0) out.useStraightLine = parseBool(raw["wpml:useStraightLine"], "useStraightLine");
|
|
1089
1189
|
if (raw["wpml:isRisky"] !== void 0) out.isRisky = parseBool(raw["wpml:isRisky"], "isRisky");
|
|
1090
1190
|
if (groups.length > 0) out.actionGroup = groups;
|
|
1191
|
+
if (raw["wpml:waypointGimbalHeadingParam"] !== void 0) {
|
|
1192
|
+
const g = raw["wpml:waypointGimbalHeadingParam"];
|
|
1193
|
+
out.waypointGimbalHeadingParam = {
|
|
1194
|
+
waypointGimbalPitchAngle: degrees(parseNum(g["wpml:waypointGimbalPitchAngle"], "waypointGimbalPitchAngle")),
|
|
1195
|
+
waypointGimbalYawAngle: degrees(parseNum(g["wpml:waypointGimbalYawAngle"], "waypointGimbalYawAngle"))
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
if (raw["wpml:waypointWorkType"] !== void 0) out.waypointWorkType = parseNum(raw["wpml:waypointWorkType"], "waypointWorkType");
|
|
1091
1199
|
return out;
|
|
1092
1200
|
}
|
|
1093
1201
|
function decodeFolder(raw) {
|
package/dist/wasm_kmz.js
CHANGED
|
@@ -115,19 +115,19 @@ export function xmlToJson(xml_string) {
|
|
|
115
115
|
function __wbg_get_imports() {
|
|
116
116
|
const import0 = {
|
|
117
117
|
__proto__: null,
|
|
118
|
-
|
|
118
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
119
119
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
120
120
|
return addHeapObject(ret);
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
__wbg___wbindgen_is_null_87c3bfe968c6a5ad: function(arg0) {
|
|
123
123
|
const ret = getObject(arg0) === null;
|
|
124
124
|
return ret;
|
|
125
125
|
},
|
|
126
|
-
|
|
126
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
127
127
|
const ret = getObject(arg0) === undefined;
|
|
128
128
|
return ret;
|
|
129
129
|
},
|
|
130
|
-
|
|
130
|
+
__wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
|
|
131
131
|
const obj = getObject(arg1);
|
|
132
132
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
133
133
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -135,53 +135,53 @@ function __wbg_get_imports() {
|
|
|
135
135
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
136
136
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
137
137
|
},
|
|
138
|
-
|
|
138
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
139
139
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
140
140
|
},
|
|
141
|
-
|
|
141
|
+
__wbg_from_d300fe49deab18f5: function(arg0) {
|
|
142
142
|
const ret = Array.from(getObject(arg0));
|
|
143
143
|
return addHeapObject(ret);
|
|
144
144
|
},
|
|
145
|
-
|
|
145
|
+
__wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
|
|
146
146
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
147
147
|
return addHeapObject(ret);
|
|
148
148
|
}, arguments); },
|
|
149
|
-
|
|
149
|
+
__wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
|
|
150
150
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
151
151
|
return addHeapObject(ret);
|
|
152
152
|
},
|
|
153
|
-
|
|
153
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
154
154
|
const ret = getObject(arg0).length;
|
|
155
155
|
return ret;
|
|
156
156
|
},
|
|
157
|
-
|
|
157
|
+
__wbg_length_66f1a4b2e9026940: function(arg0) {
|
|
158
158
|
const ret = getObject(arg0).length;
|
|
159
159
|
return ret;
|
|
160
160
|
},
|
|
161
|
-
|
|
162
|
-
const ret = new
|
|
161
|
+
__wbg_new_578aeef4b6b94378: function(arg0) {
|
|
162
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
163
163
|
return addHeapObject(ret);
|
|
164
164
|
},
|
|
165
|
-
|
|
166
|
-
const ret = new
|
|
165
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
166
|
+
const ret = new Object();
|
|
167
167
|
return addHeapObject(ret);
|
|
168
168
|
},
|
|
169
|
-
|
|
170
|
-
const ret = new
|
|
169
|
+
__wbg_new_d90091b82fdf5b91: function() {
|
|
170
|
+
const ret = new Array();
|
|
171
171
|
return addHeapObject(ret);
|
|
172
172
|
},
|
|
173
|
-
|
|
173
|
+
__wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
|
|
174
174
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
175
175
|
return addHeapObject(ret);
|
|
176
176
|
},
|
|
177
|
-
|
|
177
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
178
178
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
179
179
|
},
|
|
180
|
-
|
|
180
|
+
__wbg_push_a6822215aa43e71c: function(arg0, arg1) {
|
|
181
181
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
182
182
|
return ret;
|
|
183
183
|
},
|
|
184
|
-
|
|
184
|
+
__wbg_set_6e30c9374c26414c: function() { return handleError(function (arg0, arg1, arg2) {
|
|
185
185
|
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
186
186
|
return ret;
|
|
187
187
|
}, arguments); },
|
package/dist/wasm_kmz_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumikmz/kmz-file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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.4.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vite-plus": "latest",
|