@vectoriahq/quac 0.22.0 → 0.24.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 +92 -1
- package/dist/generate/normalizedProject.js +131 -3
- package/dist/generate/serverStacCatalogue.d.ts +7 -2
- package/dist/generate/serverStacCatalogue.js +31 -7
- package/dist/generate/splitCatalogue.d.ts +8 -0
- package/dist/generate/splitCatalogue.js +1 -1
- package/dist/generate/stacCatalogue.d.ts +43 -2
- package/dist/generate/stacCatalogue.js +235 -33
- package/dist/generate/validateNewFeature.d.ts +13 -6
- package/dist/generate/validateNewFeature.js +29 -4
- package/dist/index.d.ts +6 -5
- package/dist/index.js +2 -2
- package/dist/model/QgsProject.d.ts +27 -0
- package/dist/model/Stac.d.ts +21 -0
- package/dist/model/stacStyles.d.ts +18 -1
- package/dist/model/stacStyles.js +43 -8
- package/dist/parse/parseBrandColour.d.ts +19 -2
- package/dist/parse/parseBrandColour.js +92 -2
- package/dist/parse/parseLayers.js +10 -2
- package/dist/parse/parsePrintLayouts.d.ts +7 -0
- package/dist/parse/parsePrintLayouts.js +14 -7
- package/dist/parse/parseStyle.js +50 -2
- package/package.json +1 -1
- package/src/schema/quac.schema.json +79 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arcgisQueryAsset } from "./arcgisStacCatalogue.js";
|
|
2
|
-
import { QUAC_MEASUREMENT_FIELD, QUAC_PRINT_LAYOUTS_FIELD, slugify, generateStacFromNormalized, unionBboxes, withSelfLink } from "./normalizedProject.js";
|
|
2
|
+
import { QUAC_BRAND_COLOR_FIELD, QUAC_THEME_FIELD, QUAC_MEASUREMENT_FIELD, QUAC_LOGO_LEFT_OUT_FIELD, QUAC_PRINT_LAYOUTS_FIELD, slugify, generateStacFromNormalized, unionBboxes, withSelfLink } from "./normalizedProject.js";
|
|
3
3
|
import { wfsGetFeatureAsset } from "./wfsStacCatalogue.js";
|
|
4
4
|
import { delimitedTextField, QUAC_DELIMITED_TEXT } from "../model/delimitedText.js";
|
|
5
5
|
import { featureFilterField, QUAC_FEATURE_FILTER } from "../model/featureFilter.js";
|
|
@@ -10,6 +10,8 @@ import { DEFAULT_STYLE_ROLE, styleAssetKey } from "../model/stacStyles.js";
|
|
|
10
10
|
import { buildWmsLink, WEB_MAP_LINKS_EXTENSION } from "../model/stacWms.js";
|
|
11
11
|
import { buildWmtsLink } from "../model/stacWmts.js";
|
|
12
12
|
import { buildXyzLink } from "../model/stacXyz.js";
|
|
13
|
+
import { brandColorOf } from "../parse/parseBrandColour.js";
|
|
14
|
+
import { safeName } from "./splitCatalogue.js";
|
|
13
15
|
import { findGeometrySiblings, readSiblingShapes, siblingCollectionId } from "../parse/geometrySiblings.js";
|
|
14
16
|
import { findValueRelationLookup, isFilterInProject, isRelationInProject } from "../parse/projectNotes.js";
|
|
15
17
|
import { declaredMediaTypeForFile, isLayerFileOfFormat, PROJECT_DATA_ROLES, QML_STYLE_MEDIA_TYPE } from "../util/catalogueFileFormats.js";
|
|
@@ -38,6 +40,30 @@ import { nameRecord } from "../util/nameRecord.js";
|
|
|
38
40
|
* initial active layer naming it is dropped too (`wmsExcludedLayerIds`).
|
|
39
41
|
*/
|
|
40
42
|
export function generateStacCatalogue(project, companions = [], options = {}) {
|
|
43
|
+
return buildProjectCatalogue(project, companions, options, null);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A QGIS project's catalogue with the files it carries: the twin of
|
|
47
|
+
* `generateStacCatalogue`, built by the same code, which gives each layer's
|
|
48
|
+
* styles as files of the catalogue's own rather than as addresses into the
|
|
49
|
+
* project file. Each style is a QGIS style document (`.qml`,
|
|
50
|
+
* `LayerStyle.styleDocument`) in `<filesFolder>/styles/<Collection>/`, named
|
|
51
|
+
* after the style, and for a Collection made from QGIS's per-shape layers,
|
|
52
|
+
* after the style and the shape. A folder name is made safe as
|
|
53
|
+
* `splitCatalogue` makes one. `filesFolder`, empty by default, is where a
|
|
54
|
+
* caller writing the catalogue as separate documents puts its other documents,
|
|
55
|
+
* `splitCatalogue`'s `childrenFolder`, so the files sit with them.
|
|
56
|
+
*/
|
|
57
|
+
export function generateCatalogueFiles(project, companions = [], options = {}) {
|
|
58
|
+
let folder = options.filesFolder ?? '';
|
|
59
|
+
while (folder.endsWith('/'))
|
|
60
|
+
folder = folder.slice(0, -1);
|
|
61
|
+
const styleFiles = { folder: folder ? `${folder}/` : '', files: [], taken: new Set() };
|
|
62
|
+
const catalogue = buildProjectCatalogue(project, companions, options, styleFiles);
|
|
63
|
+
return { catalogue, files: styleFiles.files };
|
|
64
|
+
}
|
|
65
|
+
/** `generateStacCatalogue`, writing each style as a file into `styleFiles` where it is given. */
|
|
66
|
+
function buildProjectCatalogue(project, companions, options, styleFiles) {
|
|
41
67
|
// `selfHref` is the folder the project was published from, for a project
|
|
42
68
|
// loaded out of cloud storage. A dragged-in project has no address to record.
|
|
43
69
|
//
|
|
@@ -65,7 +91,7 @@ export function generateStacCatalogue(project, companions = [], options = {}) {
|
|
|
65
91
|
// reproject the canvas. `resolveLayerWgs84Extents` in the same file builds
|
|
66
92
|
// this map; a layer left out of it (or a caller that leaves the option off
|
|
67
93
|
// entirely) has no box of its own.
|
|
68
|
-
return withSelfLink(generateStacFromNormalized(qgsProjectToNormalized(withoutWmsExcludedLayers(project), companions, options.projectPath, options.projectPath ?? options.projectFileName, options.initialView ?? null, options.layerWgs84Extents)), options.selfHref);
|
|
94
|
+
return withSelfLink(generateStacFromNormalized(qgsProjectToNormalized(withoutWmsExcludedLayers(project), companions, options.projectPath, options.projectPath ?? options.projectFileName, options.initialView ?? null, options.layerWgs84Extents, styleFiles)), options.selfHref);
|
|
69
95
|
}
|
|
70
96
|
/**
|
|
71
97
|
* The key a style asset takes for the field its renderer classifies by, when
|
|
@@ -100,7 +126,7 @@ export function readCollectionLayerName(collection) {
|
|
|
100
126
|
return typeof value === 'string' && value.trim() !== '' ? value : null;
|
|
101
127
|
}
|
|
102
128
|
/** Projects a parsed QgsProject into the source-agnostic normalized model. */
|
|
103
|
-
function qgsProjectToNormalized(project, companions, projectPath, projectFileName, initialView, layerWgs84Extents) {
|
|
129
|
+
function qgsProjectToNormalized(project, companions, projectPath, projectFileName, initialView, layerWgs84Extents, styleFiles) {
|
|
104
130
|
const companionByLayerId = new Map();
|
|
105
131
|
for (const c of companions) {
|
|
106
132
|
if (c.geojson)
|
|
@@ -118,6 +144,7 @@ function qgsProjectToNormalized(project, companions, projectPath, projectFileNam
|
|
|
118
144
|
projectPath,
|
|
119
145
|
projectFileName,
|
|
120
146
|
layerWgs84Extents,
|
|
147
|
+
styleFiles,
|
|
121
148
|
relationsByChildLayerId: collectRelationsByChildLayerId(project.relations ?? [], layersById, collectionIdOf),
|
|
122
149
|
valueRelationsByLayerId: collectValueRelationsByLayerId(project.layers, layersById, collectionIdOf),
|
|
123
150
|
siblingsById,
|
|
@@ -151,6 +178,7 @@ function qgsProjectToNormalized(project, companions, projectPath, projectFileNam
|
|
|
151
178
|
// Where the map *opens* is a different fact, and is only true of a project
|
|
152
179
|
// whose author saved a canvas position, so it goes in its own field below
|
|
153
180
|
// and is absent from a project that declares none.
|
|
181
|
+
const logos = projectLogos(project.variables ?? {});
|
|
154
182
|
return {
|
|
155
183
|
id: slugify(project.title || 'qgs-project') || 'qgs-project',
|
|
156
184
|
title: project.title,
|
|
@@ -163,12 +191,111 @@ function qgsProjectToNormalized(project, companions, projectPath, projectFileNam
|
|
|
163
191
|
activeCollectionId: project.initialActiveLayerId && layersById.has(project.initialActiveLayerId)
|
|
164
192
|
? collectionIdOf(project.initialActiveLayerId)
|
|
165
193
|
: null,
|
|
166
|
-
vendorFields: project
|
|
167
|
-
|
|
168
|
-
: undefined,
|
|
194
|
+
vendorFields: projectVendorFields(project, logos.leftOut),
|
|
195
|
+
links: logos.links,
|
|
169
196
|
nodes
|
|
170
197
|
};
|
|
171
198
|
}
|
|
199
|
+
/** The top-level Catalog's fields the project sets: its print layouts, its Brand colour and the logos it leaves out. */
|
|
200
|
+
function projectVendorFields(project, logosLeftOut) {
|
|
201
|
+
const fields = {};
|
|
202
|
+
if (project.printLayouts && project.printLayouts.length > 0) {
|
|
203
|
+
fields[QUAC_PRINT_LAYOUTS_FIELD] = project.printLayouts.map(({ name, template }) => ({ name, template }));
|
|
204
|
+
}
|
|
205
|
+
const brandColor = brandColorOf(project.brandColour);
|
|
206
|
+
if (brandColor)
|
|
207
|
+
fields[QUAC_BRAND_COLOR_FIELD] = brandColor;
|
|
208
|
+
if (logosLeftOut.length > 0)
|
|
209
|
+
fields[QUAC_LOGO_LEFT_OUT_FIELD] = logosLeftOut;
|
|
210
|
+
return Object.keys(fields).length > 0 ? fields : undefined;
|
|
211
|
+
}
|
|
212
|
+
/** The project variables naming the map's logo, and the logo shown in a dark theme. */
|
|
213
|
+
export const LOGO_VARIABLE = 'quac_logo';
|
|
214
|
+
export const LOGO_DARK_VARIABLE = 'quac_logo_dark';
|
|
215
|
+
/** The logo files a catalogue links, by extension, with the media type of each. */
|
|
216
|
+
const LOGO_MEDIA_TYPES = {
|
|
217
|
+
svg: 'image/svg+xml',
|
|
218
|
+
png: 'image/png',
|
|
219
|
+
jpg: 'image/jpeg',
|
|
220
|
+
jpeg: 'image/jpeg',
|
|
221
|
+
webp: 'image/webp'
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* The top-level Catalog's `icon` links to the map's logo, from the project
|
|
225
|
+
* variables `quac_logo` and `quac_logo_dark`: the second link carries
|
|
226
|
+
* `quac:theme: "dark"`. Each names a file by its path relative to the
|
|
227
|
+
* project, which the link gives as a data asset's href gives its file. A
|
|
228
|
+
* value that is not such a path, such as an absolute path or an address,
|
|
229
|
+
* leaves the folder, or does not end in a logo's extension, writes nothing,
|
|
230
|
+
* and a dark logo is written only beside a logo. Each variable set that
|
|
231
|
+
* writes no link is in `leftOut`, with why, as `quac:logo_left_out` lists it.
|
|
232
|
+
*/
|
|
233
|
+
function projectLogos(variables) {
|
|
234
|
+
const links = [];
|
|
235
|
+
const leftOut = [];
|
|
236
|
+
const light = logoLink(variables[LOGO_VARIABLE]);
|
|
237
|
+
if (typeof light === 'string')
|
|
238
|
+
leftOut.push({ variable: LOGO_VARIABLE, reason: light });
|
|
239
|
+
else if (light)
|
|
240
|
+
links.push(light);
|
|
241
|
+
const dark = logoLink(variables[LOGO_DARK_VARIABLE]);
|
|
242
|
+
if (typeof dark === 'string')
|
|
243
|
+
leftOut.push({ variable: LOGO_DARK_VARIABLE, reason: dark });
|
|
244
|
+
else if (dark && links.length === 0)
|
|
245
|
+
leftOut.push({ variable: LOGO_DARK_VARIABLE, reason: 'no_logo' });
|
|
246
|
+
else if (dark)
|
|
247
|
+
links.push({ ...dark, title: 'Logo for a dark theme', [QUAC_THEME_FIELD]: 'dark' });
|
|
248
|
+
return { links, leftOut };
|
|
249
|
+
}
|
|
250
|
+
/** A logo variable's link, why it writes none, or null where the variable is unset or blank. */
|
|
251
|
+
function logoLink(value) {
|
|
252
|
+
const text = (value ?? '').trim();
|
|
253
|
+
if (!text)
|
|
254
|
+
return null;
|
|
255
|
+
if (!isProjectRelativeFolder(text))
|
|
256
|
+
return 'not_relative';
|
|
257
|
+
if (leavesFolder(text))
|
|
258
|
+
return 'outside_folder';
|
|
259
|
+
const path = projectRelativeFile(text);
|
|
260
|
+
const mediaType = path ? LOGO_MEDIA_TYPES[path.slice(path.lastIndexOf('.') + 1).toLowerCase()] : undefined;
|
|
261
|
+
return path && mediaType ? { rel: 'icon', href: `./${encodeAssetPath(path)}`, type: mediaType, title: 'Logo' } : 'not_an_image';
|
|
262
|
+
}
|
|
263
|
+
/** Whether a relative path's `..` names climb above the folder it starts in. */
|
|
264
|
+
function leavesFolder(text) {
|
|
265
|
+
let depth = 0;
|
|
266
|
+
for (const name of text.split(/[\\/]/)) {
|
|
267
|
+
if (name === '' || name === '.')
|
|
268
|
+
continue;
|
|
269
|
+
depth += name === '..' ? -1 : 1;
|
|
270
|
+
if (depth < 0)
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* A path relative to the project and inside its folder, with `/` between its
|
|
277
|
+
* names and no `.` names, or null for anything else: an absolute path, a drive,
|
|
278
|
+
* a home folder or an address (`isProjectRelativeFolder`), or a path whose `..`
|
|
279
|
+
* leaves the folder.
|
|
280
|
+
*/
|
|
281
|
+
export function projectRelativeFile(value) {
|
|
282
|
+
const text = value.trim();
|
|
283
|
+
if (!text || !isProjectRelativeFolder(text))
|
|
284
|
+
return null;
|
|
285
|
+
const names = [];
|
|
286
|
+
for (const name of text.split(/[\\/]/)) {
|
|
287
|
+
if (name === '' || name === '.')
|
|
288
|
+
continue;
|
|
289
|
+
if (name === '..') {
|
|
290
|
+
if (names.length === 0)
|
|
291
|
+
return null;
|
|
292
|
+
names.pop();
|
|
293
|
+
}
|
|
294
|
+
else
|
|
295
|
+
names.push(name);
|
|
296
|
+
}
|
|
297
|
+
return names.length > 0 ? names.join('/') : null;
|
|
298
|
+
}
|
|
172
299
|
/**
|
|
173
300
|
* Sorts a project's filters by the Collection each goes onto: its layer's, the
|
|
174
301
|
* first sibling's for a layer QGIS split by shape. A filter whose layer is not
|
|
@@ -311,8 +438,12 @@ function siblingsToNormalized(siblings, title, context) {
|
|
|
311
438
|
const first = siblings[0];
|
|
312
439
|
const shapes = readSiblingShapes(siblings);
|
|
313
440
|
const wkbTypes = siblings.flatMap((layer) => layer.wkbType ? [layer.wkbType] : []);
|
|
441
|
+
const geometryTypes = siblings.flatMap((layer) => layer.geometryType ? [layer.geometryType] : []);
|
|
314
442
|
return {
|
|
315
|
-
...qgsLayerToNormalized(first, context, shapes.length === 3 ? null : shapes),
|
|
443
|
+
...qgsLayerToNormalized(first, context, shapes.length === 3 ? null : shapes, siblings.map((layer, index) => ({ layer, shape: shapes[index] ?? null }))),
|
|
444
|
+
// Each layer's own, so the Collection says every shape it holds, all three included.
|
|
445
|
+
// A layer that names none leaves the list to the first layer's alone.
|
|
446
|
+
...(geometryTypes.length === siblings.length ? { geometryTypes } : {}),
|
|
316
447
|
title,
|
|
317
448
|
description: first.resourceMetadata.abstract ?? qgisPlaceholderDescription('layer', title),
|
|
318
449
|
bbox: unionExtent([...siblings], context.layerWgs84Extents),
|
|
@@ -389,9 +520,9 @@ function geometryFilterOf(layer) {
|
|
|
389
520
|
const shapes = readSiblingShapes([layer]);
|
|
390
521
|
return shapes.length > 0 ? shapes : null;
|
|
391
522
|
}
|
|
392
|
-
function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(layer)) {
|
|
523
|
+
function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(layer), styleParts = [{ layer, shape: null }]) {
|
|
393
524
|
const geojson = context.companionByLayerId.get(layer.id) ?? null;
|
|
394
|
-
const {
|
|
525
|
+
const { layerWgs84Extents } = context;
|
|
395
526
|
const relatedTo = context.relationsByChildLayerId.get(layer.id);
|
|
396
527
|
const valueRelations = context.valueRelationsByLayerId.get(layer.id);
|
|
397
528
|
const bbox = effectiveWgs84Bbox(layer, layerWgs84Extents);
|
|
@@ -408,9 +539,9 @@ function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(
|
|
|
408
539
|
geometryType: layer.geometryType,
|
|
409
540
|
wkbTypes: layer.wkbType ? [layer.wkbType] : [],
|
|
410
541
|
qgisServerNames: qgisServerNamesOf(layer, context),
|
|
411
|
-
tableColumns: deriveTableColumns(geojson, layer.fieldNames, layer.fieldAliases, layer.fieldValueMaps, layer.fieldAttachments, layer.fieldEditRules, valueRelations, layer.formLayout ?? null, layer.fieldIcons, layer.fieldControls, layer.fieldComments),
|
|
542
|
+
tableColumns: deriveTableColumns(geojson, layer.fieldNames, layer.fieldAliases, layer.fieldValueMaps, layer.fieldAttachments, layer.fieldEditRules, valueRelations, layer.formLayout ?? null, layer.fieldIcons, layer.fieldControls, layer.fieldComments, layer.serverHiddenFields, fieldRulesLeftOutOf(layer, valueRelations)),
|
|
412
543
|
formOrder: layer.formLayout?.fields.map((field) => field.name),
|
|
413
|
-
assets: buildLayerAssets(layer,
|
|
544
|
+
assets: buildLayerAssets(layer, context, geometryFilter, styleParts),
|
|
414
545
|
keywords: metadata.keywords.length > 0 ? metadata.keywords : undefined,
|
|
415
546
|
license: metadata.license,
|
|
416
547
|
providers: buildLayerProviders(layer),
|
|
@@ -548,9 +679,9 @@ function buildVendorFields(layer, measurement) {
|
|
|
548
679
|
return fields;
|
|
549
680
|
}
|
|
550
681
|
/** The layer's data asset and its style set, in one namespace with no clashes. */
|
|
551
|
-
function buildLayerAssets(layer,
|
|
682
|
+
function buildLayerAssets(layer, context, geometryFilter, styleParts) {
|
|
552
683
|
const dataAssets = buildAssets(layer, geometryFilter);
|
|
553
|
-
return { ...dataAssets, ...buildStyleAssets(
|
|
684
|
+
return { ...dataAssets, ...buildStyleAssets(styleParts, context, dataAssets) };
|
|
554
685
|
}
|
|
555
686
|
/**
|
|
556
687
|
* The layer's coordinate system as QGIS holds it (`<srs><spatialrefsys><authid>`),
|
|
@@ -633,40 +764,76 @@ function buildAssets(layer, geometryFilter) {
|
|
|
633
764
|
* A style QGIS defined but wrote no renderer for is skipped — there would be
|
|
634
765
|
* nothing at the address to fetch.
|
|
635
766
|
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
* holds a `#` still gives an address that can be taken back apart.
|
|
767
|
+
* For QGIS's per-shape layers over one file, the styles are the first layer's,
|
|
768
|
+
* by name, and each is one asset per layer, carrying the layer's shape as
|
|
769
|
+
* `quac:geometry_filter`: that layer's style of the same name, or else its
|
|
770
|
+
* active one. A style some layer has no renderer for is skipped, so no shape is
|
|
771
|
+
* left with nothing to draw it.
|
|
642
772
|
*
|
|
643
773
|
* `existing` is the assets already built for the layer, so a style named after
|
|
644
774
|
* one of them takes a disambiguated key instead of replacing it.
|
|
645
775
|
*/
|
|
646
|
-
function buildStyleAssets(
|
|
776
|
+
function buildStyleAssets(parts, context, existing) {
|
|
647
777
|
const assets = nameRecord();
|
|
778
|
+
const [first] = parts;
|
|
779
|
+
if (!first)
|
|
780
|
+
return assets;
|
|
648
781
|
// The first style with a renderer is the default — the active one, unless
|
|
649
782
|
// QGIS wrote no renderer for it. Marked rather than left to its position,
|
|
650
783
|
// because a style named `2024` takes an asset key JavaScript enumerates
|
|
651
784
|
// ahead of every other, whenever it was written.
|
|
652
785
|
let defaultMarked = false;
|
|
653
|
-
for (const style of orderActiveStyleFirst(layer.styles, layer.activeStyleIndex)) {
|
|
654
|
-
|
|
786
|
+
for (const style of orderActiveStyleFirst(first.layer.styles, first.layer.activeStyleIndex)) {
|
|
787
|
+
const chosen = parts.map((part) => part.layer === first.layer
|
|
788
|
+
? style
|
|
789
|
+
: part.layer.styles.find((own) => own.name === style.name) ?? part.layer.styles[part.layer.activeStyleIndex]);
|
|
790
|
+
if (!chosen.every(hasRenderer))
|
|
655
791
|
continue;
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
792
|
+
parts.forEach((part, index) => {
|
|
793
|
+
const own = chosen[index];
|
|
794
|
+
assets[styleAssetKey({ ...existing, ...assets }, part.shape ? `${style.name} (${part.shape})` : style.name)] = {
|
|
795
|
+
href: styleHref(part, own, first.layer.id, context),
|
|
796
|
+
type: QML_STYLE_MEDIA_TYPE,
|
|
797
|
+
title: style.name,
|
|
798
|
+
roles: defaultMarked ? ['style'] : ['style', DEFAULT_STYLE_ROLE],
|
|
799
|
+
...(part.shape ? { [QUAC_GEOMETRY_FILTER]: [part.shape] } : {}),
|
|
800
|
+
// Written only for a categorised style, so a reader can tell which field
|
|
801
|
+
// a style classifies by without fetching and converting the style itself.
|
|
802
|
+
...(own.categorisedField ? { [QUAC_CATEGORISED_FIELD]: own.categorisedField } : {})
|
|
803
|
+
};
|
|
804
|
+
});
|
|
666
805
|
defaultMarked = true;
|
|
667
806
|
}
|
|
668
807
|
return assets;
|
|
669
808
|
}
|
|
809
|
+
function hasRenderer(style) {
|
|
810
|
+
return Boolean(style && (style.rendererV2RawXml || style.vectorTileRendererRawXml));
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* A style asset's address. Written as a file (`context.styleFiles`), it is the
|
|
814
|
+
* style file's path, and the file is added to the catalogue's files. Otherwise
|
|
815
|
+
* it is a fragment into the project document, `./project.qgs#<layer-id>/<style>`,
|
|
816
|
+
* which the reference marks as going: `projectPath` names that document where
|
|
817
|
+
* the caller knows where it sits, and is omitted otherwise, leaving a bare
|
|
818
|
+
* fragment. The path and both halves of the fragment are escaped, so a project
|
|
819
|
+
* or style whose name holds a `#` still gives an address that can be taken back
|
|
820
|
+
* apart.
|
|
821
|
+
*/
|
|
822
|
+
function styleHref(part, style, collectionId, context) {
|
|
823
|
+
const files = context.styleFiles;
|
|
824
|
+
if (files && style.styleDocument) {
|
|
825
|
+
const folder = `${files.folder}styles/${safeName(collectionId)}`;
|
|
826
|
+
const name = safeName(part.shape ? `${style.name}.${part.shape}` : style.name);
|
|
827
|
+
let path = `${folder}/${name}.qml`;
|
|
828
|
+
for (let count = 2; files.taken.has(path.toLowerCase()); count += 1)
|
|
829
|
+
path = `${folder}/${name}-${count}.qml`;
|
|
830
|
+
files.taken.add(path.toLowerCase());
|
|
831
|
+
files.files.push({ path, mediaType: QML_STYLE_MEDIA_TYPE, text: style.styleDocument });
|
|
832
|
+
return `./${encodeAssetPath(path)}`;
|
|
833
|
+
}
|
|
834
|
+
const fragment = `${encodeURIComponent(part.layer.id)}/${encodeURIComponent(style.name)}`;
|
|
835
|
+
return `${context.projectPath ? `./${encodeAssetPath(context.projectPath)}` : ''}#${fragment}`;
|
|
836
|
+
}
|
|
670
837
|
/**
|
|
671
838
|
* A QGIS style asset's address, taken back apart — the counterpart of the href
|
|
672
839
|
* `buildStyleAssets` writes, kept beside it so the two cannot drift.
|
|
@@ -779,7 +946,7 @@ function unionExtent(layers, layerWgs84Extents) {
|
|
|
779
946
|
* exist": this means a hidden WFS layer's schema is fully visible to the
|
|
780
947
|
* dev panel and to STAC clients before any data is fetched.
|
|
781
948
|
*/
|
|
782
|
-
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps = nameRecord(), fieldAttachments = nameRecord(), fieldEditRules = nameRecord(), fieldValueRelations = nameRecord(), formLayout = null, fieldIcons = nameRecord(), fieldControls = nameRecord(), fieldComments = nameRecord()) {
|
|
949
|
+
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps = nameRecord(), fieldAttachments = nameRecord(), fieldEditRules = nameRecord(), fieldValueRelations = nameRecord(), formLayout = null, fieldIcons = nameRecord(), fieldControls = nameRecord(), fieldComments = nameRecord(), serverHiddenFields = undefined, fieldRulesLeftOut = nameRecord()) {
|
|
783
950
|
const observedTypes = new Map();
|
|
784
951
|
const orderedFieldNames = [];
|
|
785
952
|
const seen = new Set();
|
|
@@ -888,9 +1055,44 @@ function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps =
|
|
|
888
1055
|
if (placed?.editableWhen)
|
|
889
1056
|
column['quac:editable_when'] = placed.editableWhen;
|
|
890
1057
|
}
|
|
1058
|
+
const hiddenFrom = [];
|
|
1059
|
+
if (serverHiddenFields?.wms.includes(name))
|
|
1060
|
+
hiddenFrom.push('wms');
|
|
1061
|
+
if (serverHiddenFields?.wfs.includes(name))
|
|
1062
|
+
hiddenFrom.push('wfs');
|
|
1063
|
+
if (hiddenFrom.length > 0)
|
|
1064
|
+
column['quac:qgis_server_hidden'] = hiddenFrom;
|
|
1065
|
+
const leftOut = fieldRulesLeftOut[name];
|
|
1066
|
+
if (leftOut?.length)
|
|
1067
|
+
column['quac:rules_left_out'] = leftOut.map(ruleLeftOutToJson);
|
|
891
1068
|
return column;
|
|
892
1069
|
});
|
|
893
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* A layer's field rules its Collection leaves out: those its parsing left out
|
|
1073
|
+
* (`fieldRulesLeftOut`), then each Value Relation whose lookup layer is not
|
|
1074
|
+
* in the catalogue, which `quac:value_relation` therefore does not name. The
|
|
1075
|
+
* lookup is not named either: it may be a layer the project leaves out of WMS.
|
|
1076
|
+
*/
|
|
1077
|
+
function fieldRulesLeftOutOf(layer, valueRelations) {
|
|
1078
|
+
const leftOut = nameRecord();
|
|
1079
|
+
for (const [field, rules] of Object.entries(layer.fieldRulesLeftOut ?? {}))
|
|
1080
|
+
leftOut[field] = [...rules];
|
|
1081
|
+
for (const field of Object.keys(layer.fieldValueRelations)) {
|
|
1082
|
+
if (valueRelations?.[field])
|
|
1083
|
+
continue;
|
|
1084
|
+
(leftOut[field] ??= []).push({ rule: 'value_relation', text: null });
|
|
1085
|
+
}
|
|
1086
|
+
return leftOut;
|
|
1087
|
+
}
|
|
1088
|
+
/** A left-out field rule as `quac:rules_left_out` stores it: a blank text is left off. */
|
|
1089
|
+
function ruleLeftOutToJson(rule) {
|
|
1090
|
+
return {
|
|
1091
|
+
rule: rule.rule,
|
|
1092
|
+
...(rule.text ? { text: rule.text } : {}),
|
|
1093
|
+
...(rule.strength ? { strength: rule.strength } : {})
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
894
1096
|
/** A field's constraint expression as `quac:constraints` stores it: a description the source left blank is left off. */
|
|
895
1097
|
function constraintExpressionToJson(constraint) {
|
|
896
1098
|
return {
|
|
@@ -24,9 +24,15 @@ export type NewFeatureProblem = 'unknown-field' | 'not-fillable' | 'required' |
|
|
|
24
24
|
* - `unique`: an enforced Unique constraint, which needs the layer's other features;
|
|
25
25
|
* - `date-format`: it stores dates in a format of its own;
|
|
26
26
|
* - `attachment`: it holds a file's path, and the file is not part of the feature;
|
|
27
|
-
* - `type`: its type is one this does not know
|
|
27
|
+
* - `type`: its type is one this does not know;
|
|
28
|
+
* - `widget`: the catalogue leaves out its edit widget (`quac:rules_left_out`),
|
|
29
|
+
* which may restrict its values;
|
|
30
|
+
* - `left-out`: the catalogue leaves out a rule of a kind this does not know.
|
|
31
|
+
*
|
|
32
|
+
* A constraint expression or Value Relation the catalogue leaves out is
|
|
33
|
+
* `constraint-expression` or `value-relation`, as one it carries is.
|
|
28
34
|
*/
|
|
29
|
-
export type UncheckedFieldRule = 'constraint-expression' | 'visible-when' | 'editable-when' | 'value-relation' | 'unique' | 'date-format' | 'attachment' | 'type';
|
|
35
|
+
export type UncheckedFieldRule = 'constraint-expression' | 'visible-when' | 'editable-when' | 'value-relation' | 'unique' | 'date-format' | 'attachment' | 'type' | 'widget' | 'left-out';
|
|
30
36
|
export interface NewFeatureCheck {
|
|
31
37
|
/** The fields refused, in the layer's field order, then the fields the layer does not have. */
|
|
32
38
|
problems: {
|
|
@@ -53,10 +59,11 @@ type Properties = Readonly<Record<string, unknown>>;
|
|
|
53
59
|
* Checkbox spelling, and its range. A rule that needs more than the Collection
|
|
54
60
|
* to check is listed in `unchecked`, not passed.
|
|
55
61
|
*
|
|
56
|
-
* It checks only what the Collection carries. A
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
62
|
+
* It checks only what the Collection carries. A rule the catalogue leaves
|
|
63
|
+
* out, such as a constraint expression `readQgisExpression` cannot read, is
|
|
64
|
+
* listed in the column's `quac:rules_left_out`, and so in `unchecked`, apart
|
|
65
|
+
* from a default value, which this does not fill: a caller that fills
|
|
66
|
+
* defaults reads `quac:rules_left_out` itself.
|
|
60
67
|
*
|
|
61
68
|
* A Collection that declares no fields refuses every value. A warning
|
|
62
69
|
* (`warn`) constraint refuses nothing, as QGIS saves past it. Values are
|
|
@@ -8,10 +8,11 @@ import { declaredColumns, readCollectionFieldEditRules, readCollectionFieldTypes
|
|
|
8
8
|
* Checkbox spelling, and its range. A rule that needs more than the Collection
|
|
9
9
|
* to check is listed in `unchecked`, not passed.
|
|
10
10
|
*
|
|
11
|
-
* It checks only what the Collection carries. A
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* It checks only what the Collection carries. A rule the catalogue leaves
|
|
12
|
+
* out, such as a constraint expression `readQgisExpression` cannot read, is
|
|
13
|
+
* listed in the column's `quac:rules_left_out`, and so in `unchecked`, apart
|
|
14
|
+
* from a default value, which this does not fill: a caller that fills
|
|
15
|
+
* defaults reads `quac:rules_left_out` itself.
|
|
15
16
|
*
|
|
16
17
|
* A Collection that declares no fields refuses every value. A warning
|
|
17
18
|
* (`warn`) constraint refuses nothing, as QGIS saves past it. Values are
|
|
@@ -106,6 +107,30 @@ export function newQgisUuid(format) {
|
|
|
106
107
|
const KNOWN_TYPES = new Set(['string', 'int', 'long', 'double', 'boolean', 'date', 'time', 'timestamp']);
|
|
107
108
|
const DATE_TYPES = new Set(['date', 'time', 'timestamp']);
|
|
108
109
|
function uncheckedRules(column, type, unique, dateFormat) {
|
|
110
|
+
const found = new Set();
|
|
111
|
+
for (const rule of uncheckedColumnRules(column, type, unique, dateFormat))
|
|
112
|
+
found.add(rule);
|
|
113
|
+
for (const rule of leftOutRules(column))
|
|
114
|
+
found.add(rule);
|
|
115
|
+
return Array.from(found);
|
|
116
|
+
}
|
|
117
|
+
/** The unchecked rules a column's `quac:rules_left_out` gives: every entry but a default and a constraint that only warns. */
|
|
118
|
+
function leftOutRules(column) {
|
|
119
|
+
const value = column['quac:rules_left_out'];
|
|
120
|
+
if (!Array.isArray(value))
|
|
121
|
+
return [];
|
|
122
|
+
return value.flatMap((entry) => {
|
|
123
|
+
const { rule, strength } = entry && typeof entry === 'object' ? entry : {};
|
|
124
|
+
switch (rule) {
|
|
125
|
+
case 'default': return [];
|
|
126
|
+
case 'constraint': return strength === 'warn' ? [] : ['constraint-expression'];
|
|
127
|
+
case 'value_relation': return ['value-relation'];
|
|
128
|
+
case 'widget': return ['widget'];
|
|
129
|
+
default: return ['left-out'];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function uncheckedColumnRules(column, type, unique, dateFormat) {
|
|
109
134
|
const found = [];
|
|
110
135
|
const constraints = column['quac:constraints'];
|
|
111
136
|
const expression = constraints && typeof constraints === 'object' ? constraints.expression : undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* `@vectoriahq/quac`.
|
|
4
4
|
*/
|
|
5
5
|
export type { QgsProject, ProjectMetadata, MapExtent, BoundingBox, LayerEntry, EditLock, LayerLocks, LockedEdit, ProjectMeasurement, LayerStyle, LayerResourceMetadata, LayerScaleRange, LayerContact, LayerAttribution, FieldAttachment, FieldCheckbox, FieldConstraintExpression, FieldDefaultExpression, FieldDefaultValue, FieldEditRule, FormLayoutField, LayerFormLayout, FieldFixedValue, FieldRange, FieldUuidFormat, FieldValueMapEntry, DataSource, FileDataSource, WfsDataSource, WmsDataSource, UnsupportedDataSource, LayerTreeNode, LayerGroup, LayerTreeLeaf, QgsRelation, QgsRelationFieldPair, ProjectNote, ProjectNoteReason } from './model/QgsProject.ts';
|
|
6
|
-
export type { StacCatalog, StacCollection, StacItem, StacAsset, StacExtent, StacLink, StacObject, StacProvider, TableColumn, TableColumnType, TableColumnValue, TableColumnValueRelation, TableColumnAttachment, TableColumnCheckbox, TableColumnRange } from './model/Stac.ts';
|
|
6
|
+
export type { StacCatalog, StacCollection, StacItem, StacAsset, StacExtent, StacLink, StacObject, StacProvider, TableColumn, TableColumnType, TableColumnValue, TableColumnValueRelation, TableColumnRuleLeftOut, TableColumnServerService, TableColumnAttachment, TableColumnCheckbox, TableColumnRange } from './model/Stac.ts';
|
|
7
7
|
export { STAC_VERSION } from './model/Stac.ts';
|
|
8
8
|
export { isIconLibraryAddress, resolveFieldIconAddress } from './model/fieldIconAddress.ts';
|
|
9
9
|
export { collectCollectionStyles, getDefaultStyle, styleAssetKey, GL_STYLE_MEDIA_TYPE } from './model/stacStyles.ts';
|
|
10
|
-
export type { StacStyle, StyleOverrideReference } from './model/stacStyles.ts';
|
|
10
|
+
export type { StacStyle, StacStylePart, StyleOverrideReference } from './model/stacStyles.ts';
|
|
11
11
|
export { readCollectionColourAdjustment } from './model/colourAdjustment.ts';
|
|
12
12
|
export type { ColourAdjustment } from './model/colourAdjustment.ts';
|
|
13
13
|
export { parseQgsXml } from './parse/parseQgsXml.ts';
|
|
@@ -18,7 +18,8 @@ export { collectLayerVisibility } from './parse/collectLayerVisibility.ts';
|
|
|
18
18
|
export { parseDataSource } from './parse/parseDataSource.ts';
|
|
19
19
|
export { findGeometrySiblings, readGeometrySiblingShapes, readSiblingShapes, siblingCollectionId } from './parse/geometrySiblings.ts';
|
|
20
20
|
export { qmlForLayer } from './generate/qmlForLayer.ts';
|
|
21
|
-
export { generateStacCatalogue, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from './generate/stacCatalogue.ts';
|
|
21
|
+
export { generateStacCatalogue, generateCatalogueFiles, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from './generate/stacCatalogue.ts';
|
|
22
|
+
export type { CatalogueFile, StacCatalogueOptions } from './generate/stacCatalogue.ts';
|
|
22
23
|
export { DEFAULT_DELIMITED_TEXT_OPTIONS, QUAC_DELIMITED_TEXT, readCollectionDelimitedText } from './model/delimitedText.ts';
|
|
23
24
|
export { QUAC_FEATURE_FILTER, readCollectionFeatureFilter } from './model/featureFilter.ts';
|
|
24
25
|
export { readSqlFeatureTest } from './parse/sqlFeatureFilter.ts';
|
|
@@ -36,8 +37,8 @@ export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionR
|
|
|
36
37
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from './model/stacPmtiles.ts';
|
|
37
38
|
export type { StacPmtilesSource } from './model/stacPmtiles.ts';
|
|
38
39
|
export type { StacCompanionData } from './generate/stacCatalogue.ts';
|
|
39
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
40
|
-
export type { CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
|
|
40
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCatalogueBrandColor, readCatalogueLogos, readCatalogueLeftOut, readCatalogueLogoLeftOut, QUAC_LOGO_LEFT_OUT_FIELD, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldRulesLeftOut, readCollectionServerHiddenFields, QUAC_QGIS_SERVER_HIDDEN_FIELD, QUAC_RULES_LEFT_OUT_FIELD, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionGeometryTypes, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
41
|
+
export type { CatalogueLogo, LeftOutLayer, LeftOutReason, LogoLeftOut, LogoLeftOutReason, CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
|
|
41
42
|
export { generateStacCatalogueFromWfsCapabilities } from './generate/wfsStacCatalogue.ts';
|
|
42
43
|
export type { WfsStacCatalogueOptions } from './generate/wfsStacCatalogue.ts';
|
|
43
44
|
export { generateStacCatalogueFromFolder } from './generate/folderStacCatalogue.ts';
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { collectLayerVisibility } from "./parse/collectLayerVisibility.js";
|
|
|
13
13
|
export { parseDataSource } from "./parse/parseDataSource.js";
|
|
14
14
|
export { findGeometrySiblings, readGeometrySiblingShapes, readSiblingShapes, siblingCollectionId } from "./parse/geometrySiblings.js";
|
|
15
15
|
export { qmlForLayer } from "./generate/qmlForLayer.js";
|
|
16
|
-
export { generateStacCatalogue, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from "./generate/stacCatalogue.js";
|
|
16
|
+
export { generateStacCatalogue, generateCatalogueFiles, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from "./generate/stacCatalogue.js";
|
|
17
17
|
export { DEFAULT_DELIMITED_TEXT_OPTIONS, QUAC_DELIMITED_TEXT, readCollectionDelimitedText } from "./model/delimitedText.js";
|
|
18
18
|
export { QUAC_FEATURE_FILTER, readCollectionFeatureFilter } from "./model/featureFilter.js";
|
|
19
19
|
export { readSqlFeatureTest } from "./parse/sqlFeatureFilter.js";
|
|
@@ -24,7 +24,7 @@ export { DATA_ROLE, findAssetByRole, readDataAsset } from "./model/stacAssetRole
|
|
|
24
24
|
export { THUMBNAIL_ROLE, readCollectionAttribution, readCollectionDeprecation, readCollectionSelfHref, readCollectionThumbnail } from "./model/stacCollectionNotes.js";
|
|
25
25
|
export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionRowCount, readDataAssetFileSize } from "./model/stacSizeAndCount.js";
|
|
26
26
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from "./model/stacPmtiles.js";
|
|
27
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
27
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCatalogueBrandColor, readCatalogueLogos, readCatalogueLeftOut, readCatalogueLogoLeftOut, QUAC_LOGO_LEFT_OUT_FIELD, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldRulesLeftOut, readCollectionServerHiddenFields, QUAC_QGIS_SERVER_HIDDEN_FIELD, QUAC_RULES_LEFT_OUT_FIELD, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionGeometryTypes, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
28
28
|
export { generateStacCatalogueFromWfsCapabilities } from "./generate/wfsStacCatalogue.js";
|
|
29
29
|
export { generateStacCatalogueFromFolder } from "./generate/folderStacCatalogue.js";
|
|
30
30
|
export { generateCollectionForDroppedFile, generateCollectionForLinkedFile } from "./generate/fileLayerCollection.js";
|
|
@@ -248,6 +248,14 @@ export interface LayerEntry {
|
|
|
248
248
|
* layer hides none.
|
|
249
249
|
*/
|
|
250
250
|
serverHiddenFields?: ServerHiddenFields;
|
|
251
|
+
/**
|
|
252
|
+
* The rules each field has that the layer's Collection does not carry,
|
|
253
|
+
* keyed by field name, in the order they are read: an edit widget that is
|
|
254
|
+
* not read, a default value expression or a constraint expression
|
|
255
|
+
* `readQgisExpression` cannot read. Each is also a `ProjectNote`. Absent
|
|
256
|
+
* where the layer leaves none out.
|
|
257
|
+
*/
|
|
258
|
+
fieldRulesLeftOut?: Record<string, FieldRuleLeftOut[]>;
|
|
251
259
|
/**
|
|
252
260
|
* All named styles defined for the layer. QGIS allows multiple symbology
|
|
253
261
|
* styles per layer (e.g. "Asset Owner" + "Priority") with one currently
|
|
@@ -670,6 +678,12 @@ export interface LayerStyle {
|
|
|
670
678
|
* whose file holds one: QGIS writes it in place of `<renderer-v2>`.
|
|
671
679
|
*/
|
|
672
680
|
vectorTileRendererRawXml?: string;
|
|
681
|
+
/**
|
|
682
|
+
* The style as a QGIS style document (`.qml`), holding its symbology,
|
|
683
|
+
* labels, diagrams and rendering settings, which a catalogue's style file
|
|
684
|
+
* holds (`generateCatalogueFiles`). Absent for a style with no renderer.
|
|
685
|
+
*/
|
|
686
|
+
styleDocument?: string;
|
|
673
687
|
}
|
|
674
688
|
export type DataSource = FileDataSource | WfsDataSource | WmsDataSource | XyzDataSource | WmtsDataSource | ArcgisFeatureServerDataSource | UnsupportedDataSource;
|
|
675
689
|
export interface FileDataSource {
|
|
@@ -802,6 +816,19 @@ export interface LayerTreeLeaf {
|
|
|
802
816
|
checked: boolean;
|
|
803
817
|
}
|
|
804
818
|
/** The fields of a layer QGIS Server hides, by the service that hides them. */
|
|
819
|
+
/**
|
|
820
|
+
* A rule of a field that its Collection does not carry, as
|
|
821
|
+
* `quac:rules_left_out` writes it: `rule` says which, `text` is the widget's
|
|
822
|
+
* type, the expression, or the lookup layer's name, and `strength` is a
|
|
823
|
+
* constraint expression's.
|
|
824
|
+
*/
|
|
825
|
+
export interface FieldRuleLeftOut {
|
|
826
|
+
rule: FieldRuleLeftOutKind;
|
|
827
|
+
text: string | null;
|
|
828
|
+
strength?: 'enforced' | 'warn';
|
|
829
|
+
}
|
|
830
|
+
/** The kinds of field rule a Collection leaves out (`quac:rules_left_out`). */
|
|
831
|
+
export type FieldRuleLeftOutKind = 'widget' | 'default' | 'constraint' | 'value_relation';
|
|
805
832
|
export interface ServerHiddenFields {
|
|
806
833
|
wms: string[];
|
|
807
834
|
wfs: string[];
|
package/dist/model/Stac.d.ts
CHANGED
|
@@ -200,6 +200,27 @@ export interface TableColumn {
|
|
|
200
200
|
'quac:control'?: 'buttons' | 'dropdown';
|
|
201
201
|
/** Written only as `true`: the source's form puts the column's name above its value. */
|
|
202
202
|
'quac:label_on_top'?: true;
|
|
203
|
+
/**
|
|
204
|
+
* The QGIS Server services that leave the column's values out, `wms` before
|
|
205
|
+
* `wfs`. Written only where the source hides the column from one.
|
|
206
|
+
*/
|
|
207
|
+
'quac:qgis_server_hidden'?: TableColumnServerService[];
|
|
208
|
+
/** The column's rules the catalogue leaves out, in the order the source was read. */
|
|
209
|
+
'quac:rules_left_out'?: TableColumnRuleLeftOut[];
|
|
210
|
+
}
|
|
211
|
+
/** A QGIS Server service that can hide a column (`quac:qgis_server_hidden`). */
|
|
212
|
+
export type TableColumnServerService = 'wms' | 'wfs';
|
|
213
|
+
/**
|
|
214
|
+
* A rule of a column the catalogue leaves out: an edit `widget` it does not
|
|
215
|
+
* read, a `default` or `constraint` expression it cannot read, or a
|
|
216
|
+
* `value_relation` whose lookup is not in the catalogue. `text` is the
|
|
217
|
+
* widget's type, the expression or the lookup layer's name, and `strength` a
|
|
218
|
+
* constraint's.
|
|
219
|
+
*/
|
|
220
|
+
export interface TableColumnRuleLeftOut {
|
|
221
|
+
rule: 'widget' | 'default' | 'constraint' | 'value_relation';
|
|
222
|
+
text?: string;
|
|
223
|
+
strength?: 'enforced' | 'warn';
|
|
203
224
|
}
|
|
204
225
|
/**
|
|
205
226
|
* A column whose choices come from another Collection's records: `key` is the
|