@vectoriahq/quac 0.12.0 → 0.14.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/generate/normalizedProject.d.ts +14 -0
- package/dist/generate/normalizedProject.js +17 -0
- package/dist/generate/serverLayerTree.d.ts +4 -3
- package/dist/generate/serverLayerTree.js +9 -7
- package/dist/generate/serverStacCatalogue.d.ts +2 -1
- package/dist/generate/serverStacCatalogue.js +3 -3
- package/dist/generate/stacCatalogue.d.ts +12 -0
- package/dist/generate/stacCatalogue.js +49 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/model/QgsProject.d.ts +6 -0
- package/dist/parse/parseLayers.js +26 -6
- package/package.json +1 -1
- package/src/schema/quac.schema.json +5 -0
|
@@ -53,6 +53,11 @@ export declare const QUAC_LEGEND_IMAGE_FIELD = "quac:legend_image";
|
|
|
53
53
|
* address, the same form as a column's `quac:icon`.
|
|
54
54
|
*/
|
|
55
55
|
export declare const QUAC_ICON_FIELD = "quac:icon";
|
|
56
|
+
/**
|
|
57
|
+
* The key a Collection takes for the message shown once a feature is added to
|
|
58
|
+
* it: text that may hold HTML markup.
|
|
59
|
+
*/
|
|
60
|
+
export declare const QUAC_ADDED_MESSAGE_FIELD = "quac:added_message";
|
|
56
61
|
/**
|
|
57
62
|
* The key a Collection takes for the area and distance units its source gives
|
|
58
63
|
* `$area`, `$length` and `$perimeter` in: `{ area_unit, distance_unit }`, each
|
|
@@ -208,6 +213,8 @@ export interface NormalizedLayer {
|
|
|
208
213
|
legendImage?: string | null;
|
|
209
214
|
/** Emitted as `quac:icon`: the `https://` address of the icon drawn beside the layer's name. */
|
|
210
215
|
icon?: string | null;
|
|
216
|
+
/** Emitted as `quac:added_message`: the message shown once a feature is added, as the source wrote it. */
|
|
217
|
+
addedMessage?: string | null;
|
|
211
218
|
/** Emitted as `quac:locks` where it locks an edit. */
|
|
212
219
|
locks?: LayerLocks;
|
|
213
220
|
/** Emitted as `quac:filters` where the source sets one up. */
|
|
@@ -344,6 +351,13 @@ export declare function readCollectionMeasurement(collection: StacCollection | n
|
|
|
344
351
|
export declare function readCollectionLegendImage(collection: StacCollection | null | undefined): string | null;
|
|
345
352
|
/** The icon drawn beside a Collection's name (`quac:icon`), or null where it names no `https://` address. */
|
|
346
353
|
export declare function readCollectionIcon(collection: StacCollection | null | undefined): string | null;
|
|
354
|
+
/**
|
|
355
|
+
* The message shown once a feature is added to a Collection
|
|
356
|
+
* (`quac:added_message`), as the source wrote it, or null where it names none.
|
|
357
|
+
* It may hold HTML markup, which the application shows only as far as it
|
|
358
|
+
* judges safe.
|
|
359
|
+
*/
|
|
360
|
+
export declare function readCollectionAddedMessage(collection: StacCollection | null | undefined): string | null;
|
|
347
361
|
/**
|
|
348
362
|
* Reads `quac:locks` back off a Collection: the edits it locks, each `true` or
|
|
349
363
|
* `{ expression }`. A member that is neither, or an expression that is blank,
|
|
@@ -57,6 +57,11 @@ export const QUAC_LEGEND_IMAGE_FIELD = 'quac:legend_image';
|
|
|
57
57
|
* address, the same form as a column's `quac:icon`.
|
|
58
58
|
*/
|
|
59
59
|
export const QUAC_ICON_FIELD = 'quac:icon';
|
|
60
|
+
/**
|
|
61
|
+
* The key a Collection takes for the message shown once a feature is added to
|
|
62
|
+
* it: text that may hold HTML markup.
|
|
63
|
+
*/
|
|
64
|
+
export const QUAC_ADDED_MESSAGE_FIELD = 'quac:added_message';
|
|
60
65
|
/**
|
|
61
66
|
* The key a Collection takes for the area and distance units its source gives
|
|
62
67
|
* `$area`, `$length` and `$perimeter` in: `{ area_unit, distance_unit }`, each
|
|
@@ -265,6 +270,8 @@ function buildCollection(layer, defaultProviders, folder) {
|
|
|
265
270
|
collection[QUAC_LEGEND_IMAGE_FIELD] = layer.legendImage;
|
|
266
271
|
if (layer.icon)
|
|
267
272
|
collection[QUAC_ICON_FIELD] = layer.icon;
|
|
273
|
+
if (layer.addedMessage)
|
|
274
|
+
collection[QUAC_ADDED_MESSAGE_FIELD] = layer.addedMessage;
|
|
268
275
|
if (layer.formOrder)
|
|
269
276
|
collection[QUAC_FORM_ORDER_FIELD] = layer.formOrder;
|
|
270
277
|
// Source-declaring vendor fields (`quac:wfs_*`), copied verbatim so a consumer reads the source structurally rather than by
|
|
@@ -509,6 +516,16 @@ export function readCollectionLegendImage(collection) {
|
|
|
509
516
|
export function readCollectionIcon(collection) {
|
|
510
517
|
return readHttpsAddress(collection?.[QUAC_ICON_FIELD]);
|
|
511
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* The message shown once a feature is added to a Collection
|
|
521
|
+
* (`quac:added_message`), as the source wrote it, or null where it names none.
|
|
522
|
+
* It may hold HTML markup, which the application shows only as far as it
|
|
523
|
+
* judges safe.
|
|
524
|
+
*/
|
|
525
|
+
export function readCollectionAddedMessage(collection) {
|
|
526
|
+
const message = collection?.[QUAC_ADDED_MESSAGE_FIELD];
|
|
527
|
+
return typeof message === 'string' && message.trim() !== '' ? message : null;
|
|
528
|
+
}
|
|
512
529
|
const LOCKED_EDITS = ['add', 'attributes', 'geometry', 'delete'];
|
|
513
530
|
/**
|
|
514
531
|
* Reads `quac:locks` back off a Collection: the edits it locks, each `true` or
|
|
@@ -35,9 +35,10 @@ export interface ServerLayerTreeLayer {
|
|
|
35
35
|
* what the QUAC plugin's reading spike returns in Python, so that the two
|
|
36
36
|
* languages are compared on the fixtures.
|
|
37
37
|
*
|
|
38
|
-
* A layer's names are `qgisServerNamesOf`'s, except that a layer
|
|
39
|
-
*
|
|
40
|
-
* the project does not
|
|
38
|
+
* A layer's names are `qgisServerNamesOf`'s, except that a layer the project
|
|
39
|
+
* leaves out of WMS (`wmsExcludedLayerIds`), such as one inside a group it
|
|
40
|
+
* leaves out, has no WMS name. A tree entry whose layer the project does not
|
|
41
|
+
* hold is left out.
|
|
41
42
|
*/
|
|
42
43
|
export declare function serverLayerTree(project: QgsProject): ServerLayerTree;
|
|
43
44
|
/** The ids of the layers the project publishes over WMS. */
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { qgisServerNamesOf } from "./stacCatalogue.js";
|
|
1
|
+
import { qgisServerNamesOf, wmsExcludedLayerIds } from "./stacCatalogue.js";
|
|
2
2
|
/**
|
|
3
3
|
* The layer tree QGIS Server reads from a project: each layer's WMS name and
|
|
4
4
|
* WFS type name, and the fields the project hides from each service. It is
|
|
5
5
|
* what the QUAC plugin's reading spike returns in Python, so that the two
|
|
6
6
|
* languages are compared on the fixtures.
|
|
7
7
|
*
|
|
8
|
-
* A layer's names are `qgisServerNamesOf`'s, except that a layer
|
|
9
|
-
*
|
|
10
|
-
* the project does not
|
|
8
|
+
* A layer's names are `qgisServerNamesOf`'s, except that a layer the project
|
|
9
|
+
* leaves out of WMS (`wmsExcludedLayerIds`), such as one inside a group it
|
|
10
|
+
* leaves out, has no WMS name. A tree entry whose layer the project does not
|
|
11
|
+
* hold is left out.
|
|
11
12
|
*/
|
|
12
13
|
export function serverLayerTree(project) {
|
|
13
14
|
const layersById = new Map(project.layers.map((layer) => [layer.id, layer]));
|
|
14
15
|
const restricted = new Set(project.wmsPublishing?.restrictedLayers ?? []);
|
|
16
|
+
const excluded = wmsExcludedLayerIds(project);
|
|
15
17
|
const context = { wmsPublishing: project.wmsPublishing ?? null, wfsTransactionLayers: project.wfsTransactionLayers ?? null };
|
|
16
18
|
const readGroup = (group, wmsPublished) => group.children.flatMap((node) => {
|
|
17
19
|
if (node.kind === 'group') {
|
|
@@ -19,17 +21,17 @@ export function serverLayerTree(project) {
|
|
|
19
21
|
return [{ kind: 'group', name: node.name, wmsPublished: published, children: readGroup(node, published) }];
|
|
20
22
|
}
|
|
21
23
|
const layer = layersById.get(node.layerId);
|
|
22
|
-
return layer ? [serverLayer(layer,
|
|
24
|
+
return layer ? [serverLayer(layer, !excluded.has(layer.id), context)] : [];
|
|
23
25
|
});
|
|
24
26
|
return { useLayerIds: project.wmsPublishing?.useLayerIds ?? false, children: readGroup(project.layerTree, true) };
|
|
25
27
|
}
|
|
26
|
-
function serverLayer(layer,
|
|
28
|
+
function serverLayer(layer, wmsPublished, context) {
|
|
27
29
|
const names = qgisServerNamesOf(layer, context);
|
|
28
30
|
return {
|
|
29
31
|
kind: 'layer',
|
|
30
32
|
id: layer.id,
|
|
31
33
|
name: layer.name,
|
|
32
|
-
wmsName:
|
|
34
|
+
wmsName: wmsPublished ? names.wmsName : null,
|
|
33
35
|
wfsTypeName: names.wfsTypeName,
|
|
34
36
|
hiddenFields: { wms: layer.serverHiddenFields?.wms ?? [], wfs: layer.serverHiddenFields?.wfs ?? [] }
|
|
35
37
|
};
|
|
@@ -10,7 +10,8 @@ import type { StacCatalog, StacCollection } from '../model/Stac.ts';
|
|
|
10
10
|
* does:
|
|
11
11
|
*
|
|
12
12
|
* - A layer or group whose name the project leaves out of WMS
|
|
13
|
-
* (`WMSRestrictedLayers`) is left out, with every layer inside the group
|
|
13
|
+
* (`WMSRestrictedLayers`) is left out, with every layer inside the group, as
|
|
14
|
+
* `generateStacCatalogue` already leaves it out. A
|
|
14
15
|
* layer published for WFS but left out of WMS is left out too, because a
|
|
15
16
|
* server's Collection id is the WMS name (D1). A file the project splits into
|
|
16
17
|
* a layer per shape is left out: the project route writes it as one
|
|
@@ -17,7 +17,8 @@ import { chooseWmsCrs, WEB_MAP_LINKS_EXTENSION, WMS_REQUEST_PARAMETERS } from ".
|
|
|
17
17
|
* does:
|
|
18
18
|
*
|
|
19
19
|
* - A layer or group whose name the project leaves out of WMS
|
|
20
|
-
* (`WMSRestrictedLayers`) is left out, with every layer inside the group
|
|
20
|
+
* (`WMSRestrictedLayers`) is left out, with every layer inside the group, as
|
|
21
|
+
* `generateStacCatalogue` already leaves it out. A
|
|
21
22
|
* layer published for WFS but left out of WMS is left out too, because a
|
|
22
23
|
* server's Collection id is the WMS name (D1). A file the project splits into
|
|
23
24
|
* a layer per shape is left out: the project route writes it as one
|
|
@@ -60,7 +61,6 @@ export function generateServerStacCatalogue(project, options) {
|
|
|
60
61
|
const layerWgs84Extents = options.layerWgs84Extents ?? {};
|
|
61
62
|
const catalogue = generateStacCatalogue(project, [], { layerWgs84Extents: new Map(Object.entries(layerWgs84Extents)) });
|
|
62
63
|
const layersById = new Map(project.layers.map((layer) => [layer.id, layer]));
|
|
63
|
-
const restricted = new Set(project.wmsPublishing?.restrictedLayers ?? []);
|
|
64
64
|
const servedLayerIds = wmsPublishedLayerIds(serverLayerTree(project));
|
|
65
65
|
const wfsPublished = new Set(project.wfsTransactionLayers?.published ?? []);
|
|
66
66
|
const servedIds = new Map();
|
|
@@ -85,7 +85,7 @@ export function generateServerStacCatalogue(project, options) {
|
|
|
85
85
|
};
|
|
86
86
|
const serveCatalog = (node) => {
|
|
87
87
|
const collections = (node.collections ?? []).filter((collection) => servedIds.has(collection.id)).map((collection) => serveCollection(collection, context));
|
|
88
|
-
const catalogs = (node.catalogs ?? []).
|
|
88
|
+
const catalogs = (node.catalogs ?? []).map(serveCatalog);
|
|
89
89
|
const served = { ...node, links: [...node.links.filter((link) => link.rel !== 'child'), ...childLinks(catalogueFolder(node) ?? './', collections, catalogs)] };
|
|
90
90
|
delete served.collections;
|
|
91
91
|
delete served.catalogs;
|
|
@@ -29,6 +29,11 @@ export interface StacCompanionData {
|
|
|
29
29
|
* This is a thin wrapper: `qgsProjectToNormalized` resolves the QGS-specific
|
|
30
30
|
* wording, assets and columns into the shared `NormalizedProject`, and
|
|
31
31
|
* `generateStacFromNormalized` (see normalizedProject.ts) builds the catalogue.
|
|
32
|
+
*
|
|
33
|
+
* A layer or group the project leaves out of WMS (**Exclude layers**) is left
|
|
34
|
+
* out, as `generateServerStacCatalogue` leaves it out: the catalogue is built
|
|
35
|
+
* as if the project did not hold it, so a relation, Value Relation, filter or
|
|
36
|
+
* initial active layer naming it is dropped too (`wmsExcludedLayerIds`).
|
|
32
37
|
*/
|
|
33
38
|
export declare function generateStacCatalogue(project: QgsProject, companions?: StacCompanionData[], options?: {
|
|
34
39
|
selfHref?: string;
|
|
@@ -75,6 +80,13 @@ export declare function qgisServerNamesOf(layer: LayerEntry, context: {
|
|
|
75
80
|
wmsPublishing: WmsPublishing | null;
|
|
76
81
|
wfsTransactionLayers: WfsTransactionLayers | null;
|
|
77
82
|
}): QgisServerNames;
|
|
83
|
+
/**
|
|
84
|
+
* The layers a project leaves out of WMS under **Exclude layers**
|
|
85
|
+
* (`WMSRestrictedLayers`): each layer whose name it lists, wherever the layer
|
|
86
|
+
* sits, and every layer inside a group whose name it lists. Neither route's
|
|
87
|
+
* catalogue holds them.
|
|
88
|
+
*/
|
|
89
|
+
export declare function wmsExcludedLayerIds(project: QgsProject): Set<string>;
|
|
78
90
|
/** The title of the `via` link to the QGIS project a layer's Collection was written from. */
|
|
79
91
|
export declare const QGIS_PROJECT_LINK_TITLE = "QGIS project";
|
|
80
92
|
/**
|
|
@@ -30,6 +30,11 @@ import { declaredMediaTypeForFile, isLayerFileOfFormat, PROJECT_DATA_ROLES, QML_
|
|
|
30
30
|
* This is a thin wrapper: `qgsProjectToNormalized` resolves the QGS-specific
|
|
31
31
|
* wording, assets and columns into the shared `NormalizedProject`, and
|
|
32
32
|
* `generateStacFromNormalized` (see normalizedProject.ts) builds the catalogue.
|
|
33
|
+
*
|
|
34
|
+
* A layer or group the project leaves out of WMS (**Exclude layers**) is left
|
|
35
|
+
* out, as `generateServerStacCatalogue` leaves it out: the catalogue is built
|
|
36
|
+
* as if the project did not hold it, so a relation, Value Relation, filter or
|
|
37
|
+
* initial active layer naming it is dropped too (`wmsExcludedLayerIds`).
|
|
33
38
|
*/
|
|
34
39
|
export function generateStacCatalogue(project, companions = [], options = {}) {
|
|
35
40
|
// `selfHref` is the folder the project was published from, for a project
|
|
@@ -59,7 +64,7 @@ export function generateStacCatalogue(project, companions = [], options = {}) {
|
|
|
59
64
|
// reproject the canvas. `resolveLayerWgs84Extents` in the same file builds
|
|
60
65
|
// this map; a layer left out of it (or a caller that leaves the option off
|
|
61
66
|
// entirely) has no box of its own.
|
|
62
|
-
return withSelfLink(generateStacFromNormalized(qgsProjectToNormalized(project, companions, options.projectPath, options.projectPath ?? options.projectFileName, options.initialView ?? null, options.layerWgs84Extents)), options.selfHref);
|
|
67
|
+
return withSelfLink(generateStacFromNormalized(qgsProjectToNormalized(withoutWmsExcludedLayers(project), companions, options.projectPath, options.projectPath ?? options.projectFileName, options.initialView ?? null, options.layerWgs84Extents)), options.selfHref);
|
|
63
68
|
}
|
|
64
69
|
/**
|
|
65
70
|
* The key a style asset takes for the field its renderer classifies by, when
|
|
@@ -333,6 +338,48 @@ export function qgisServerNamesOf(layer, context) {
|
|
|
333
338
|
const wfsTypeName = wfsPublished ? ownName.replace(/ /g, '_').replace(/[:\u2014]/g, '-') : null;
|
|
334
339
|
return { wmsName: wmsName || null, wfsTypeName: wfsTypeName || null };
|
|
335
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* The layers a project leaves out of WMS under **Exclude layers**
|
|
343
|
+
* (`WMSRestrictedLayers`): each layer whose name it lists, wherever the layer
|
|
344
|
+
* sits, and every layer inside a group whose name it lists. Neither route's
|
|
345
|
+
* catalogue holds them.
|
|
346
|
+
*/
|
|
347
|
+
export function wmsExcludedLayerIds(project) {
|
|
348
|
+
const restricted = new Set(project.wmsPublishing?.restrictedLayers ?? []);
|
|
349
|
+
const excluded = new Set();
|
|
350
|
+
if (restricted.size === 0)
|
|
351
|
+
return excluded;
|
|
352
|
+
for (const layer of project.layers) {
|
|
353
|
+
if (restricted.has(layer.name))
|
|
354
|
+
excluded.add(layer.id);
|
|
355
|
+
}
|
|
356
|
+
const walk = (group, inExcludedGroup) => {
|
|
357
|
+
for (const node of group.children) {
|
|
358
|
+
if (node.kind === 'group')
|
|
359
|
+
walk(node, inExcludedGroup || restricted.has(node.name));
|
|
360
|
+
else if (inExcludedGroup)
|
|
361
|
+
excluded.add(node.layerId);
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
walk(project.layerTree, false);
|
|
365
|
+
return excluded;
|
|
366
|
+
}
|
|
367
|
+
/** The project less the layers and groups it leaves out of WMS (`wmsExcludedLayerIds`). */
|
|
368
|
+
function withoutWmsExcludedLayers(project) {
|
|
369
|
+
const excluded = wmsExcludedLayerIds(project);
|
|
370
|
+
if (excluded.size === 0)
|
|
371
|
+
return project;
|
|
372
|
+
const restricted = new Set(project.wmsPublishing?.restrictedLayers ?? []);
|
|
373
|
+
const prune = (group) => ({
|
|
374
|
+
...group,
|
|
375
|
+
children: group.children.flatMap((node) => {
|
|
376
|
+
if (node.kind === 'group')
|
|
377
|
+
return restricted.has(node.name) ? [] : [prune(node)];
|
|
378
|
+
return excluded.has(node.layerId) ? [] : [node];
|
|
379
|
+
})
|
|
380
|
+
});
|
|
381
|
+
return { ...project, layers: project.layers.filter((layer) => !excluded.has(layer.id)), layerTree: prune(project.layerTree) };
|
|
382
|
+
}
|
|
336
383
|
/** The shape a file layer's own `|geometrytype=` keeps, as the list `quac:geometry_filter` holds. */
|
|
337
384
|
function geometryFilterOf(layer) {
|
|
338
385
|
const shapes = readSiblingShapes([layer]);
|
|
@@ -377,6 +424,7 @@ function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(
|
|
|
377
424
|
isPrivate: layer.isPrivate,
|
|
378
425
|
legendImage: layer.legendImage,
|
|
379
426
|
icon: layer.icon,
|
|
427
|
+
addedMessage: layer.addedMessage,
|
|
380
428
|
locks: combineLocks(layer.locks ?? {}, wfsTransactionLocks(layer.id, context.wfsTransactionLayers)),
|
|
381
429
|
filters: context.filtersByCollectionId.get(layer.id),
|
|
382
430
|
vendorFields: buildVendorFields(layer, context.measurement),
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionR
|
|
|
34
34
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from './model/stacPmtiles.ts';
|
|
35
35
|
export type { StacPmtilesSource } from './model/stacPmtiles.ts';
|
|
36
36
|
export type { StacCompanionData } from './generate/stacCatalogue.ts';
|
|
37
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
37
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
38
38
|
export type { CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
|
|
39
39
|
export { generateStacCatalogueFromWfsCapabilities } from './generate/wfsStacCatalogue.ts';
|
|
40
40
|
export type { WfsStacCatalogueOptions } from './generate/wfsStacCatalogue.ts';
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export { DATA_ROLE, findAssetByRole, readDataAsset } from "./model/stacAssetRole
|
|
|
23
23
|
export { THUMBNAIL_ROLE, readCollectionAttribution, readCollectionDeprecation, readCollectionSelfHref, readCollectionThumbnail } from "./model/stacCollectionNotes.js";
|
|
24
24
|
export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionRowCount, readDataAssetFileSize } from "./model/stacSizeAndCount.js";
|
|
25
25
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from "./model/stacPmtiles.js";
|
|
26
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
26
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
27
27
|
export { generateStacCatalogueFromWfsCapabilities } from "./generate/wfsStacCatalogue.js";
|
|
28
28
|
export { generateStacCatalogueFromFolder } from "./generate/folderStacCatalogue.js";
|
|
29
29
|
export { generateCollectionForDroppedFile, generateCollectionForLinkedFile } from "./generate/fileLayerCollection.js";
|
|
@@ -289,6 +289,12 @@ export interface LayerEntry {
|
|
|
289
289
|
* or absent where it sets none.
|
|
290
290
|
*/
|
|
291
291
|
icon?: string | null;
|
|
292
|
+
/**
|
|
293
|
+
* The message shown once a feature is added to the layer, from its
|
|
294
|
+
* `quac_added_message` variable, as written. Null or absent where it sets
|
|
295
|
+
* none.
|
|
296
|
+
*/
|
|
297
|
+
addedMessage?: string | null;
|
|
292
298
|
/**
|
|
293
299
|
* The address of each field's icon, from the layer's `quac_icon_<field>`
|
|
294
300
|
* variables. Fields with none are absent.
|
|
@@ -117,6 +117,7 @@ function parseMapLayer(maplayer, notes) {
|
|
|
117
117
|
fieldAttachments,
|
|
118
118
|
fieldEditRules: parseFieldEditRules(maplayer, note),
|
|
119
119
|
icon: parseLayerIcon(maplayer),
|
|
120
|
+
addedMessage: parseAddedMessage(maplayer),
|
|
120
121
|
fieldIcons: parseFieldIcons(maplayer),
|
|
121
122
|
fieldControls: parseFieldControls(maplayer),
|
|
122
123
|
formLayout: parseFormLayout(maplayer),
|
|
@@ -991,19 +992,38 @@ function parseFieldIcons(maplayer) {
|
|
|
991
992
|
}
|
|
992
993
|
/** The name of the layer variable that sets the layer's own icon. */
|
|
993
994
|
const LAYER_ICON_VARIABLE = 'quac_icon';
|
|
995
|
+
/** The name of the layer variable that holds the message shown once a feature is added. */
|
|
996
|
+
const ADDED_MESSAGE_VARIABLE = 'quac_added_message';
|
|
994
997
|
/**
|
|
995
|
-
*
|
|
996
|
-
*
|
|
997
|
-
*
|
|
998
|
+
* The value of the layer variable of this name, held in the layer's
|
|
999
|
+
* `variableNames` and `variableValues` custom properties. Null where the layer
|
|
1000
|
+
* has no such variable.
|
|
998
1001
|
*/
|
|
999
|
-
function
|
|
1002
|
+
function readLayerVariable(maplayer, variable) {
|
|
1000
1003
|
const properties = directChild(maplayer, 'customproperties');
|
|
1001
1004
|
if (!properties)
|
|
1002
1005
|
return null;
|
|
1003
1006
|
const names = readCustomPropertyList(properties, 'variableNames');
|
|
1004
1007
|
const values = readCustomPropertyList(properties, 'variableValues');
|
|
1005
|
-
const index = names.indexOf(
|
|
1006
|
-
return index === -1 || index >= values.length ? null :
|
|
1008
|
+
const index = names.indexOf(variable);
|
|
1009
|
+
return index === -1 || index >= values.length ? null : values[index];
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Reads the icon the layer's `quac_icon` variable sets, as an address
|
|
1013
|
+
* (`resolveFieldIconAddress`). Null where the layer has no such variable or
|
|
1014
|
+
* its value names no icon.
|
|
1015
|
+
*/
|
|
1016
|
+
function parseLayerIcon(maplayer) {
|
|
1017
|
+
const value = readLayerVariable(maplayer, LAYER_ICON_VARIABLE);
|
|
1018
|
+
return value === null ? null : resolveFieldIconAddress(value);
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Reads the message the layer's `quac_added_message` variable holds, as
|
|
1022
|
+
* written. Null where the layer has no such variable or its value is blank.
|
|
1023
|
+
*/
|
|
1024
|
+
function parseAddedMessage(maplayer) {
|
|
1025
|
+
const value = readLayerVariable(maplayer, ADDED_MESSAGE_VARIABLE);
|
|
1026
|
+
return value === null || value.trim() === '' ? null : value;
|
|
1007
1027
|
}
|
|
1008
1028
|
/** The start of the name of a layer variable that chooses a field's control: `quac_control_condition`. */
|
|
1009
1029
|
const FIELD_CONTROL_VARIABLE_PREFIX = 'quac_control_';
|
package/package.json
CHANGED
|
@@ -253,6 +253,11 @@
|
|
|
253
253
|
"type": "string",
|
|
254
254
|
"pattern": "^https://"
|
|
255
255
|
},
|
|
256
|
+
"quac:added_message": {
|
|
257
|
+
"description": "The message shown once a feature is added to this Collection, which may hold HTML markup. Written from the layer variable named quac_added_message.",
|
|
258
|
+
"type": "string",
|
|
259
|
+
"minLength": 1
|
|
260
|
+
},
|
|
256
261
|
"quac:form_order": {
|
|
257
262
|
"description": "The names of the fields the source's form layout places, in its order. A column not listed is left out of the form. Written from a QGIS layer's Drag and Drop Designer form.",
|
|
258
263
|
"type": "array",
|