@vectoriahq/quac 0.15.0 → 0.16.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 +9 -1
- package/dist/generate/normalizedProject.js +26 -7
- package/dist/generate/stacCatalogue.d.ts +8 -0
- package/dist/generate/stacCatalogue.js +21 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/model/QgsProject.d.ts +10 -0
- package/dist/model/WmsProject.d.ts +31 -0
- package/dist/model/fieldIconAddress.d.ts +5 -1
- package/dist/model/fieldIconAddress.js +6 -2
- package/dist/parse/parseGetProjectSettings.d.ts +3 -2
- package/dist/parse/parseGetProjectSettings.js +27 -3
- package/dist/parse/parseLayers.js +9 -8
- package/dist/parse/parsePrintLayouts.d.ts +28 -0
- package/dist/parse/parsePrintLayouts.js +79 -0
- package/dist/parse/parseQgsXml.js +2 -0
- package/dist/util/nameRecord.d.ts +7 -0
- package/dist/util/nameRecord.js +9 -0
- package/package.json +1 -1
- package/src/schema/quac.schema.json +14 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LayerLocks, FieldAttachment, FieldEditRule, LayerFormLayout, LayerScaleRange, ProjectMeasurement } from '../model/QgsProject.ts';
|
|
1
|
+
import type { LayerLocks, PrintLayoutTemplate, FieldAttachment, FieldEditRule, LayerFormLayout, LayerScaleRange, ProjectMeasurement } from '../model/QgsProject.ts';
|
|
2
2
|
import type { StacAsset, StacCatalog, StacCollection, StacExtent, StacLink, StacProvider, TableColumn, TableColumnValue, TableColumnValueRelation } from '../model/Stac.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Source-agnostic intermediate model + the single STAC generator that
|
|
@@ -80,6 +80,8 @@ export declare const QUAC_MUTUALLY_EXCLUSIVE_FIELD = "quac:mutually_exclusive";
|
|
|
80
80
|
* names as the one the map opens with as the active layer.
|
|
81
81
|
*/
|
|
82
82
|
export declare const QUAC_ACTIVE_COLLECTION_FIELD = "quac:active_collection";
|
|
83
|
+
/** The project's print layouts, on the top-level Catalog: each as its name and its QGIS layout template. */
|
|
84
|
+
export declare const QUAC_PRINT_LAYOUTS_FIELD = "quac:print_layouts";
|
|
83
85
|
/**
|
|
84
86
|
* One relation a Collection declares in `quac:related_to`: the parent
|
|
85
87
|
* Collection its records hang off, the field pair(s) joining them, and the name
|
|
@@ -297,6 +299,12 @@ export declare function readCatalogueActiveCollection(catalog: StacCatalog): str
|
|
|
297
299
|
* about where to open", so a caller frames the map its own way rather than
|
|
298
300
|
* reading a missing field as an instruction.
|
|
299
301
|
*/
|
|
302
|
+
/**
|
|
303
|
+
* Reads `quac:print_layouts` back off a Catalog: each print layout's name and
|
|
304
|
+
* template, in its order. An entry without a string name, or whose template is
|
|
305
|
+
* not a `<Layout>` element, is not read. Empty where the Catalog lists none.
|
|
306
|
+
*/
|
|
307
|
+
export declare function readCataloguePrintLayouts(catalog: StacCatalog): PrintLayoutTemplate[];
|
|
300
308
|
export declare function readCatalogueInitialView(catalog: StacCatalog): NormalizedBbox | null;
|
|
301
309
|
/**
|
|
302
310
|
* Reads shared source declarations back off a Collection.
|
|
@@ -4,6 +4,7 @@ import { STAC_VERSION } from "../model/Stac.js";
|
|
|
4
4
|
import { PROJ_CODE, PROJECTION_EXTENSION } from "../model/stacProjection.js";
|
|
5
5
|
import { collectCatalogueCollections } from "../model/stacTreeWalk.js";
|
|
6
6
|
import { readNonBlank } from "../util/nonBlankText.js";
|
|
7
|
+
import { nameRecord } from "../util/nameRecord.js";
|
|
7
8
|
/**
|
|
8
9
|
* Source-agnostic intermediate model + the single STAC generator that
|
|
9
10
|
* consumes it.
|
|
@@ -89,6 +90,8 @@ const INITIAL_VIEW_FIELD = 'quac:initial_view';
|
|
|
89
90
|
* names as the one the map opens with as the active layer.
|
|
90
91
|
*/
|
|
91
92
|
export const QUAC_ACTIVE_COLLECTION_FIELD = 'quac:active_collection';
|
|
93
|
+
/** The project's print layouts, on the top-level Catalog: each as its name and its QGIS layout template. */
|
|
94
|
+
export const QUAC_PRINT_LAYOUTS_FIELD = 'quac:print_layouts';
|
|
92
95
|
/**
|
|
93
96
|
* Records where a catalogue came from as the Catalog's `self` link, so the
|
|
94
97
|
* document says it rather than a reader holding it alongside. Sources with no
|
|
@@ -352,6 +355,22 @@ export function readCatalogueActiveCollection(catalog) {
|
|
|
352
355
|
* about where to open", so a caller frames the map its own way rather than
|
|
353
356
|
* reading a missing field as an instruction.
|
|
354
357
|
*/
|
|
358
|
+
/**
|
|
359
|
+
* Reads `quac:print_layouts` back off a Catalog: each print layout's name and
|
|
360
|
+
* template, in its order. An entry without a string name, or whose template is
|
|
361
|
+
* not a `<Layout>` element, is not read. Empty where the Catalog lists none.
|
|
362
|
+
*/
|
|
363
|
+
export function readCataloguePrintLayouts(catalog) {
|
|
364
|
+
const value = catalog[QUAC_PRINT_LAYOUTS_FIELD];
|
|
365
|
+
if (!Array.isArray(value))
|
|
366
|
+
return [];
|
|
367
|
+
return value.flatMap((entry) => {
|
|
368
|
+
if (!entry || typeof entry !== 'object')
|
|
369
|
+
return [];
|
|
370
|
+
const { name, template } = entry;
|
|
371
|
+
return typeof name === 'string' && typeof template === 'string' && /^<Layout[\s/>]/.test(template) ? [{ name, template }] : [];
|
|
372
|
+
});
|
|
373
|
+
}
|
|
355
374
|
export function readCatalogueInitialView(catalog) {
|
|
356
375
|
const value = catalog[INITIAL_VIEW_FIELD];
|
|
357
376
|
if (!Array.isArray(value) || value.length !== 4)
|
|
@@ -396,7 +415,7 @@ export function* declaredColumns(collection) {
|
|
|
396
415
|
}
|
|
397
416
|
/** Each field's alias, its column's `title`. A column with a blank or no `title` is absent. */
|
|
398
417
|
export function readCollectionFieldAliases(collection) {
|
|
399
|
-
const aliases =
|
|
418
|
+
const aliases = nameRecord();
|
|
400
419
|
for (const [name, column] of declaredColumns(collection)) {
|
|
401
420
|
const alias = readNonBlank(column.title);
|
|
402
421
|
if (alias)
|
|
@@ -406,7 +425,7 @@ export function readCollectionFieldAliases(collection) {
|
|
|
406
425
|
}
|
|
407
426
|
/** Each field's comment, its column's `description`, trimmed. A column with a blank or no `description` is absent. */
|
|
408
427
|
export function readCollectionFieldComments(collection) {
|
|
409
|
-
const comments =
|
|
428
|
+
const comments = nameRecord();
|
|
410
429
|
for (const [name, column] of declaredColumns(collection)) {
|
|
411
430
|
const comment = readNonBlank(column.description);
|
|
412
431
|
if (comment)
|
|
@@ -425,7 +444,7 @@ export function readCollectionFieldNames(collection) {
|
|
|
425
444
|
}
|
|
426
445
|
/** Each declared column `type`, keyed by field name. A column with no `type` is absent. */
|
|
427
446
|
export function readCollectionFieldTypes(collection) {
|
|
428
|
-
const types =
|
|
447
|
+
const types = nameRecord();
|
|
429
448
|
for (const [name, column] of declaredColumns(collection)) {
|
|
430
449
|
const type = readNonBlank(column.type);
|
|
431
450
|
if (type)
|
|
@@ -439,7 +458,7 @@ export function readCollectionFieldTypes(collection) {
|
|
|
439
458
|
* other kind, is dropped, and a column left with no entries is absent.
|
|
440
459
|
*/
|
|
441
460
|
export function readCollectionFieldValues(collection) {
|
|
442
|
-
const picklists =
|
|
461
|
+
const picklists = nameRecord();
|
|
443
462
|
for (const [name, column] of declaredColumns(collection)) {
|
|
444
463
|
const declared = column['quac:values'];
|
|
445
464
|
if (!Array.isArray(declared))
|
|
@@ -468,7 +487,7 @@ export function readCollectionFieldValues(collection) {
|
|
|
468
487
|
* `order_field`, reads as ordered by key.
|
|
469
488
|
*/
|
|
470
489
|
export function readCollectionFieldValueRelations(collection) {
|
|
471
|
-
const relations =
|
|
490
|
+
const relations = nameRecord();
|
|
472
491
|
for (const [name, column] of declaredColumns(collection)) {
|
|
473
492
|
const declared = column['quac:value_relation'];
|
|
474
493
|
if (!declared || typeof declared !== 'object')
|
|
@@ -585,7 +604,7 @@ export function readCollectionPrivate(collection) {
|
|
|
585
604
|
* omitted or unrecognised `relative_storage` as absolute.
|
|
586
605
|
*/
|
|
587
606
|
export function readCollectionFieldAttachments(collection) {
|
|
588
|
-
const attachments =
|
|
607
|
+
const attachments = nameRecord();
|
|
589
608
|
for (const [name, column] of declaredColumns(collection)) {
|
|
590
609
|
const declared = column['quac:attachment'];
|
|
591
610
|
if (!declared || typeof declared !== 'object' || Array.isArray(declared))
|
|
@@ -623,7 +642,7 @@ export function readCollectionFieldAttachments(collection) {
|
|
|
623
642
|
*/
|
|
624
643
|
export function readCollectionFieldEditRules(collection) {
|
|
625
644
|
const relations = readCollectionFieldValueRelations(collection);
|
|
626
|
-
const rules =
|
|
645
|
+
const rules = nameRecord();
|
|
627
646
|
for (const [name, candidate] of declaredColumns(collection)) {
|
|
628
647
|
const readOnly = candidate['quac:editable'] === false;
|
|
629
648
|
const defaultValue = readColumnDefault(candidate['quac:default']);
|
|
@@ -119,4 +119,12 @@ export declare function parseQgisStyleAssetHref(href: string): {
|
|
|
119
119
|
layerId: string;
|
|
120
120
|
styleName: string;
|
|
121
121
|
} | null;
|
|
122
|
+
/**
|
|
123
|
+
* Whether an Attachment widget's default folder is a path relative to the
|
|
124
|
+
* project, and not a path on the computer that saved it, such as
|
|
125
|
+
* `/srv/photos`, `C:\\Survey` or `~/photos`, a network share or an address.
|
|
126
|
+
* QGIS's folder picker saves an absolute path, which would publish the
|
|
127
|
+
* computer's folder names.
|
|
128
|
+
*/
|
|
129
|
+
export declare function isProjectRelativeFolder(folder: string): boolean;
|
|
122
130
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arcgisQueryAsset } from "./arcgisStacCatalogue.js";
|
|
2
|
-
import { QUAC_MEASUREMENT_FIELD, slugify, generateStacFromNormalized, unionBboxes, withSelfLink } from "./normalizedProject.js";
|
|
2
|
+
import { QUAC_MEASUREMENT_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";
|
|
@@ -13,6 +13,7 @@ import { buildXyzLink } from "../model/stacXyz.js";
|
|
|
13
13
|
import { findGeometrySiblings, readSiblingShapes, siblingCollectionId } from "../parse/geometrySiblings.js";
|
|
14
14
|
import { findValueRelationLookup, isFilterInProject, isRelationInProject } from "../parse/projectNotes.js";
|
|
15
15
|
import { declaredMediaTypeForFile, isLayerFileOfFormat, PROJECT_DATA_ROLES, QML_STYLE_MEDIA_TYPE } from "../util/catalogueFileFormats.js";
|
|
16
|
+
import { nameRecord } from "../util/nameRecord.js";
|
|
16
17
|
/**
|
|
17
18
|
* Generates a STAC Catalog tree from a parsed QgsProject.
|
|
18
19
|
*
|
|
@@ -162,6 +163,9 @@ function qgsProjectToNormalized(project, companions, projectPath, projectFileNam
|
|
|
162
163
|
activeCollectionId: project.initialActiveLayerId && layersById.has(project.initialActiveLayerId)
|
|
163
164
|
? collectionIdOf(project.initialActiveLayerId)
|
|
164
165
|
: null,
|
|
166
|
+
vendorFields: project.printLayouts && project.printLayouts.length > 0
|
|
167
|
+
? { [QUAC_PRINT_LAYOUTS_FIELD]: project.printLayouts.map(({ name, template }) => ({ name, template })) }
|
|
168
|
+
: undefined,
|
|
165
169
|
nodes
|
|
166
170
|
};
|
|
167
171
|
}
|
|
@@ -217,7 +221,7 @@ function collectRelationsByChildLayerId(relations, layersById, collectionIdOf) {
|
|
|
217
221
|
function collectValueRelationsByLayerId(layers, layersById, collectionIdOf) {
|
|
218
222
|
const byLayerId = new Map();
|
|
219
223
|
for (const layer of layers) {
|
|
220
|
-
const relations =
|
|
224
|
+
const relations = nameRecord();
|
|
221
225
|
for (const [field, widget] of Object.entries(layer.fieldValueRelations)) {
|
|
222
226
|
const lookup = findValueRelationLookup(widget, layers, layersById);
|
|
223
227
|
if (lookup)
|
|
@@ -639,7 +643,7 @@ function buildAssets(layer, geometryFilter) {
|
|
|
639
643
|
* one of them takes a disambiguated key instead of replacing it.
|
|
640
644
|
*/
|
|
641
645
|
function buildStyleAssets(layer, projectPath, existing) {
|
|
642
|
-
const assets =
|
|
646
|
+
const assets = nameRecord();
|
|
643
647
|
// The first style with a renderer is the default — the active one, unless
|
|
644
648
|
// QGIS wrote no renderer for it. Marked rather than left to its position,
|
|
645
649
|
// because a style named `2024` takes an asset key JavaScript enumerates
|
|
@@ -774,7 +778,7 @@ function unionExtent(layers, layerWgs84Extents) {
|
|
|
774
778
|
* exist": this means a hidden WFS layer's schema is fully visible to the
|
|
775
779
|
* dev panel and to STAC clients before any data is fetched.
|
|
776
780
|
*/
|
|
777
|
-
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps =
|
|
781
|
+
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps = nameRecord(), fieldAttachments = nameRecord(), fieldEditRules = nameRecord(), fieldValueRelations = nameRecord(), formLayout = null, fieldIcons = nameRecord(), fieldControls = nameRecord(), fieldComments = nameRecord()) {
|
|
778
782
|
const observedTypes = new Map();
|
|
779
783
|
const orderedFieldNames = [];
|
|
780
784
|
const seen = new Set();
|
|
@@ -902,15 +906,26 @@ function defaultToJson(defaultValue) {
|
|
|
902
906
|
case 'fixed': return { kind: 'fixed', value: defaultValue.value, on_update: defaultValue.onUpdate };
|
|
903
907
|
}
|
|
904
908
|
}
|
|
909
|
+
/**
|
|
910
|
+
* Whether an Attachment widget's default folder is a path relative to the
|
|
911
|
+
* project, and not a path on the computer that saved it, such as
|
|
912
|
+
* `/srv/photos`, `C:\\Survey` or `~/photos`, a network share or an address.
|
|
913
|
+
* QGIS's folder picker saves an absolute path, which would publish the
|
|
914
|
+
* computer's folder names.
|
|
915
|
+
*/
|
|
916
|
+
export function isProjectRelativeFolder(folder) {
|
|
917
|
+
return !/^(?:[/\\~]|[A-Za-z][A-Za-z0-9+.-]*:)/.test(folder.trim());
|
|
918
|
+
}
|
|
905
919
|
/**
|
|
906
920
|
* A field's Attachment widget as `quac:attachment` stores it. A member
|
|
907
|
-
* the source said nothing about is left off rather than written null
|
|
921
|
+
* the source said nothing about is left off rather than written null, and a
|
|
922
|
+
* default folder that is not relative to the project is left off.
|
|
908
923
|
*/
|
|
909
924
|
function attachmentToJson(attachment) {
|
|
910
925
|
return {
|
|
911
926
|
...(attachment.viewer ? { viewer: attachment.viewer } : {}),
|
|
912
927
|
...(attachment.filter ? { filter: attachment.filter } : {}),
|
|
913
|
-
...(attachment.defaultRoot ? { default_root: attachment.defaultRoot } : {}),
|
|
928
|
+
...(attachment.defaultRoot && isProjectRelativeFolder(attachment.defaultRoot) ? { default_root: attachment.defaultRoot } : {}),
|
|
914
929
|
relative_storage: attachment.relativeStorage
|
|
915
930
|
};
|
|
916
931
|
}
|
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, readCollectionAddedMessage, 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, readCataloguePrintLayouts, 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';
|
|
@@ -49,7 +49,8 @@ export type { ArcgisStacCatalogueOptions } from './generate/arcgisStacCatalogue.
|
|
|
49
49
|
export { normalizeExternalStacCatalogue, parseWfsGetFeatureUrl, resolveWfsCollectionSource } from './generate/externalStacCatalogue.ts';
|
|
50
50
|
export { decodeItemRowId, describeItem, encodeItemRowId, itemAsCollection, ITEMS_PAGE_SIZE, readItemsHref, readItemTimestamp, sortItemsNewestFirst } from './sources/stacItems.ts';
|
|
51
51
|
export { stripQgisServerQuery } from './sources/qgisServerUrl.ts';
|
|
52
|
-
export type {
|
|
52
|
+
export type { PrintLayoutTemplate } from './model/QgsProject.ts';
|
|
53
|
+
export type { WmsProject, WmsLayerTreeNode, WmsLayer, WmsLayerGroup, WmsBoundingBox, WmsStyle, WmsAttribute, WmsPrintLayout, WmsPrintLayoutMap } from './model/WmsProject.ts';
|
|
53
54
|
export { parseGetProjectSettings } from './parse/parseGetProjectSettings.ts';
|
|
54
55
|
export { generateStacCatalogueFromWms } from './generate/wmsStacCatalogue.ts';
|
|
55
56
|
export type { WmsStacCatalogueOptions } from './generate/wmsStacCatalogue.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, readCollectionAddedMessage, 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, readCataloguePrintLayouts, 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";
|
|
@@ -66,9 +66,19 @@ export interface QgsProject {
|
|
|
66
66
|
* notes are not written into the catalogue.
|
|
67
67
|
*/
|
|
68
68
|
notes?: ProjectNote[];
|
|
69
|
+
/**
|
|
70
|
+
* The project's print layouts, in its order (`parsePrintLayouts`); absent or
|
|
71
|
+
* empty where it has none.
|
|
72
|
+
*/
|
|
73
|
+
printLayouts?: PrintLayoutTemplate[];
|
|
69
74
|
/** Original full QGS XML, retained so future parsers can re-mine without re-loading. */
|
|
70
75
|
rawXml: string | null;
|
|
71
76
|
}
|
|
77
|
+
/** A print layout as its name and its `<Layout>` element, which is a QGIS layout template. */
|
|
78
|
+
export interface PrintLayoutTemplate {
|
|
79
|
+
name: string;
|
|
80
|
+
template: string;
|
|
81
|
+
}
|
|
72
82
|
/**
|
|
73
83
|
* Why a project's setting is not in its catalogue:
|
|
74
84
|
*
|
|
@@ -22,9 +22,40 @@ export interface WmsProject {
|
|
|
22
22
|
layerTree: WmsLayerTreeNode[];
|
|
23
23
|
/** Names of layers exposed via WFS (subset of the layer tree). */
|
|
24
24
|
wfsLayerNames: string[];
|
|
25
|
+
/** The print layouts the server can print with GetPrint, in the order it lists them. */
|
|
26
|
+
printLayouts: WmsPrintLayout[];
|
|
25
27
|
/** Full source XML, retained so future enhancements can re-mine. */
|
|
26
28
|
rawXml: string | null;
|
|
27
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A print layout as GetProjectSettings lists it, in `<ComposerTemplates>`
|
|
32
|
+
* (`getComposerTemplatesElement`, `src/server/services/wms/qgswmsgetcapabilities.cpp`,
|
|
33
|
+
* `qgis/QGIS@master`, read 2026-11-25). Sizes are in millimetres.
|
|
34
|
+
*/
|
|
35
|
+
export interface WmsPrintLayout {
|
|
36
|
+
/** The layout's name: GetPrint's `TEMPLATE`. */
|
|
37
|
+
name: string;
|
|
38
|
+
/** The first page's width. */
|
|
39
|
+
width: number;
|
|
40
|
+
/** The first page's height. */
|
|
41
|
+
height: number;
|
|
42
|
+
/** Whether the layout's atlas is on: GetPrint's `ATLAS_PK` then prints chosen features. */
|
|
43
|
+
isAtlasEnabled: boolean;
|
|
44
|
+
/** The atlas's coverage layer, by the name GetPrint's `LAYERS` uses; null when none is listed. */
|
|
45
|
+
atlasCoverageLayer: string | null;
|
|
46
|
+
/** The layout's map items. */
|
|
47
|
+
maps: WmsPrintLayoutMap[];
|
|
48
|
+
/** The IDs of the layout's labels; a label with no ID is not listed. */
|
|
49
|
+
labelIds: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface WmsPrintLayoutMap {
|
|
52
|
+
/** The map item's name in GetPrint parameters, such as `map0` in `map0:EXTENT`. */
|
|
53
|
+
name: string;
|
|
54
|
+
/** The map item's name in the layout, as QGIS shows it. */
|
|
55
|
+
itemName: string;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
}
|
|
28
59
|
export interface WmsBoundingBox {
|
|
29
60
|
westBoundLongitude: number;
|
|
30
61
|
eastBoundLongitude: number;
|
|
@@ -23,5 +23,9 @@ export declare function resolveFieldIconAddress(value: string): string | null;
|
|
|
23
23
|
* name `@latest` or an exact release.
|
|
24
24
|
*/
|
|
25
25
|
export declare function isIconLibraryAddress(url: string): boolean;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The address as the URL parser writes it, or null where it is not an
|
|
28
|
+
* `https://` address or holds a user name or password, which a catalogue
|
|
29
|
+
* would otherwise publish.
|
|
30
|
+
*/
|
|
27
31
|
export declare function readHttpsAddress(value: unknown): string | null;
|
|
@@ -79,13 +79,17 @@ export function isIconLibraryAddress(url) {
|
|
|
79
79
|
const rest = url.slice(JSDELIVR_NPM.length);
|
|
80
80
|
return Object.values(ICON_LIBRARIES).some((library) => rest.startsWith(`${library.packageName}@`) || rest.startsWith(`${library.packageName}/`));
|
|
81
81
|
}
|
|
82
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The address as the URL parser writes it, or null where it is not an
|
|
84
|
+
* `https://` address or holds a user name or password, which a catalogue
|
|
85
|
+
* would otherwise publish.
|
|
86
|
+
*/
|
|
83
87
|
export function readHttpsAddress(value) {
|
|
84
88
|
if (typeof value !== 'string')
|
|
85
89
|
return null;
|
|
86
90
|
try {
|
|
87
91
|
const url = new URL(value.trim());
|
|
88
|
-
return url.protocol === 'https:' ? url.href : null;
|
|
92
|
+
return url.protocol === 'https:' && !url.username && !url.password ? url.href : null;
|
|
89
93
|
}
|
|
90
94
|
catch {
|
|
91
95
|
return null;
|
|
@@ -5,8 +5,9 @@ import type { WmsProject } from '../model/WmsProject.ts';
|
|
|
5
5
|
*
|
|
6
6
|
* The response is a WMS_Capabilities document with QGIS-specific extensions
|
|
7
7
|
* for `displayField`, `geometryType`, `visibilityChecked`, `<Attributes>`
|
|
8
|
-
* and `<
|
|
9
|
-
* generation and ignore what isn't (e.g.
|
|
8
|
+
* `<WFSLayers>` and `<ComposerTemplates>`. We capture what's useful for STAC +
|
|
9
|
+
* app-config generation and for printing a layout, and ignore what isn't (e.g.
|
|
10
|
+
* GetMap / GetPrint format lists).
|
|
10
11
|
*
|
|
11
12
|
* Throws when the XML is unparseable or has the wrong root element.
|
|
12
13
|
* Sub-elements that fail to parse log via devLog and yield null/empty
|
|
@@ -5,8 +5,9 @@ import { devLog } from "../util/devLog.js";
|
|
|
5
5
|
*
|
|
6
6
|
* The response is a WMS_Capabilities document with QGIS-specific extensions
|
|
7
7
|
* for `displayField`, `geometryType`, `visibilityChecked`, `<Attributes>`
|
|
8
|
-
* and `<
|
|
9
|
-
* generation and ignore what isn't (e.g.
|
|
8
|
+
* `<WFSLayers>` and `<ComposerTemplates>`. We capture what's useful for STAC +
|
|
9
|
+
* app-config generation and for printing a layout, and ignore what isn't (e.g.
|
|
10
|
+
* GetMap / GetPrint format lists).
|
|
10
11
|
*
|
|
11
12
|
* Throws when the XML is unparseable or has the wrong root element.
|
|
12
13
|
* Sub-elements that fail to parse log via devLog and yield null/empty
|
|
@@ -38,10 +39,13 @@ export function parseGetProjectSettings(xmlText) {
|
|
|
38
39
|
const wfsLayerNames = Array.from(capability?.querySelectorAll(':scope > WFSLayers > WFSLayer') ?? [])
|
|
39
40
|
.map((node) => node.getAttribute('name'))
|
|
40
41
|
.filter((name) => Boolean(name));
|
|
42
|
+
const printLayouts = Array.from(capability?.querySelectorAll(':scope > ComposerTemplates > ComposerTemplate') ?? [])
|
|
43
|
+
.map(parsePrintLayout);
|
|
41
44
|
devLog('qgs/parseGetProjectSettings', 'parsed WMS project', {
|
|
42
45
|
title,
|
|
43
46
|
rootLayerCount: layerTree.length,
|
|
44
|
-
wfsLayerCount: wfsLayerNames.length
|
|
47
|
+
wfsLayerCount: wfsLayerNames.length,
|
|
48
|
+
printLayoutCount: printLayouts.length
|
|
45
49
|
});
|
|
46
50
|
return {
|
|
47
51
|
title,
|
|
@@ -49,9 +53,29 @@ export function parseGetProjectSettings(xmlText) {
|
|
|
49
53
|
bbox: projectBbox,
|
|
50
54
|
layerTree,
|
|
51
55
|
wfsLayerNames,
|
|
56
|
+
printLayouts,
|
|
52
57
|
rawXml: xmlText
|
|
53
58
|
};
|
|
54
59
|
}
|
|
60
|
+
function parsePrintLayout(element) {
|
|
61
|
+
const maps = Array.from(element.querySelectorAll(':scope > ComposerMap')).map((map) => ({
|
|
62
|
+
name: map.getAttribute('name') ?? '',
|
|
63
|
+
itemName: map.getAttribute('itemName') ?? '',
|
|
64
|
+
width: Number(map.getAttribute('width')) || 0,
|
|
65
|
+
height: Number(map.getAttribute('height')) || 0
|
|
66
|
+
}));
|
|
67
|
+
return {
|
|
68
|
+
name: element.getAttribute('name') ?? '',
|
|
69
|
+
width: Number(element.getAttribute('width')) || 0,
|
|
70
|
+
height: Number(element.getAttribute('height')) || 0,
|
|
71
|
+
isAtlasEnabled: element.getAttribute('atlasEnabled') === '1',
|
|
72
|
+
atlasCoverageLayer: element.getAttribute('atlasCoverageLayer') || null,
|
|
73
|
+
maps,
|
|
74
|
+
labelIds: Array.from(element.querySelectorAll(':scope > ComposerLabel'))
|
|
75
|
+
.map((label) => label.getAttribute('name') ?? '')
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
55
79
|
function bboxOf(node) {
|
|
56
80
|
return node.kind === 'layer' ? node.bbox : node.bbox;
|
|
57
81
|
}
|
|
@@ -6,6 +6,7 @@ import { parseLayerStyles } from "./parseStyle.js";
|
|
|
6
6
|
import { readQgisExpression, unescapeStringLiteral } from "./qgisExpression.js";
|
|
7
7
|
import { resolveFieldIconAddress } from "../model/fieldIconAddress.js";
|
|
8
8
|
import { devLog } from "../util/devLog.js";
|
|
9
|
+
import { nameRecord } from "../util/nameRecord.js";
|
|
9
10
|
/**
|
|
10
11
|
* Parses the <projectlayers> block into a list of LayerEntry. Annotation
|
|
11
12
|
* layers (<main-annotation-layer>) are filtered out — they're QGIS's drawing
|
|
@@ -310,7 +311,7 @@ const VALUE_MAP_NULL_CODE = '{2839923C-8B7D-419E-B84B-CA2FE9B80EC7}';
|
|
|
310
311
|
* returned map.
|
|
311
312
|
*/
|
|
312
313
|
function parseFieldValueMaps(maplayer) {
|
|
313
|
-
const result =
|
|
314
|
+
const result = nameRecord();
|
|
314
315
|
for (const [name, editWidget] of layerEditWidgets(maplayer)) {
|
|
315
316
|
if (result[name])
|
|
316
317
|
continue;
|
|
@@ -365,7 +366,7 @@ function parseFieldValueMaps(maplayer) {
|
|
|
365
366
|
* A field with no ValueRelation widget is absent from the returned map.
|
|
366
367
|
*/
|
|
367
368
|
function parseFieldValueRelations(maplayer) {
|
|
368
|
-
const result =
|
|
369
|
+
const result = nameRecord();
|
|
369
370
|
for (const [name, editWidget] of layerEditWidgets(maplayer)) {
|
|
370
371
|
if (result[name])
|
|
371
372
|
continue;
|
|
@@ -441,7 +442,7 @@ const SINGLE_FILE_STORAGE_MODES = new Set([0, 3]);
|
|
|
441
442
|
* A field with no ExternalResource widget is absent from the returned map.
|
|
442
443
|
*/
|
|
443
444
|
function parseFieldAttachments(maplayer) {
|
|
444
|
-
const result =
|
|
445
|
+
const result = nameRecord();
|
|
445
446
|
for (const [name, editWidget] of layerEditWidgets(maplayer)) {
|
|
446
447
|
if (result[name])
|
|
447
448
|
continue;
|
|
@@ -499,7 +500,7 @@ const NOW_EXPRESSIONS = new Set(['now()', '$now', 'to_date(now())', 'to_datetime
|
|
|
499
500
|
* settings is absent from the returned map.
|
|
500
501
|
*/
|
|
501
502
|
function parseFieldEditRules(maplayer, note) {
|
|
502
|
-
const result =
|
|
503
|
+
const result = nameRecord();
|
|
503
504
|
const ruleFor = (name) => {
|
|
504
505
|
result[name] ??= { readOnly: false, defaultValue: null, notNull: null, unique: null, hidden: false, reuseLastValue: false, duplicatePolicy: null };
|
|
505
506
|
return result[name];
|
|
@@ -912,7 +913,7 @@ function parseFieldNames(maplayer) {
|
|
|
912
913
|
* per field, which is the active-style block's when both are present.
|
|
913
914
|
*/
|
|
914
915
|
function parseFieldAliases(maplayer) {
|
|
915
|
-
const out =
|
|
916
|
+
const out = nameRecord();
|
|
916
917
|
const nodes = maplayer.querySelectorAll('aliases > alias');
|
|
917
918
|
for (const node of Array.from(nodes)) {
|
|
918
919
|
const field = node.getAttribute('field');
|
|
@@ -938,7 +939,7 @@ function parseFieldAliases(maplayer) {
|
|
|
938
939
|
* entries name a field, the later stands, as QGIS's map of them keeps it.
|
|
939
940
|
*/
|
|
940
941
|
function parseFieldComments(maplayer) {
|
|
941
|
-
const out =
|
|
942
|
+
const out = nameRecord();
|
|
942
943
|
for (const node of directChild(maplayer, 'customComments')?.querySelectorAll(':scope > customComment') ?? []) {
|
|
943
944
|
const field = node.getAttribute('field');
|
|
944
945
|
if (!field)
|
|
@@ -982,7 +983,7 @@ const FIELD_ICON_VARIABLE_PREFIX = 'quac_icon_';
|
|
|
982
983
|
* 2026-10-25).
|
|
983
984
|
*/
|
|
984
985
|
function parseFieldIcons(maplayer) {
|
|
985
|
-
const icons =
|
|
986
|
+
const icons = nameRecord();
|
|
986
987
|
for (const [field, value] of readFieldVariables(maplayer, FIELD_ICON_VARIABLE_PREFIX)) {
|
|
987
988
|
const address = resolveFieldIconAddress(value);
|
|
988
989
|
if (address)
|
|
@@ -1034,7 +1035,7 @@ const FIELD_CONTROL_VARIABLE_PREFIX = 'quac_control_';
|
|
|
1034
1035
|
* out.
|
|
1035
1036
|
*/
|
|
1036
1037
|
function parseFieldControls(maplayer) {
|
|
1037
|
-
const controls =
|
|
1038
|
+
const controls = nameRecord();
|
|
1038
1039
|
for (const [field, value] of readFieldVariables(maplayer, FIELD_CONTROL_VARIABLE_PREFIX)) {
|
|
1039
1040
|
const control = value.trim().toLowerCase();
|
|
1040
1041
|
if (control === 'buttons' || control === 'dropdown')
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PrintLayoutTemplate } from '../model/QgsProject.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The project's print layouts, from `<qgis><Layouts>`, each as its name and its
|
|
4
|
+
* `<Layout>` element written out by `writeLayoutTemplate`. That element is what
|
|
5
|
+
* QGIS saves as a layout template (`.qpt`): `QgsLayout::saveAsTemplate` writes
|
|
6
|
+
* the same `writeXml` element as the only element of the file
|
|
7
|
+
* (`src/core/layout/qgslayout.cpp`, `qgis/QGIS@master`, read 2026-11-25).
|
|
8
|
+
*
|
|
9
|
+
* A layout whose name the project leaves out of WMS, under Project Properties →
|
|
10
|
+
* QGIS Server → WMS capabilities → **Exclude layouts**, saved as
|
|
11
|
+
* `WMSRestrictedComposers` (`QgsServerProjectUtils::wmsRestrictedComposers`,
|
|
12
|
+
* `src/server/qgsserverprojectutils.cpp`, same revision), is left out, as its
|
|
13
|
+
* excluded layers are. Reports are not read.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parsePrintLayouts(qgisRoot: Element): PrintLayoutTemplate[];
|
|
16
|
+
/**
|
|
17
|
+
* A layout element as XML text, written by one fixed rule so that the
|
|
18
|
+
* plugin's Python writes the same text: attributes in the order the document
|
|
19
|
+
* holds them, an element with no children closed as `<name/>`, text that is
|
|
20
|
+
* only white space left out, comments and processing instructions left out,
|
|
21
|
+
* and `&`, `<`, `>` escaped everywhere, with `"`, tab, line feed and carriage
|
|
22
|
+
* return escaped in attribute values too.
|
|
23
|
+
*
|
|
24
|
+
* It holds no layer's data source and no absolute path: each `SOURCE_ATTRIBUTE`
|
|
25
|
+
* is left out, and an attribute whose value is an `ABSOLUTE_PATH` is written
|
|
26
|
+
* empty.
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeLayoutTemplate(element: Element): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { propertyList } from "./projectProperties.js";
|
|
2
|
+
/**
|
|
3
|
+
* The project's print layouts, from `<qgis><Layouts>`, each as its name and its
|
|
4
|
+
* `<Layout>` element written out by `writeLayoutTemplate`. That element is what
|
|
5
|
+
* QGIS saves as a layout template (`.qpt`): `QgsLayout::saveAsTemplate` writes
|
|
6
|
+
* the same `writeXml` element as the only element of the file
|
|
7
|
+
* (`src/core/layout/qgslayout.cpp`, `qgis/QGIS@master`, read 2026-11-25).
|
|
8
|
+
*
|
|
9
|
+
* A layout whose name the project leaves out of WMS, under Project Properties →
|
|
10
|
+
* QGIS Server → WMS capabilities → **Exclude layouts**, saved as
|
|
11
|
+
* `WMSRestrictedComposers` (`QgsServerProjectUtils::wmsRestrictedComposers`,
|
|
12
|
+
* `src/server/qgsserverprojectutils.cpp`, same revision), is left out, as its
|
|
13
|
+
* excluded layers are. Reports are not read.
|
|
14
|
+
*/
|
|
15
|
+
export function parsePrintLayouts(qgisRoot) {
|
|
16
|
+
const properties = qgisRoot.querySelector(':scope > properties');
|
|
17
|
+
const restricted = new Set(properties ? propertyList(properties, 'WMSRestrictedComposers') : []);
|
|
18
|
+
return Array.from(qgisRoot.querySelectorAll(':scope > Layouts > Layout'))
|
|
19
|
+
.map((layout) => ({ name: layout.getAttribute('name') ?? '', template: writeLayoutTemplate(layout) }))
|
|
20
|
+
.filter((layout) => !restricted.has(layout.name));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An attribute QGIS writes a layer's data source or provider in: `source` and
|
|
24
|
+
* `provider` on a map item's `<Layer>`, and `coverageLayerSource`,
|
|
25
|
+
* `vectorLayerSource` and the like, which a data source's password or file
|
|
26
|
+
* path can be in.
|
|
27
|
+
*/
|
|
28
|
+
const SOURCE_ATTRIBUTE = /^(source|provider)$|(Source|Provider)$/;
|
|
29
|
+
/**
|
|
30
|
+
* A value that is a path on the computer that saved the project: from the
|
|
31
|
+
* root of a disk or a home folder (`~/`), a drive, a network share, or a
|
|
32
|
+
* `file:` address. It is narrower than `isProjectRelativeFolder`'s test of an
|
|
33
|
+
* Attachment folder, because it reads every attribute of a layout, label text
|
|
34
|
+
* included, so a value such as `Address: 12 Main St` is not taken for an
|
|
35
|
+
* address.
|
|
36
|
+
*/
|
|
37
|
+
const ABSOLUTE_PATH = /^\s*(\/|\\|~[\\/]|[A-Za-z]:([\\/]|$)|file:)/i;
|
|
38
|
+
/**
|
|
39
|
+
* A layout element as XML text, written by one fixed rule so that the
|
|
40
|
+
* plugin's Python writes the same text: attributes in the order the document
|
|
41
|
+
* holds them, an element with no children closed as `<name/>`, text that is
|
|
42
|
+
* only white space left out, comments and processing instructions left out,
|
|
43
|
+
* and `&`, `<`, `>` escaped everywhere, with `"`, tab, line feed and carriage
|
|
44
|
+
* return escaped in attribute values too.
|
|
45
|
+
*
|
|
46
|
+
* It holds no layer's data source and no absolute path: each `SOURCE_ATTRIBUTE`
|
|
47
|
+
* is left out, and an attribute whose value is an `ABSOLUTE_PATH` is written
|
|
48
|
+
* empty.
|
|
49
|
+
*/
|
|
50
|
+
export function writeLayoutTemplate(element) {
|
|
51
|
+
const attributes = Array.from(element.attributes)
|
|
52
|
+
.filter((attribute) => !SOURCE_ATTRIBUTE.test(attribute.name))
|
|
53
|
+
.map((attribute) => ` ${attribute.name}="${ABSOLUTE_PATH.test(attribute.value) ? '' : escapeAttribute(attribute.value)}"`)
|
|
54
|
+
.join('');
|
|
55
|
+
const children = Array.from(element.childNodes)
|
|
56
|
+
.map((child) => {
|
|
57
|
+
if (child.nodeType === 1)
|
|
58
|
+
return writeLayoutTemplate(child);
|
|
59
|
+
if (child.nodeType === 3 || child.nodeType === 4) {
|
|
60
|
+
const text = child.nodeValue ?? '';
|
|
61
|
+
return text.trim() === '' ? '' : escapeText(text);
|
|
62
|
+
}
|
|
63
|
+
return '';
|
|
64
|
+
})
|
|
65
|
+
.join('');
|
|
66
|
+
return children === ''
|
|
67
|
+
? `<${element.tagName}${attributes}/>`
|
|
68
|
+
: `<${element.tagName}${attributes}>${children}</${element.tagName}>`;
|
|
69
|
+
}
|
|
70
|
+
function escapeText(text) {
|
|
71
|
+
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
72
|
+
}
|
|
73
|
+
function escapeAttribute(value) {
|
|
74
|
+
return escapeText(value)
|
|
75
|
+
.replace(/"/g, '"')
|
|
76
|
+
.replace(/\t/g, '	')
|
|
77
|
+
.replace(/\n/g, ' ')
|
|
78
|
+
.replace(/\r/g, ' ');
|
|
79
|
+
}
|
|
@@ -5,6 +5,7 @@ import { parseProjectLayers } from "./parseLayers.js";
|
|
|
5
5
|
import { parseLegendTree } from "./parseLegendTree.js";
|
|
6
6
|
import { parseProjectMeasurement } from "./parseMeasurement.js";
|
|
7
7
|
import { parseMerginFilters } from "./parseMergin.js";
|
|
8
|
+
import { parsePrintLayouts } from "./parsePrintLayouts.js";
|
|
8
9
|
import { parseProjectVariables } from "./parseProjectVariables.js";
|
|
9
10
|
import { parseInitialActiveLayerId, parseWfsTransactionLayers } from "./parseQfieldSync.js";
|
|
10
11
|
import { parseProjectRelations } from "./parseRelations.js";
|
|
@@ -88,6 +89,7 @@ export function parseQgsXml(xmlText) {
|
|
|
88
89
|
wmsCrsList: parseWmsCrsList(qgisRoot),
|
|
89
90
|
merginFilters,
|
|
90
91
|
notes,
|
|
92
|
+
printLayouts: parsePrintLayouts(qgisRoot),
|
|
91
93
|
rawXml: xmlText
|
|
92
94
|
};
|
|
93
95
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An empty record to file values by a name a project gives, such as a field's
|
|
3
|
+
* or a style's, with no properties of its own to inherit: a field named
|
|
4
|
+
* `__proto__` is then a key like any other rather than the record's
|
|
5
|
+
* prototype, and one named `constructor` reads as absent until it is set.
|
|
6
|
+
*/
|
|
7
|
+
export declare function nameRecord<T>(): Record<string, T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An empty record to file values by a name a project gives, such as a field's
|
|
3
|
+
* or a style's, with no properties of its own to inherit: a field named
|
|
4
|
+
* `__proto__` is then a key like any other rather than the record's
|
|
5
|
+
* prototype, and one named `constructor` reads as absent until it is set.
|
|
6
|
+
*/
|
|
7
|
+
export function nameRecord() {
|
|
8
|
+
return Object.create(null);
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -79,6 +79,20 @@
|
|
|
79
79
|
"maxItems": 4,
|
|
80
80
|
"items": { "type": "number" }
|
|
81
81
|
},
|
|
82
|
+
"quac:print_layouts": {
|
|
83
|
+
"description": "On the top-level Catalog: the source's print layouts, in its order, each as its name and its QGIS layout template, the <Layout> element that QGIS saves in a .qpt file. Written from a QGIS project's Layout Manager, less any layout that its QGIS Server settings exclude.",
|
|
84
|
+
"type": "array",
|
|
85
|
+
"minItems": 1,
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"required": ["name", "template"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"name": { "type": "string" },
|
|
91
|
+
"template": { "type": "string", "pattern": "^<Layout[ />]" }
|
|
92
|
+
},
|
|
93
|
+
"additionalProperties": false
|
|
94
|
+
}
|
|
95
|
+
},
|
|
82
96
|
"quac:visibility_checked": {
|
|
83
97
|
"description": "On a group: whether the group opens switched on. In a catalogue of basemaps, true marks the basemap that is shown first, and false keeps a group hidden.",
|
|
84
98
|
"type": "boolean"
|