drone-path 0.13.0 → 1.0.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.
Files changed (84) hide show
  1. package/README.md +20 -74
  2. package/THIRD-PARTY-NOTICES.md +3 -82
  3. package/bin/drone-path.mjs +0 -0
  4. package/dist/archive-cli.d.ts +1 -0
  5. package/dist/archive-cli.js +50 -0
  6. package/dist/archive-query-cli.d.ts +3 -0
  7. package/dist/archive-query-cli.js +128 -0
  8. package/dist/cli.d.ts +14 -0
  9. package/dist/cli.js +19 -12
  10. package/dist/version.d.ts +1 -0
  11. package/package.json +22 -68
  12. package/CHANGELOG.md +0 -349
  13. package/app/ipc.d.mts +0 -44
  14. package/app/ipc.mjs +0 -237
  15. package/app/main.mjs +0 -369
  16. package/app/preload.cjs +0 -36
  17. package/app/update-policy.d.mts +0 -6
  18. package/app/update-policy.mjs +0 -6
  19. package/app/update.d.mts +0 -10
  20. package/app/update.mjs +0 -54
  21. package/dist/appassets.js +0 -35
  22. package/dist/apppaths.js +0 -20
  23. package/dist/appsession.js +0 -121
  24. package/dist/appstate.js +0 -101
  25. package/dist/assets.js +0 -60
  26. package/dist/buildinfo.js +0 -64
  27. package/dist/cammeta-decode.js +0 -237
  28. package/dist/cammeta.js +0 -92
  29. package/dist/changeset-gate.js +0 -39
  30. package/dist/config.js +0 -631
  31. package/dist/configfile.js +0 -86
  32. package/dist/decimate.js +0 -84
  33. package/dist/desktop-i18n/generated/catalogs.js +0 -1230
  34. package/dist/desktop-i18n/messages.js +0 -47
  35. package/dist/errors.js +0 -34
  36. package/dist/exec-tool.js +0 -13
  37. package/dist/exportjob.js +0 -90
  38. package/dist/ffmpeg-tools.js +0 -56
  39. package/dist/ffmpeg.js +0 -98
  40. package/dist/frametime.js +0 -32
  41. package/dist/geo.js +0 -60
  42. package/dist/logging.js +0 -1
  43. package/dist/manual/anchors.js +0 -17
  44. package/dist/manual/build.js +0 -67
  45. package/dist/manual/cliref.js +0 -34
  46. package/dist/manual/links.js +0 -59
  47. package/dist/manual/markdown.js +0 -98
  48. package/dist/manual/model.js +0 -1
  49. package/dist/manual/module.js +0 -5
  50. package/dist/manual/nav.js +0 -11
  51. package/dist/manual/reference.js +0 -18
  52. package/dist/paths.js +0 -16
  53. package/dist/pipeline.js +0 -402
  54. package/dist/plan.js +0 -106
  55. package/dist/png.js +0 -32
  56. package/dist/protobuf-wire.js +0 -102
  57. package/dist/range.js +0 -50
  58. package/dist/recordings.js +0 -55
  59. package/dist/render-page.js +0 -85
  60. package/dist/render.js +0 -268
  61. package/dist/renderer/boot.js +0 -7
  62. package/dist/renderer/dom.js +0 -179
  63. package/dist/renderer/framemath.js +0 -30
  64. package/dist/renderer/scene.js +0 -388
  65. package/dist/renderer/theme.js +0 -82
  66. package/dist/renderer/tilesources.js +0 -38
  67. package/dist/renderer/trail.js +0 -42
  68. package/dist/restyle.js +0 -16
  69. package/dist/serve.js +0 -27
  70. package/dist/srt.js +0 -98
  71. package/dist/telemetry-json-schema.js +0 -18
  72. package/dist/telemetry-json.js +0 -126
  73. package/dist/telemetry-math.js +0 -267
  74. package/dist/telemetry-summary.js +0 -19
  75. package/dist/telemetry.js +0 -95
  76. package/dist/tilecache.js +0 -21
  77. package/dist/tiles.js +0 -155
  78. package/dist/track-format.js +0 -13
  79. package/dist/track-geojson.js +0 -44
  80. package/dist/track-gpx.js +0 -34
  81. package/dist/track-kml.js +0 -47
  82. package/dist/track-kmz.js +0 -68
  83. package/dist/track-write.js +0 -41
  84. package/dist/track.js +0 -79
