drone-path 0.13.0 → 1.0.0-rc1
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 +20 -74
- package/THIRD-PARTY-NOTICES.md +3 -82
- package/bin/drone-path.mjs +0 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +7 -7
- package/dist/version.d.ts +1 -0
- package/package.json +21 -68
- package/CHANGELOG.md +0 -349
- package/app/ipc.d.mts +0 -44
- package/app/ipc.mjs +0 -237
- package/app/main.mjs +0 -369
- package/app/preload.cjs +0 -36
- package/app/update-policy.d.mts +0 -6
- package/app/update-policy.mjs +0 -6
- package/app/update.d.mts +0 -10
- package/app/update.mjs +0 -54
- package/dist/appassets.js +0 -35
- package/dist/apppaths.js +0 -20
- package/dist/appsession.js +0 -121
- package/dist/appstate.js +0 -101
- package/dist/assets.js +0 -60
- package/dist/buildinfo.js +0 -64
- package/dist/cammeta-decode.js +0 -237
- package/dist/cammeta.js +0 -92
- package/dist/changeset-gate.js +0 -39
- package/dist/config.js +0 -631
- package/dist/configfile.js +0 -86
- package/dist/decimate.js +0 -84
- package/dist/desktop-i18n/generated/catalogs.js +0 -1230
- package/dist/desktop-i18n/messages.js +0 -47
- package/dist/errors.js +0 -34
- package/dist/exec-tool.js +0 -13
- package/dist/exportjob.js +0 -90
- package/dist/ffmpeg-tools.js +0 -56
- package/dist/ffmpeg.js +0 -98
- package/dist/frametime.js +0 -32
- package/dist/geo.js +0 -60
- package/dist/logging.js +0 -1
- package/dist/manual/anchors.js +0 -17
- package/dist/manual/build.js +0 -67
- package/dist/manual/cliref.js +0 -34
- package/dist/manual/links.js +0 -59
- package/dist/manual/markdown.js +0 -98
- package/dist/manual/model.js +0 -1
- package/dist/manual/module.js +0 -5
- package/dist/manual/nav.js +0 -11
- package/dist/manual/reference.js +0 -18
- package/dist/paths.js +0 -16
- package/dist/pipeline.js +0 -402
- package/dist/plan.js +0 -106
- package/dist/png.js +0 -32
- package/dist/protobuf-wire.js +0 -102
- package/dist/range.js +0 -50
- package/dist/recordings.js +0 -55
- package/dist/render-page.js +0 -85
- package/dist/render.js +0 -268
- package/dist/renderer/boot.js +0 -7
- package/dist/renderer/dom.js +0 -179
- package/dist/renderer/framemath.js +0 -30
- package/dist/renderer/scene.js +0 -388
- package/dist/renderer/theme.js +0 -82
- package/dist/renderer/tilesources.js +0 -38
- package/dist/renderer/trail.js +0 -42
- package/dist/restyle.js +0 -16
- package/dist/serve.js +0 -27
- package/dist/srt.js +0 -98
- package/dist/telemetry-json-schema.js +0 -18
- package/dist/telemetry-json.js +0 -126
- package/dist/telemetry-math.js +0 -267
- package/dist/telemetry-summary.js +0 -19
- package/dist/telemetry.js +0 -95
- package/dist/tilecache.js +0 -21
- package/dist/tiles.js +0 -155
- package/dist/track-format.js +0 -13
- package/dist/track-geojson.js +0 -44
- package/dist/track-gpx.js +0 -34
- package/dist/track-kml.js +0 -47
- package/dist/track-kmz.js +0 -68
- package/dist/track-write.js +0 -41
- package/dist/track.js +0 -79
package/dist/configfile.js
DELETED
|
@@ -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
|
-
}
|