@vectoriahq/quac 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +35 -2
- package/dist/generate/arcgisStacCatalogue.d.ts +46 -0
- package/dist/generate/arcgisStacCatalogue.js +189 -0
- package/dist/generate/externalStacCatalogue.d.ts +53 -0
- package/dist/generate/externalStacCatalogue.js +143 -0
- package/dist/generate/fileLayerCollection.d.ts +44 -0
- package/dist/generate/fileLayerCollection.js +72 -0
- package/dist/generate/folderStacCatalogue.d.ts +48 -0
- package/dist/generate/folderStacCatalogue.js +69 -0
- package/dist/generate/normalizedProject.d.ts +452 -0
- package/dist/generate/normalizedProject.js +877 -0
- package/dist/generate/ogcFeaturesStacCatalogue.d.ts +49 -0
- package/dist/generate/ogcFeaturesStacCatalogue.js +207 -0
- package/dist/generate/qmlForLayer.d.ts +17 -0
- package/dist/generate/qmlForLayer.js +36 -0
- package/dist/generate/serverLayerTree.d.ts +44 -0
- package/dist/generate/serverLayerTree.js +50 -0
- package/dist/generate/serverStacCatalogue.d.ts +84 -0
- package/dist/generate/serverStacCatalogue.js +327 -0
- package/dist/generate/stacCatalogue.d.ts +110 -0
- package/dist/generate/stacCatalogue.js +887 -0
- package/dist/generate/wfsStacCatalogue.d.ts +37 -0
- package/dist/generate/wfsStacCatalogue.js +127 -0
- package/dist/generate/wmsStacCatalogue.d.ts +46 -0
- package/dist/generate/wmsStacCatalogue.js +229 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +52 -0
- package/dist/model/QgsProject.d.ts +724 -0
- package/dist/model/QgsProject.js +15 -0
- package/dist/model/Stac.d.ts +322 -0
- package/dist/model/Stac.js +16 -0
- package/dist/model/WmsProject.d.ts +105 -0
- package/dist/model/WmsProject.js +1 -0
- package/dist/model/arcgis.d.ts +134 -0
- package/dist/model/arcgis.js +1 -0
- package/dist/model/delimitedText.d.ts +38 -0
- package/dist/model/delimitedText.js +46 -0
- package/dist/model/featureFilter.d.ts +41 -0
- package/dist/model/featureFilter.js +24 -0
- package/dist/model/fieldIconAddress.d.ts +27 -0
- package/dist/model/fieldIconAddress.js +93 -0
- package/dist/model/ogcFeatures.d.ts +40 -0
- package/dist/model/ogcFeatures.js +6 -0
- package/dist/model/quacExtension.d.ts +28 -0
- package/dist/model/quacExtension.js +75 -0
- package/dist/model/stacAssetRoles.d.ts +33 -0
- package/dist/model/stacAssetRoles.js +44 -0
- package/dist/model/stacCollectionNotes.d.ts +21 -0
- package/dist/model/stacCollectionNotes.js +44 -0
- package/dist/model/stacHref.d.ts +56 -0
- package/dist/model/stacHref.js +93 -0
- package/dist/model/stacPmtiles.d.ts +38 -0
- package/dist/model/stacPmtiles.js +69 -0
- package/dist/model/stacSizeAndCount.d.ts +14 -0
- package/dist/model/stacSizeAndCount.js +20 -0
- package/dist/model/stacStyles.d.ts +93 -0
- package/dist/model/stacStyles.js +87 -0
- package/dist/model/stacTreeWalk.d.ts +36 -0
- package/dist/model/stacTreeWalk.js +76 -0
- package/dist/model/stacWms.d.ts +18 -0
- package/dist/model/stacWms.js +73 -0
- package/dist/model/stacWmts.d.ts +34 -0
- package/dist/model/stacWmts.js +90 -0
- package/dist/model/stacXyz.d.ts +24 -0
- package/dist/model/stacXyz.js +46 -0
- package/dist/model/wfs.d.ts +136 -0
- package/dist/model/wfs.js +1 -0
- package/dist/parse/collectLayerVisibility.d.ts +10 -0
- package/dist/parse/collectLayerVisibility.js +22 -0
- package/dist/parse/customProperties.d.ts +18 -0
- package/dist/parse/customProperties.js +43 -0
- package/dist/parse/geometrySiblings.d.ts +25 -0
- package/dist/parse/geometrySiblings.js +83 -0
- package/dist/parse/parseBrandColour.d.ts +14 -0
- package/dist/parse/parseBrandColour.js +25 -0
- package/dist/parse/parseDataDefinedEditable.d.ts +38 -0
- package/dist/parse/parseDataDefinedEditable.js +76 -0
- package/dist/parse/parseDataSource.d.ts +53 -0
- package/dist/parse/parseDataSource.js +484 -0
- package/dist/parse/parseExtent.d.ts +17 -0
- package/dist/parse/parseExtent.js +49 -0
- package/dist/parse/parseFormLayout.d.ts +26 -0
- package/dist/parse/parseFormLayout.js +60 -0
- package/dist/parse/parseGetProjectSettings.d.ts +15 -0
- package/dist/parse/parseGetProjectSettings.js +172 -0
- package/dist/parse/parseLayers.d.ts +23 -0
- package/dist/parse/parseLayers.js +1125 -0
- package/dist/parse/parseLegendTree.d.ts +20 -0
- package/dist/parse/parseLegendTree.js +66 -0
- package/dist/parse/parseMeasurement.d.ts +20 -0
- package/dist/parse/parseMeasurement.js +66 -0
- package/dist/parse/parseMergin.d.ts +19 -0
- package/dist/parse/parseMergin.js +51 -0
- package/dist/parse/parseProjectVariables.d.ts +9 -0
- package/dist/parse/parseProjectVariables.js +19 -0
- package/dist/parse/parseQfieldSync.d.ts +47 -0
- package/dist/parse/parseQfieldSync.js +95 -0
- package/dist/parse/parseQgsXml.d.ts +15 -0
- package/dist/parse/parseQgsXml.js +100 -0
- package/dist/parse/parseRelations.d.ts +19 -0
- package/dist/parse/parseRelations.js +64 -0
- package/dist/parse/parseStyle.d.ts +33 -0
- package/dist/parse/parseStyle.js +128 -0
- package/dist/parse/parseWmsPublishing.d.ts +21 -0
- package/dist/parse/parseWmsPublishing.js +38 -0
- package/dist/parse/projectProperties.d.ts +15 -0
- package/dist/parse/projectProperties.js +27 -0
- package/dist/parse/qgisExpression.d.ts +194 -0
- package/dist/parse/qgisExpression.js +859 -0
- package/dist/parse/qtDateFormat.d.ts +74 -0
- package/dist/parse/qtDateFormat.js +324 -0
- package/dist/parse/qtRegex.d.ts +67 -0
- package/dist/parse/qtRegex.js +397 -0
- package/dist/parse/readProjectFile.d.ts +7 -0
- package/dist/parse/readProjectFile.js +27 -0
- package/dist/sources/qgisServerUrl.d.ts +6 -0
- package/dist/sources/qgisServerUrl.js +17 -0
- package/dist/sources/stacDocuments.d.ts +40 -0
- package/dist/sources/stacDocuments.js +85 -0
- package/dist/sources/stacItems.d.ts +109 -0
- package/dist/sources/stacItems.js +287 -0
- package/dist/util/catalogueFileFormats.d.ts +58 -0
- package/dist/util/catalogueFileFormats.js +64 -0
- package/dist/util/devLog.d.ts +10 -0
- package/dist/util/devLog.js +22 -0
- package/dist/util/fileName.d.ts +18 -0
- package/dist/util/fileName.js +45 -0
- package/dist/util/nonBlankText.d.ts +2 -0
- package/dist/util/nonBlankText.js +4 -0
- package/dist/util/wfsVersions.d.ts +9 -0
- package/dist/util/wfsVersions.js +13 -0
- package/package.json +55 -4
- package/src/schema/quac.schema.json +939 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { parseDataDefinedEditable } from "./parseDataDefinedEditable.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reads a layer's Drag and Drop Designer form: the fields its `<attributeEditorForm>`
|
|
4
|
+
* tree places, in the tree's order, each with the visibility expressions of the
|
|
5
|
+
* containers around it.
|
|
6
|
+
*
|
|
7
|
+
* QGIS saves the tree under every layer but uses it only where `<editorlayout>`
|
|
8
|
+
* is `tablayout` (`QgsEditFormConfig::readXml`, `src/core/editform/qgseditformconfig.cpp`,
|
|
9
|
+
* `qgis/QGIS@master`, read 2026-10-24), so any other layout reads as none. A
|
|
10
|
+
* `tablayout` whose tree is empty reads as none too: `readXml` then leaves the
|
|
11
|
+
* tree to `setFields`, which places every field.
|
|
12
|
+
*
|
|
13
|
+
* Only `<attributeEditorContainer>` (tab, group box and row alike) and
|
|
14
|
+
* `<attributeEditorField>` are read. A container's expression counts only when
|
|
15
|
+
* its `visibilityExpressionEnabled` is non-zero and its `visibilityExpression`
|
|
16
|
+
* is not blank, as `QgsAttributeEditorContainer::loadConfiguration` reads them.
|
|
17
|
+
* The expression is kept as written, readable or not. Relation, action, text,
|
|
18
|
+
* HTML, QML and spacer elements are skipped, as are collapsed expressions,
|
|
19
|
+
* titles, columns and label styles. A field placed twice keeps its first place.
|
|
20
|
+
*
|
|
21
|
+
* A placed field also carries its active data-defined Editable property as
|
|
22
|
+
* `editableWhen` (`parseDataDefinedEditable`). QGIS registers it only for a field
|
|
23
|
+
* in this form, so a field the tree does not place, and every field of a layer
|
|
24
|
+
* with no layout read, has none.
|
|
25
|
+
*/
|
|
26
|
+
export function parseFormLayout(maplayer) {
|
|
27
|
+
const layout = Array.from(maplayer.children).find((child) => child.tagName === 'editorlayout');
|
|
28
|
+
if (layout?.textContent?.trim() !== 'tablayout')
|
|
29
|
+
return null;
|
|
30
|
+
const form = Array.from(maplayer.children).find((child) => child.tagName === 'attributeEditorForm');
|
|
31
|
+
if (!form || form.children.length === 0)
|
|
32
|
+
return null;
|
|
33
|
+
const fields = [];
|
|
34
|
+
const placed = new Set();
|
|
35
|
+
collectFields(form, [], fields, placed);
|
|
36
|
+
const editable = parseDataDefinedEditable(maplayer);
|
|
37
|
+
return {
|
|
38
|
+
fields: fields.map((field) => {
|
|
39
|
+
const editableWhen = editable.get(field.name);
|
|
40
|
+
return editableWhen ? { ...field, editableWhen } : field;
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function collectFields(parent, visibleWhen, fields, placed) {
|
|
45
|
+
for (const child of Array.from(parent.children)) {
|
|
46
|
+
if (child.tagName === 'attributeEditorField') {
|
|
47
|
+
const name = child.getAttribute('name')?.trim();
|
|
48
|
+
if (!name || placed.has(name))
|
|
49
|
+
continue;
|
|
50
|
+
placed.add(name);
|
|
51
|
+
fields.push({ name, visibleWhen });
|
|
52
|
+
}
|
|
53
|
+
else if (child.tagName === 'attributeEditorContainer') {
|
|
54
|
+
const expression = child.getAttribute('visibilityExpression')?.trim();
|
|
55
|
+
const enabled = Number.parseInt(child.getAttribute('visibilityExpressionEnabled') ?? '', 10);
|
|
56
|
+
const inside = expression && Number.isFinite(enabled) && enabled !== 0 ? [...visibleWhen, expression] : visibleWhen;
|
|
57
|
+
collectFields(child, inside, fields, placed);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WmsProject } from '../model/WmsProject.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a QGIS Server WMS GetProjectSettings XML response into a typed
|
|
4
|
+
* WmsProject model.
|
|
5
|
+
*
|
|
6
|
+
* The response is a WMS_Capabilities document with QGIS-specific extensions
|
|
7
|
+
* for `displayField`, `geometryType`, `visibilityChecked`, `<Attributes>`
|
|
8
|
+
* and `<WFSLayers>`. We capture what's useful for STAC + app-config
|
|
9
|
+
* generation and ignore what isn't (e.g. GetMap / GetPrint format lists).
|
|
10
|
+
*
|
|
11
|
+
* Throws when the XML is unparseable or has the wrong root element.
|
|
12
|
+
* Sub-elements that fail to parse log via devLog and yield null/empty
|
|
13
|
+
* rather than tripping the whole project.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseGetProjectSettings(xmlText: string): WmsProject;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { devLog } from "../util/devLog.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parses a QGIS Server WMS GetProjectSettings XML response into a typed
|
|
4
|
+
* WmsProject model.
|
|
5
|
+
*
|
|
6
|
+
* The response is a WMS_Capabilities document with QGIS-specific extensions
|
|
7
|
+
* for `displayField`, `geometryType`, `visibilityChecked`, `<Attributes>`
|
|
8
|
+
* and `<WFSLayers>`. We capture what's useful for STAC + app-config
|
|
9
|
+
* generation and ignore what isn't (e.g. GetMap / GetPrint format lists).
|
|
10
|
+
*
|
|
11
|
+
* Throws when the XML is unparseable or has the wrong root element.
|
|
12
|
+
* Sub-elements that fail to parse log via devLog and yield null/empty
|
|
13
|
+
* rather than tripping the whole project.
|
|
14
|
+
*/
|
|
15
|
+
export function parseGetProjectSettings(xmlText) {
|
|
16
|
+
const parser = new DOMParser();
|
|
17
|
+
const doc = parser.parseFromString(xmlText, 'text/xml');
|
|
18
|
+
const parserError = doc.querySelector('parsererror');
|
|
19
|
+
if (parserError) {
|
|
20
|
+
throw new Error(`Failed to parse GetProjectSettings XML: ${parserError.textContent?.slice(0, 200) ?? 'unknown error'}`);
|
|
21
|
+
}
|
|
22
|
+
const root = doc.documentElement;
|
|
23
|
+
// Accept both WMS_Capabilities and WMT_MS_Capabilities (older variants).
|
|
24
|
+
if (!root || (root.tagName !== 'WMS_Capabilities' && root.tagName !== 'WMT_MS_Capabilities')) {
|
|
25
|
+
throw new Error(`Expected <WMS_Capabilities> root element, got <${root?.tagName ?? 'nothing'}>`);
|
|
26
|
+
}
|
|
27
|
+
const service = root.querySelector(':scope > Service');
|
|
28
|
+
const title = service?.querySelector(':scope > Title')?.textContent?.trim() ?? '';
|
|
29
|
+
const keywords = Array.from(service?.querySelectorAll(':scope > KeywordList > Keyword') ?? [])
|
|
30
|
+
.map((node) => node.textContent?.trim() ?? '')
|
|
31
|
+
.filter(Boolean);
|
|
32
|
+
// Layers live under <Capability> as a tree of nested <Layer> elements.
|
|
33
|
+
const capability = root.querySelector(':scope > Capability');
|
|
34
|
+
const rootLayers = Array.from(capability?.querySelectorAll(':scope > Layer') ?? []);
|
|
35
|
+
const layerTree = rootLayers.map((node) => parseLayerNode(node)).filter(notNull);
|
|
36
|
+
const projectBbox = layerTree.length > 0 ? bboxOf(layerTree[0]) : null;
|
|
37
|
+
// <WFSLayers> lists which layer names are exposed via WFS GetFeature.
|
|
38
|
+
const wfsLayerNames = Array.from(capability?.querySelectorAll(':scope > WFSLayers > WFSLayer') ?? [])
|
|
39
|
+
.map((node) => node.getAttribute('name'))
|
|
40
|
+
.filter((name) => Boolean(name));
|
|
41
|
+
devLog('qgs/parseGetProjectSettings', 'parsed WMS project', {
|
|
42
|
+
title,
|
|
43
|
+
rootLayerCount: layerTree.length,
|
|
44
|
+
wfsLayerCount: wfsLayerNames.length
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
title,
|
|
48
|
+
keywords,
|
|
49
|
+
bbox: projectBbox,
|
|
50
|
+
layerTree,
|
|
51
|
+
wfsLayerNames,
|
|
52
|
+
rawXml: xmlText
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function bboxOf(node) {
|
|
56
|
+
return node.kind === 'layer' ? node.bbox : node.bbox;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parses one <Layer> element into either a group or leaf node. A `<Layer>`
|
|
60
|
+
* is treated as a group when it has child `<Layer>` elements; otherwise
|
|
61
|
+
* it's a leaf with attributes / styles. Both shapes share the QGIS Server
|
|
62
|
+
* extension attributes (visibilityChecked, queryable etc.).
|
|
63
|
+
*/
|
|
64
|
+
function parseLayerNode(layerEl) {
|
|
65
|
+
try {
|
|
66
|
+
const childLayers = Array.from(layerEl.children).filter((c) => c.tagName === 'Layer');
|
|
67
|
+
const treeName = layerEl.querySelector(':scope > TreeName')?.textContent?.trim() ?? '';
|
|
68
|
+
const name = layerEl.querySelector(':scope > Name')?.textContent?.trim() ?? '';
|
|
69
|
+
const title = layerEl.querySelector(':scope > Title')?.textContent?.trim() ?? '';
|
|
70
|
+
const bbox = parseExGeographicBbox(layerEl);
|
|
71
|
+
const visibilityChecked = layerEl.getAttribute('visibilityChecked') === '1';
|
|
72
|
+
if (childLayers.length > 0) {
|
|
73
|
+
const group = {
|
|
74
|
+
kind: 'group',
|
|
75
|
+
name,
|
|
76
|
+
title,
|
|
77
|
+
mutuallyExclusive: layerEl.getAttribute('mutuallyExclusive') === '1',
|
|
78
|
+
visibilityChecked,
|
|
79
|
+
bbox,
|
|
80
|
+
treeName,
|
|
81
|
+
children: childLayers.map((child) => parseLayerNode(child)).filter(notNull)
|
|
82
|
+
};
|
|
83
|
+
return group;
|
|
84
|
+
}
|
|
85
|
+
return parseLeafLayer(layerEl, name, title, bbox, visibilityChecked, treeName);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
devLog('qgs/parseGetProjectSettings', 'failed to parse a Layer node; skipping', { error: String(err) });
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function parseLeafLayer(layerEl, name, title, bbox, visibilityChecked, treeName) {
|
|
93
|
+
const opacityAttr = layerEl.getAttribute('opacity');
|
|
94
|
+
const opacity = opacityAttr === null ? 1 : Number(opacityAttr);
|
|
95
|
+
const styles = Array.from(layerEl.querySelectorAll(':scope > Style')).map((styleEl) => ({
|
|
96
|
+
name: styleEl.querySelector(':scope > Name')?.textContent?.trim() ?? '',
|
|
97
|
+
title: styleEl.querySelector(':scope > Title')?.textContent?.trim() ?? ''
|
|
98
|
+
})).filter((s) => s.name);
|
|
99
|
+
const attributes = Array.from(layerEl.querySelectorAll(':scope > Attributes > Attribute')).map((attrEl) => ({
|
|
100
|
+
name: attrEl.getAttribute('name') ?? '',
|
|
101
|
+
alias: attrEl.getAttribute('alias')?.trim() || null,
|
|
102
|
+
type: attrEl.getAttribute('type') ?? '',
|
|
103
|
+
typeName: attrEl.getAttribute('typeName') ?? '',
|
|
104
|
+
length: Number(attrEl.getAttribute('length') ?? '0'),
|
|
105
|
+
precision: Number(attrEl.getAttribute('precision') ?? '0'),
|
|
106
|
+
editType: attrEl.getAttribute('editType') ?? '',
|
|
107
|
+
comment: attrEl.getAttribute('comment') ?? ''
|
|
108
|
+
})).filter((a) => a.name);
|
|
109
|
+
const crsList = Array.from(layerEl.querySelectorAll(':scope > CRS'))
|
|
110
|
+
.map((node) => node.textContent?.trim() ?? '')
|
|
111
|
+
.filter(Boolean);
|
|
112
|
+
return {
|
|
113
|
+
kind: 'layer',
|
|
114
|
+
name,
|
|
115
|
+
title,
|
|
116
|
+
displayField: layerEl.getAttribute('displayField') || null,
|
|
117
|
+
geometryType: layerEl.getAttribute('geometryType') || null,
|
|
118
|
+
queryable: layerEl.getAttribute('queryable') !== '0',
|
|
119
|
+
visibilityChecked,
|
|
120
|
+
opacity: Number.isFinite(opacity) ? opacity : 1,
|
|
121
|
+
bbox,
|
|
122
|
+
scaleRange: parseScaleRange(layerEl),
|
|
123
|
+
crsList,
|
|
124
|
+
styles,
|
|
125
|
+
attributes,
|
|
126
|
+
treeName
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The layer's own scale limits. WMS names them from the other end:
|
|
131
|
+
* `MinScaleDenominator` is the most zoomed-in scale, which is `maxScale` here,
|
|
132
|
+
* and `MaxScaleDenominator` the most zoomed-out (`qgswmsgetcapabilities.cpp`,
|
|
133
|
+
* `qgis/QGIS@master`, read 2026-10-17). QGIS Server writes both only for a
|
|
134
|
+
* layer with scale-dependent visibility switched on.
|
|
135
|
+
*/
|
|
136
|
+
function parseScaleRange(layerEl) {
|
|
137
|
+
const read = (tag) => {
|
|
138
|
+
const text = layerEl.querySelector(`:scope > ${tag}`)?.textContent?.trim();
|
|
139
|
+
const value = text ? Number(text) : Number.NaN;
|
|
140
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
141
|
+
};
|
|
142
|
+
const minScale = read('MaxScaleDenominator');
|
|
143
|
+
const maxScale = read('MinScaleDenominator');
|
|
144
|
+
return minScale === null && maxScale === null ? null : { minScale, maxScale };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* EX_GeographicBoundingBox is the WMS 1.3.0 form (children: westBoundLongitude
|
|
148
|
+
* etc.). Older WMS used LatLonBoundingBox attributes — not produced by QGIS
|
|
149
|
+
* Server, so we don't bother with that fallback.
|
|
150
|
+
*/
|
|
151
|
+
function parseExGeographicBbox(parent) {
|
|
152
|
+
const node = parent.querySelector(':scope > EX_GeographicBoundingBox');
|
|
153
|
+
if (!node)
|
|
154
|
+
return null;
|
|
155
|
+
const west = readNumber(node, 'westBoundLongitude');
|
|
156
|
+
const east = readNumber(node, 'eastBoundLongitude');
|
|
157
|
+
const south = readNumber(node, 'southBoundLatitude');
|
|
158
|
+
const north = readNumber(node, 'northBoundLatitude');
|
|
159
|
+
if (west === null || east === null || south === null || north === null)
|
|
160
|
+
return null;
|
|
161
|
+
return { westBoundLongitude: west, eastBoundLongitude: east, southBoundLatitude: south, northBoundLatitude: north };
|
|
162
|
+
}
|
|
163
|
+
function readNumber(parent, tag) {
|
|
164
|
+
const text = parent.querySelector(`:scope > ${tag}`)?.textContent?.trim();
|
|
165
|
+
if (!text)
|
|
166
|
+
return null;
|
|
167
|
+
const value = Number(text);
|
|
168
|
+
return Number.isFinite(value) ? value : null;
|
|
169
|
+
}
|
|
170
|
+
function notNull(value) {
|
|
171
|
+
return value !== null;
|
|
172
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LayerEntry } from '../model/QgsProject.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parses the <projectlayers> block into a list of LayerEntry. Annotation
|
|
4
|
+
* layers (<main-annotation-layer>) are filtered out — they're QGIS's drawing
|
|
5
|
+
* layer, not real data.
|
|
6
|
+
*
|
|
7
|
+
* Each <maplayer> has the shape:
|
|
8
|
+
* <maplayer type="vector" geometry="Point" hasScaleBasedVisibilityFlag="0"
|
|
9
|
+
* minScale="..." maxScale="..." ...>
|
|
10
|
+
* <id>...</id>
|
|
11
|
+
* <datasource>...</datasource>
|
|
12
|
+
* <layername>...</layername>
|
|
13
|
+
* <provider>ogr</provider> ← optional, used as a hint
|
|
14
|
+
* <srs><spatialrefsys><authid>EPSG:4326</authid>...
|
|
15
|
+
* <extent><xmin>...</xmin>...</extent>
|
|
16
|
+
* ...
|
|
17
|
+
* <renderer-v2 ...> ← inline symbology, captured by parseStyle
|
|
18
|
+
* </maplayer>
|
|
19
|
+
*
|
|
20
|
+
* On any per-layer failure the layer is skipped (logged via devLog) so a
|
|
21
|
+
* single bad layer doesn't take down the whole project.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseProjectLayers(qgisRoot: Element): LayerEntry[];
|