@@ -1,86 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { userDataDir } from './apppaths.js';
4
- import { CONFIG_FILE_NAME, DEFAULT_CONFIG, assertOneTrackOutSpelling, normalizeDimensions, normalizeOverrides, trackOutSpellingOf, validateRenderConfig, } from './config.js';
5
- import { errorMessage } from './errors.js';
6
- export function defaultTileCache() {
7
- const override = process.env['DRONEPATH_TILE_CACHE'];
8
- if (override)
9
- return path.resolve(override);
10
- return path.join(userDataDir(), 'tiles');
11
- }
12
- export function discoverConfigFile(startDir) {
13
- let dir = path.resolve(startDir);
14
- for (;;) {
15
- const candidate = path.join(dir, CONFIG_FILE_NAME);
16
- if (fs.existsSync(candidate))
17
- return candidate;
18
- const parent = path.dirname(dir);
19
- if (parent === dir)
20
- return null;
21
- dir = parent;
22
- }
23
- }
24
- export function loadConfigFile(file, onDeprecated) {
25
- let text;
26
- try {
27
- text = fs.readFileSync(file, 'utf8');
28
- }
29
- catch (e) {
30
- throw new Error(`cannot read config file ${file}: ${errorMessage(e)}`, {
31
- cause: e,
32
- });
33
- }
34
- let raw;
35
- try {
36
- raw = JSON.parse(text);
37
- }
38
- catch (e) {
39
- throw new Error(`config file is not valid JSON: ${file}: ${errorMessage(e)}`, { cause: e });
40
- }
41
- if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
42
- throw new Error(`config file must contain a JSON object: ${file}`);
43
- }
44
- const input = raw;
45
- return {
46
- overrides: normalizeOverrides(input, file, onDeprecated),
47
- trackOutSpelling: trackOutSpellingOf(input, file),
48
- };
49
- }
50
- function mergeConfigLayers(fileCfg, cli) {
51
- return {
52
- ...DEFAULT_CONFIG,
53
- ...fileCfg,
54
- ...cli,
55
- hud: { ...(cli.hud ?? fileCfg.hud ?? DEFAULT_CONFIG.hud) },
56
- };
57
- }
58
- function resolveConfigPaths(config, cwd) {
59
- return {
60
- ...config,
61
- tileCache: path.resolve(cwd, config.tileCache || defaultTileCache()),
62
- outDir: config.outDir ? path.resolve(cwd, config.outDir) : null,
63
- };
64
- }
65
- export function resolveConfig(opts) {
66
- const cwd = opts.cwd ?? process.cwd();
67
- const configPath = opts.configPath !== undefined && opts.configPath !== null
68
- ? path.resolve(cwd, opts.configPath)
69
- : discoverConfigFile(cwd);
70
- const fileLayer = configPath
71
- ? loadConfigFile(configPath, opts.onDeprecated)
72
- : { overrides: {}, trackOutSpelling: null };
73
- // The merged effective config may use only one spelling of the trackOut
74
- // key - across origins, not just within one of them.
75
- assertOneTrackOutSpelling([
76
- { origin: 'the config file', spelling: fileLayer.trackOutSpelling },
77
- { origin: 'the command line', spelling: opts.cliTrackOutSpelling ?? null },
78
- ]);
79
- const merged = mergeConfigLayers(fileLayer.overrides, opts.cli ?? {});
80
- validateRenderConfig(merged);
81
- const normalized = {
82
- ...merged,
83
- ...normalizeDimensions(merged.width, merged.height),
84
- };
85
- return { config: resolveConfigPaths(normalized, cwd), configPath };
86
- }
package/dist/decimate.js DELETED
@@ -1,84 +0,0 @@
1
- import { project } from './geo.js';
2
- const DEFAULT_EPSILON_PX = 1;
3
- const DEFAULT_MAX_POINTS = 3000;
4
- export function decimateTrack(lat, lon, zoom, options = {}) {
5
- const epsilonPx = options.epsilonPx ?? DEFAULT_EPSILON_PX;
6
- const maxPoints = options.maxPoints ?? DEFAULT_MAX_POINTS;
7
- if (!(epsilonPx >= 0))
8
- throw new Error('epsilon must be >= 0');
9
- if (!Number.isInteger(maxPoints) || maxPoints < 2) {
10
- throw new Error('maxPoints must be an integer >= 2');
11
- }
12
- if (lat.length !== lon.length) {
13
- throw new Error('lat and lon must have the same length');
14
- }
15
- const n = lat.length;
16
- if (n === 0)
17
- return { lat: [], lon: [], frame: [] };
18
- if (n === 1)
19
- return { lat: [lat[0]], lon: [lon[0]], frame: [0] };
20
- const px = new Array(n);
21
- for (let i = 0; i < n; i++)
22
- px[i] = project(lon[i], lat[i], zoom);
23
- let keep = douglasPeucker(px, epsilonPx);
24
- if (keep.length > maxPoints) {
25
- let hi = epsilonPx > 0 ? epsilonPx * 2 : 1;
26
- let hiKeep = douglasPeucker(px, hi);
27
- while (hiKeep.length > maxPoints) {
28
- hi *= 2;
29
- hiKeep = douglasPeucker(px, hi);
30
- }
31
- keep = hiKeep;
32
- }
33
- const track = { lat: [], lon: [], frame: [] };
34
- for (const i of keep) {
35
- track.lat.push(lat[i]);
36
- track.lon.push(lon[i]);
37
- track.frame.push(i);
38
- }
39
- return track;
40
- }
41
- function douglasPeucker(px, epsilon) {
42
- const n = px.length;
43
- const keep = new Uint8Array(n);
44
- keep[0] = 1;
45
- keep[n - 1] = 1;
46
- const stack = [0, n - 1];
47
- while (stack.length > 0) {
48
- const end = stack.pop();
49
- const start = stack.pop();
50
- if (end - start < 2)
51
- continue;
52
- const a = px[start];
53
- const b = px[end];
54
- const mid = (start + end) / 2;
55
- let maxDist = -1;
56
- let maxIdx = -1;
57
- for (let i = start + 1; i < end; i++) {
58
- const d = distanceToSegment(px[i], a, b);
59
- if (d > maxDist ||
60
- (d === maxDist && Math.abs(i - mid) < Math.abs(maxIdx - mid))) {
61
- maxDist = d;
62
- maxIdx = i;
63
- }
64
- }
65
- if (maxDist > epsilon) {
66
- keep[maxIdx] = 1;
67
- stack.push(start, maxIdx, maxIdx, end);
68
- }
69
- }
70
- const indices = [];
71
- for (let i = 0; i < n; i++)
72
- if (keep[i])
73
- indices.push(i);
74
- return indices;
75
- }
76
- function distanceToSegment(p, a, b) {
77
- const dx = b.x - a.x;
78
- const dy = b.y - a.y;
79
- const lenSq = dx * dx + dy * dy;
80
- if (lenSq === 0)
81
- return Math.sqrt((p.x - a.x) ** 2 + (p.y - a.y) ** 2);
82
- const t = Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq));
83
- return Math.sqrt((p.x - (a.x + t * dx)) ** 2 + (p.y - (a.y + t * dy)) ** 2);
84
- }