@zwishing/emap 0.1.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/CHANGELOG.md +38 -0
- package/LICENSE +373 -0
- package/README.md +294 -0
- package/SECURITY.md +56 -0
- package/dist/adapter/mapshaper-adapter.d.ts +282 -0
- package/dist/core/drag-pan-handler.d.ts +28 -0
- package/dist/core/events.d.ts +16 -0
- package/dist/core/interactions.d.ts +20 -0
- package/dist/core/mapshaper-worker-pool.d.ts +151 -0
- package/dist/core/tween.d.ts +26 -0
- package/dist/edit/commands/composite.d.ts +16 -0
- package/dist/edit/commands/dataset-replace.d.ts +43 -0
- package/dist/edit/commands/feature-affine.d.ts +72 -0
- package/dist/edit/commands/feature-create.d.ts +47 -0
- package/dist/edit/commands/feature-delete.d.ts +72 -0
- package/dist/edit/commands/feature-property-change.d.ts +34 -0
- package/dist/edit/commands/feature-translate.d.ts +55 -0
- package/dist/edit/commands/field-add.d.ts +24 -0
- package/dist/edit/commands/field-remove.d.ts +20 -0
- package/dist/edit/commands/field-rename.d.ts +19 -0
- package/dist/edit/commands/split-shared-arcs.d.ts +71 -0
- package/dist/edit/commands/vertex-delete.d.ts +26 -0
- package/dist/edit/commands/vertex-insert.d.ts +26 -0
- package/dist/edit/commands/vertex-move.d.ts +45 -0
- package/dist/edit/edit-command.d.ts +72 -0
- package/dist/edit/edit-history.d.ts +130 -0
- package/dist/edit/transaction.d.ts +59 -0
- package/dist/emap-worker.js +1 -0
- package/dist/emap.css +157 -0
- package/dist/emap.js +5 -0
- package/dist/emap.mjs +5 -0
- package/dist/geo/bounds.d.ts +18 -0
- package/dist/geo/crs-resolver.d.ts +35 -0
- package/dist/geo/projection.d.ts +28 -0
- package/dist/geo/transform.d.ts +19 -0
- package/dist/geo/viewport.d.ts +52 -0
- package/dist/index.d.ts +86 -0
- package/dist/map/attribute-ops.d.ts +61 -0
- package/dist/map/command-args.d.ts +28 -0
- package/dist/map/edit-sessions.d.ts +97 -0
- package/dist/map/edit-state-store.d.ts +41 -0
- package/dist/map/emap-host.d.ts +79 -0
- package/dist/map/feature-accessor.d.ts +43 -0
- package/dist/map/feature-query.d.ts +58 -0
- package/dist/map/highlight-manager.d.ts +17 -0
- package/dist/map/layer-registry.d.ts +33 -0
- package/dist/map/layer.d.ts +29 -0
- package/dist/map/map.d.ts +386 -0
- package/dist/map/mapshaper-ops.d.ts +56 -0
- package/dist/map/op-result.d.ts +46 -0
- package/dist/map/ops/_context.d.ts +41 -0
- package/dist/map/ops/_runner.d.ts +55 -0
- package/dist/map/ops/affine.d.ts +4 -0
- package/dist/map/ops/buffer.d.ts +4 -0
- package/dist/map/ops/check-geometry.d.ts +4 -0
- package/dist/map/ops/clean.d.ts +4 -0
- package/dist/map/ops/clip-erase.d.ts +5 -0
- package/dist/map/ops/data-fill.d.ts +4 -0
- package/dist/map/ops/dissolve.d.ts +20 -0
- package/dist/map/ops/divide.d.ts +4 -0
- package/dist/map/ops/drop-layer.d.ts +4 -0
- package/dist/map/ops/each-filter.d.ts +5 -0
- package/dist/map/ops/explode.d.ts +4 -0
- package/dist/map/ops/filter-fields.d.ts +4 -0
- package/dist/map/ops/filter-geom.d.ts +4 -0
- package/dist/map/ops/filter-islands.d.ts +4 -0
- package/dist/map/ops/filter-slivers.d.ts +4 -0
- package/dist/map/ops/innerlines.d.ts +4 -0
- package/dist/map/ops/intersection-points.d.ts +4 -0
- package/dist/map/ops/join-table.d.ts +4 -0
- package/dist/map/ops/lines.d.ts +4 -0
- package/dist/map/ops/merge-layers.d.ts +4 -0
- package/dist/map/ops/mosaic.d.ts +4 -0
- package/dist/map/ops/points.d.ts +4 -0
- package/dist/map/ops/polygons.d.ts +4 -0
- package/dist/map/ops/project.d.ts +4 -0
- package/dist/map/ops/rebuild-topology.d.ts +4 -0
- package/dist/map/ops/rename-fields.d.ts +4 -0
- package/dist/map/ops/rename-layer.d.ts +4 -0
- package/dist/map/ops/simplify.d.ts +4 -0
- package/dist/map/ops/snap.d.ts +4 -0
- package/dist/map/ops/sort-features.d.ts +4 -0
- package/dist/map/ops/split-layer.d.ts +4 -0
- package/dist/map/ops/union.d.ts +4 -0
- package/dist/map/ops/unique-features.d.ts +4 -0
- package/dist/map/selection.d.ts +73 -0
- package/dist/map/types.d.ts +1072 -0
- package/dist/map/worker-routing.d.ts +40 -0
- package/dist/mapshaper-vendor.js +1 -0
- package/dist/renderer/canvas-painter.d.ts +50 -0
- package/dist/renderer/edit-overlay-renderer.d.ts +22 -0
- package/dist/renderer/painter.d.ts +52 -0
- package/dist/shim.d.ts +1 -0
- package/dist/source/display-arcs.d.ts +49 -0
- package/dist/source/layer-utils.d.ts +12 -0
- package/dist/source/mapshaper-runner.d.ts +22 -0
- package/dist/source/source.d.ts +80 -0
- package/dist/source/topology-source.d.ts +145 -0
- package/dist/types/mapshaper-types.d.ts +182 -0
- package/dist/ui/basemap-control.d.ts +35 -0
- package/dist/ui/box-select-control.d.ts +67 -0
- package/dist/ui/control.d.ts +6 -0
- package/dist/ui/draw-feature-control.d.ts +82 -0
- package/dist/ui/edit-toolbar.d.ts +27 -0
- package/dist/ui/history-control.d.ts +29 -0
- package/dist/ui/lasso-select-control.d.ts +96 -0
- package/dist/ui/navigation-control.d.ts +16 -0
- package/dist/ui/simplify-control.d.ts +40 -0
- package/dist/ui/status-control.d.ts +23 -0
- package/dist/ui/vertex-edit-control.d.ts +111 -0
- package/dist/validation/builtin/topology.d.ts +19 -0
- package/dist/validation/registry.d.ts +23 -0
- package/dist/validation/validator.d.ts +47 -0
- package/package.json +90 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type OpResult } from '../op-result';
|
|
2
|
+
import type { CheckGeometryOptions, GeometryCheckReport } from '../types';
|
|
3
|
+
import type { OpContext } from './_context';
|
|
4
|
+
export declare function checkGeometry(ctx: OpContext, opts: CheckGeometryOptions): Promise<OpResult<GeometryCheckReport>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type OpResult } from '../op-result';
|
|
2
|
+
import type { ClipEraseOptions } from '../types';
|
|
3
|
+
import type { OpContext } from './_context';
|
|
4
|
+
export declare function clipLayer(ctx: OpContext, opts: ClipEraseOptions): Promise<OpResult>;
|
|
5
|
+
export declare function eraseLayer(ctx: OpContext, opts: ClipEraseOptions): Promise<OpResult>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type OpResult } from '../op-result';
|
|
2
|
+
import type { DissolveOptions } from '../types';
|
|
3
|
+
import type { OpContext } from './_context';
|
|
4
|
+
export declare function dissolveLayer(ctx: OpContext, opts: DissolveOptions): Promise<OpResult>;
|
|
5
|
+
/**
|
|
6
|
+
* Merge the currently-selected features (when they all share the same
|
|
7
|
+
* source/layer) into one feature via the same `-dissolve` pipeline.
|
|
8
|
+
*
|
|
9
|
+
* Recipe:
|
|
10
|
+
* 1. Stamp a discriminator field directly onto records — selected rows
|
|
11
|
+
* get `'M'`, unselected rows get a unique `'k_<id>'` so they pass
|
|
12
|
+
* through dissolve unchanged.
|
|
13
|
+
* 2. Run `-dissolve __emap_merge copy-fields=<all original>`.
|
|
14
|
+
* 3. Drop the discriminator with `-filter-fields __emap_merge invert`.
|
|
15
|
+
*
|
|
16
|
+
* Direct record mutation (instead of an `-each EXPR` pre-pass that
|
|
17
|
+
* embedded `JSON.stringify(selectedIds)` to test membership) keeps the
|
|
18
|
+
* command string size O(1) regardless of selection cardinality.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeSelected(ctx: OpContext): Promise<OpResult>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type OpResult } from '../op-result';
|
|
2
|
+
import type { ApplyExpressionOptions, FilterOptions } from '../types';
|
|
3
|
+
import type { OpContext } from './_context';
|
|
4
|
+
export declare function applyExpression(ctx: OpContext, opts: ApplyExpressionOptions): Promise<OpResult>;
|
|
5
|
+
export declare function filterFeatures(ctx: OpContext, opts: FilterOptions): Promise<OpResult>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type OpResult } from '../op-result';
|
|
2
|
+
import type { IntersectionPointsLayerOptions } from '../types';
|
|
3
|
+
import type { OpContext } from './_context';
|
|
4
|
+
export declare function intersectionPointsLayer(ctx: OpContext, opts: IntersectionPointsLayerOptions): Promise<OpResult>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { FeatureRef } from './map';
|
|
2
|
+
/** Mutation modes for {@link Selection.apply}. */
|
|
3
|
+
export type SelectMode = 'replace' | 'add' | 'toggle';
|
|
4
|
+
/** Diff produced by every selection mutation. */
|
|
5
|
+
export interface SelectionDiff {
|
|
6
|
+
/** Refs newly present after the mutation */
|
|
7
|
+
added: FeatureRef[];
|
|
8
|
+
/** Refs newly absent after the mutation */
|
|
9
|
+
removed: FeatureRef[];
|
|
10
|
+
/** True when at least one of `added` / `removed` is non-empty */
|
|
11
|
+
changed: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Opaque snapshot returned by {@link Selection.snapshot} and consumed by
|
|
15
|
+
* {@link Selection.restore}. Implementation detail — do not depend on
|
|
16
|
+
* the concrete shape.
|
|
17
|
+
*/
|
|
18
|
+
export type SelectionSnapshot = ReadonlySet<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Persistent multi-source / multi-layer feature selection.
|
|
21
|
+
*
|
|
22
|
+
* Storage shape mirrors `HighlightManager`: `Map<source, Map<layer, Set<id>>>`.
|
|
23
|
+
* That gives O(1) `has` checks, O(1) iteration per layer for downstream
|
|
24
|
+
* operations, and free deduplication.
|
|
25
|
+
*
|
|
26
|
+
* Distinct from highlight on purpose: selection is persistent state ("what
|
|
27
|
+
* the next operation will act on"), highlight is transient render state
|
|
28
|
+
* ("what to draw extra strokes on right now").
|
|
29
|
+
*/
|
|
30
|
+
export declare class Selection {
|
|
31
|
+
private _byKey;
|
|
32
|
+
private _size;
|
|
33
|
+
/** Number of distinct selected features across all source/layer pairs. */
|
|
34
|
+
get size(): number;
|
|
35
|
+
/** Returns `true` when the given feature is currently in the selection. */
|
|
36
|
+
has(ref: FeatureRef): boolean;
|
|
37
|
+
/** Flat list of every selected ref, in insertion order within each layer. */
|
|
38
|
+
getAll(): FeatureRef[];
|
|
39
|
+
/** Numeric ids selected within a single source/layer, in insertion order. */
|
|
40
|
+
getByLayer(source: string, layer: string): number[];
|
|
41
|
+
/** Remove every entry. Returns the diff of refs that were actually cleared. */
|
|
42
|
+
clear(): SelectionDiff;
|
|
43
|
+
/**
|
|
44
|
+
* Mutate the set according to `mode`:
|
|
45
|
+
* - `replace`: result is exactly `refs` (clears prior state)
|
|
46
|
+
* - `add`: union of current state and `refs`
|
|
47
|
+
* - `toggle`: each ref is flipped (present → removed, absent → added)
|
|
48
|
+
*
|
|
49
|
+
* Returns a diff so the caller can fire events with `{ added, removed }`.
|
|
50
|
+
*/
|
|
51
|
+
apply(refs: ReadonlyArray<FeatureRef>, mode: SelectMode): SelectionDiff;
|
|
52
|
+
/** Remove the listed refs. Refs not present in the selection are skipped silently. */
|
|
53
|
+
remove(refs: ReadonlyArray<FeatureRef>): SelectionDiff;
|
|
54
|
+
/**
|
|
55
|
+
* Capture the current selection as an opaque snapshot. The returned
|
|
56
|
+
* value is meant to be handed back to {@link restore} later — its
|
|
57
|
+
* shape (currently `Set<string>` of encoded refs) is an implementation
|
|
58
|
+
* detail and may change.
|
|
59
|
+
*
|
|
60
|
+
* Used by `Transaction` for rollback so a transaction-internal
|
|
61
|
+
* operation that clears the selection can be reverted.
|
|
62
|
+
*/
|
|
63
|
+
snapshot(): SelectionSnapshot;
|
|
64
|
+
/**
|
|
65
|
+
* Replace the current selection with the contents of a previously
|
|
66
|
+
* captured snapshot. Returns the diff between the old state and the
|
|
67
|
+
* restored state so callers can fire a single `selectionchange` event.
|
|
68
|
+
*/
|
|
69
|
+
restore(snap: SelectionSnapshot): SelectionDiff;
|
|
70
|
+
private _addOne;
|
|
71
|
+
private _removeOne;
|
|
72
|
+
private _refSetSnapshot;
|
|
73
|
+
}
|