@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,53 @@
|
|
|
1
|
+
import type { DataSource } from '../model/QgsProject.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a QGIS <datasource> string into a typed descriptor.
|
|
4
|
+
*
|
|
5
|
+
* File, WFS, public WMS and public ArcGIS FeatureServer sources are recognised:
|
|
6
|
+
*
|
|
7
|
+
* 1. **File** (OGR provider) — typically `./relative/path.geojson`, optionally
|
|
8
|
+
* followed by `|layername=...` and other pipe-separated options. Examples:
|
|
9
|
+
* "./graffiti.json|layername=WA_Municipal_Graffiti_Vandalism_Register"
|
|
10
|
+
* "../data/roads.shp"
|
|
11
|
+
* "/abs/path/buildings.gpkg|layername=parcels"
|
|
12
|
+
*
|
|
13
|
+
* The basename is stored as `filename` for drag-drop companion matching.
|
|
14
|
+
* The full normalised relative path is stored as `relPath` for cloud
|
|
15
|
+
* loaders that resolve files against a folder listing.
|
|
16
|
+
*
|
|
17
|
+
* 2. **WFS** — space-separated key='value' pairs. Example:
|
|
18
|
+
* pagingEnabled='true' restrictToRequestBBOX='1' srsname='EPSG:4326'
|
|
19
|
+
* typename='ns:layer' url='https://example/wfs' version='auto'
|
|
20
|
+
*
|
|
21
|
+
* `url` and `typename` are required for the source to be considered WFS.
|
|
22
|
+
*
|
|
23
|
+
* 3. **WMS, XYZ and WMTS** — URL query parameters in QGIS's wms provider URI,
|
|
24
|
+
* which holds all three: `type=xyz` marks an XYZ tile layer and
|
|
25
|
+
* `tileMatrixSet` a WMTS one. Example:
|
|
26
|
+
* type=xyz&url=https://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0
|
|
27
|
+
*
|
|
28
|
+
* The `xyzvectortiles` provider writes an XYZ vector tile layer in the same
|
|
29
|
+
* shape, with `type=xyz`. Its template must hold `{z}`, `{x}` and `{y}`.
|
|
30
|
+
*
|
|
31
|
+
* 4. **Delimited Text** — a `file:` URL whose query names how the file splits.
|
|
32
|
+
* Example:
|
|
33
|
+
* file:./data/types.csv?type=csv&delimiter=;&detectTypes=yes&geomType=none
|
|
34
|
+
*
|
|
35
|
+
* Read as a file source carrying those options. Only `type=csv` (and its
|
|
36
|
+
* older name `plain`) is read; a whitespace or regular-expression split is
|
|
37
|
+
* unsupported.
|
|
38
|
+
*
|
|
39
|
+
* 5. **ArcGIS FeatureServer** — the `arcgisfeatureserver` provider, written in
|
|
40
|
+
* the same key='value' shape as WFS, with the filter as a trailing `sql=`.
|
|
41
|
+
* Example:
|
|
42
|
+
* url='https://gis.example.test/arcgis/rest/services/Kinders/FeatureServer/0'
|
|
43
|
+
*
|
|
44
|
+
* 6. **Unsupported** — anything else (PostGIS, a local vector tile file, a source needing
|
|
45
|
+
* credentials or custom headers, etc.). The raw string is retained for
|
|
46
|
+
* diagnostics.
|
|
47
|
+
*
|
|
48
|
+
* The provider element from the parent <maplayer> can be passed as a hint to
|
|
49
|
+
* disambiguate edge cases; if omitted, content sniffing is used.
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseDataSource(raw: string, providerHint?: string | null): DataSource;
|
|
52
|
+
/** A file source option `readGeometryTypeFilter` reads as `geometrytype=`, the type name captured. */
|
|
53
|
+
export declare const GEOMETRY_TYPE_OPTION: RegExp;
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { wmsEndpoint } from "../model/stacWms.js";
|
|
2
|
+
import { wmtsEndpoint } from "../model/stacWmts.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parses a QGIS <datasource> string into a typed descriptor.
|
|
5
|
+
*
|
|
6
|
+
* File, WFS, public WMS and public ArcGIS FeatureServer sources are recognised:
|
|
7
|
+
*
|
|
8
|
+
* 1. **File** (OGR provider) — typically `./relative/path.geojson`, optionally
|
|
9
|
+
* followed by `|layername=...` and other pipe-separated options. Examples:
|
|
10
|
+
* "./graffiti.json|layername=WA_Municipal_Graffiti_Vandalism_Register"
|
|
11
|
+
* "../data/roads.shp"
|
|
12
|
+
* "/abs/path/buildings.gpkg|layername=parcels"
|
|
13
|
+
*
|
|
14
|
+
* The basename is stored as `filename` for drag-drop companion matching.
|
|
15
|
+
* The full normalised relative path is stored as `relPath` for cloud
|
|
16
|
+
* loaders that resolve files against a folder listing.
|
|
17
|
+
*
|
|
18
|
+
* 2. **WFS** — space-separated key='value' pairs. Example:
|
|
19
|
+
* pagingEnabled='true' restrictToRequestBBOX='1' srsname='EPSG:4326'
|
|
20
|
+
* typename='ns:layer' url='https://example/wfs' version='auto'
|
|
21
|
+
*
|
|
22
|
+
* `url` and `typename` are required for the source to be considered WFS.
|
|
23
|
+
*
|
|
24
|
+
* 3. **WMS, XYZ and WMTS** — URL query parameters in QGIS's wms provider URI,
|
|
25
|
+
* which holds all three: `type=xyz` marks an XYZ tile layer and
|
|
26
|
+
* `tileMatrixSet` a WMTS one. Example:
|
|
27
|
+
* type=xyz&url=https://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0
|
|
28
|
+
*
|
|
29
|
+
* The `xyzvectortiles` provider writes an XYZ vector tile layer in the same
|
|
30
|
+
* shape, with `type=xyz`. Its template must hold `{z}`, `{x}` and `{y}`.
|
|
31
|
+
*
|
|
32
|
+
* 4. **Delimited Text** — a `file:` URL whose query names how the file splits.
|
|
33
|
+
* Example:
|
|
34
|
+
* file:./data/types.csv?type=csv&delimiter=;&detectTypes=yes&geomType=none
|
|
35
|
+
*
|
|
36
|
+
* Read as a file source carrying those options. Only `type=csv` (and its
|
|
37
|
+
* older name `plain`) is read; a whitespace or regular-expression split is
|
|
38
|
+
* unsupported.
|
|
39
|
+
*
|
|
40
|
+
* 5. **ArcGIS FeatureServer** — the `arcgisfeatureserver` provider, written in
|
|
41
|
+
* the same key='value' shape as WFS, with the filter as a trailing `sql=`.
|
|
42
|
+
* Example:
|
|
43
|
+
* url='https://gis.example.test/arcgis/rest/services/Kinders/FeatureServer/0'
|
|
44
|
+
*
|
|
45
|
+
* 6. **Unsupported** — anything else (PostGIS, a local vector tile file, a source needing
|
|
46
|
+
* credentials or custom headers, etc.). The raw string is retained for
|
|
47
|
+
* diagnostics.
|
|
48
|
+
*
|
|
49
|
+
* The provider element from the parent <maplayer> can be passed as a hint to
|
|
50
|
+
* disambiguate edge cases; if omitted, content sniffing is used.
|
|
51
|
+
*/
|
|
52
|
+
export function parseDataSource(raw, providerHint = null) {
|
|
53
|
+
const trimmed = raw.trim();
|
|
54
|
+
if (trimmed.length === 0) {
|
|
55
|
+
return { kind: 'unsupported', raw, hint: providerHint };
|
|
56
|
+
}
|
|
57
|
+
if (providerHint?.toLowerCase() === 'wms') {
|
|
58
|
+
const params = new URLSearchParams(trimmed);
|
|
59
|
+
if (needsCredentialsOrHeaders(params))
|
|
60
|
+
return { kind: 'unsupported', raw, hint: providerHint };
|
|
61
|
+
if (params.get('type') === 'xyz')
|
|
62
|
+
return parseXyzDataSource(params, raw) ?? { kind: 'unsupported', raw, hint: providerHint };
|
|
63
|
+
if (params.has('tileMatrixSet'))
|
|
64
|
+
return parseWmtsDataSource(params, raw) ?? { kind: 'unsupported', raw, hint: providerHint };
|
|
65
|
+
// Any other `type` is a tile format this does not read, such as a local MBTiles file.
|
|
66
|
+
if (params.has('type'))
|
|
67
|
+
return { kind: 'unsupported', raw, hint: providerHint };
|
|
68
|
+
const url = params.get('url');
|
|
69
|
+
const layers = params.getAll('layers').flatMap((value) => value.split(','));
|
|
70
|
+
if (url && wmsEndpoint(url) && layers.length > 0 && layers.every((name) => name.trim().length > 0)) {
|
|
71
|
+
const version = params.get('version');
|
|
72
|
+
if (version && version !== '1.1.1' && version !== '1.3.0') {
|
|
73
|
+
return { kind: 'unsupported', raw, hint: providerHint };
|
|
74
|
+
}
|
|
75
|
+
const dimensions = {};
|
|
76
|
+
for (const key of ['time', 'elevation']) {
|
|
77
|
+
const value = params.get(key);
|
|
78
|
+
if (value)
|
|
79
|
+
dimensions[key.toUpperCase()] = value;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
kind: 'wms', url, layers,
|
|
83
|
+
styles: params.getAll('styles').flatMap((value) => value.split(',')),
|
|
84
|
+
format: params.get('format') ?? 'image/png',
|
|
85
|
+
crs: params.get('crs') ?? 'EPSG:3857',
|
|
86
|
+
version: version === '1.1.1' || version === '1.3.0' ? version : null,
|
|
87
|
+
transparent: params.get('transparent')?.toLowerCase() !== 'false',
|
|
88
|
+
dimensions, raw
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { kind: 'unsupported', raw, hint: providerHint };
|
|
92
|
+
}
|
|
93
|
+
if (providerHint?.toLowerCase() === 'xyzvectortiles') {
|
|
94
|
+
return parseVectorXyzDataSource(new URLSearchParams(trimmed), raw) ?? { kind: 'unsupported', raw, hint: providerHint };
|
|
95
|
+
}
|
|
96
|
+
if (providerHint?.toLowerCase() === 'arcgisfeatureserver') {
|
|
97
|
+
return parseArcgisFeatureServerDataSource(raw, trimmed) ?? { kind: 'unsupported', raw, hint: providerHint };
|
|
98
|
+
}
|
|
99
|
+
if (providerHint?.toLowerCase() === 'delimitedtext') {
|
|
100
|
+
return parseDelimitedTextDataSource(raw, trimmed) ?? { kind: 'unsupported', raw, hint: providerHint };
|
|
101
|
+
}
|
|
102
|
+
// WFS detection: look for url=' or url=" along with typename=
|
|
103
|
+
if (looksLikeWfs(trimmed)) {
|
|
104
|
+
const { source, sql } = splitOffWfsSql(trimmed);
|
|
105
|
+
const params = parseSpaceSeparatedKeyValues(source);
|
|
106
|
+
const url = params.url;
|
|
107
|
+
const typeName = params.typename ?? params.typeName;
|
|
108
|
+
if (url && typeName) {
|
|
109
|
+
// QGIS sends the server a `SELECT` statement where the source has one, and the `filter`
|
|
110
|
+
// otherwise (`QgsWFSProvider::QgsWFSProvider`, `src/providers/wfs/qgswfsprovider.cpp`,
|
|
111
|
+
// `qgis/QGIS@master`, read 2026-10-26).
|
|
112
|
+
const filter = params.filter?.trim() ? params.filter : null;
|
|
113
|
+
// QGIS takes a `filter` that parses as XML for an OGC Filter as it is (`QgsWFSSharedData::computeFilter`);
|
|
114
|
+
// one that starts with `<` is read as that here.
|
|
115
|
+
const featureFilter = sql
|
|
116
|
+
? { expression: sql, dialect: 'wfs_sql' }
|
|
117
|
+
: filter ? { expression: filter, dialect: filter.trim().startsWith('<') ? 'ogc_filter' : 'qgis_expression' } : null;
|
|
118
|
+
return {
|
|
119
|
+
kind: 'wfs',
|
|
120
|
+
url,
|
|
121
|
+
typeName,
|
|
122
|
+
srsName: params.srsname ?? params.srsName ?? null,
|
|
123
|
+
...(featureFilter ? { featureFilter } : {}),
|
|
124
|
+
raw
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// File detection: any non-key=value string is treated as a file path.
|
|
129
|
+
// The provider hint "ogr" reinforces this but isn't required.
|
|
130
|
+
if (looksLikeFilePath(trimmed) || providerHint === 'ogr') {
|
|
131
|
+
return parseFileDataSource(raw, trimmed);
|
|
132
|
+
}
|
|
133
|
+
// Otherwise: unsupported. Try to sniff a hint for nicer diagnostics.
|
|
134
|
+
return { kind: 'unsupported', raw, hint: providerHint ?? sniffProviderHint(trimmed) };
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Whether a wms-provider source names credentials or a header to send. QGIS
|
|
138
|
+
* writes some of these keys with no value on sources needing neither — an XYZ
|
|
139
|
+
* layer added from its browser panel carries `http-header:referer=` — so only
|
|
140
|
+
* a key with a value counts.
|
|
141
|
+
*/
|
|
142
|
+
function needsCredentialsOrHeaders(params) {
|
|
143
|
+
for (const [key, value] of params) {
|
|
144
|
+
if (!value.trim())
|
|
145
|
+
continue;
|
|
146
|
+
if (['authcfg', 'username', 'password', 'referer'].includes(key) || key.startsWith('http-header:'))
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* An XYZ tile layer. QGIS's `{q}` is Bing's quadkey, written as the `{quadkey}`
|
|
153
|
+
* the tile layer fills in. Null for a template that is not an absolute
|
|
154
|
+
* `http`/`https` address holding `{z}` or a quadkey.
|
|
155
|
+
*/
|
|
156
|
+
function parseXyzDataSource(params, raw) {
|
|
157
|
+
const url = params.get('url')?.replaceAll('{q}', '{quadkey}');
|
|
158
|
+
if (!url || !/\{(z|quadkey)\}/.test(url))
|
|
159
|
+
return null;
|
|
160
|
+
try {
|
|
161
|
+
const parsed = new URL(url);
|
|
162
|
+
if (!['https:', 'http:'].includes(parsed.protocol) || parsed.username || parsed.password)
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
const zmax = params.get('zmax');
|
|
169
|
+
const maxZoom = zmax && /^\d+$/.test(zmax) ? Number(zmax) : null;
|
|
170
|
+
return { kind: 'xyz', tiles: 'image', url, maxZoom, raw };
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* An XYZ vector tile layer. Null for any other `type`, such as a local MBTiles
|
|
174
|
+
* file, for a source needing credentials or headers, and for a template
|
|
175
|
+
* without `{z}`, `{x}` and `{y}`.
|
|
176
|
+
*/
|
|
177
|
+
function parseVectorXyzDataSource(params, raw) {
|
|
178
|
+
if (params.get('type') !== 'xyz' || needsCredentialsOrHeaders(params))
|
|
179
|
+
return null;
|
|
180
|
+
const parsed = parseXyzDataSource(params, raw);
|
|
181
|
+
if (parsed?.kind !== 'xyz' || !['{z}', '{x}', '{y}'].every((placeholder) => parsed.url.includes(placeholder)))
|
|
182
|
+
return null;
|
|
183
|
+
return { ...parsed, tiles: 'vector' };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* A WMTS layer. QGIS names one layer, one style and one tile matrix set; its
|
|
187
|
+
* `tileDimensions` are `name=value` pairs separated by `;`.
|
|
188
|
+
*/
|
|
189
|
+
function parseWmtsDataSource(params, raw) {
|
|
190
|
+
const url = wmtsEndpoint(params.get('url') ?? '');
|
|
191
|
+
const layer = params.get('layers')?.trim();
|
|
192
|
+
const tileMatrixSet = params.get('tileMatrixSet')?.trim();
|
|
193
|
+
if (!url || !layer || !tileMatrixSet)
|
|
194
|
+
return null;
|
|
195
|
+
const dimensions = {};
|
|
196
|
+
for (const pair of (params.get('tileDimensions') ?? '').split(';')) {
|
|
197
|
+
const separator = pair.indexOf('=');
|
|
198
|
+
if (separator > 0)
|
|
199
|
+
dimensions[pair.slice(0, separator)] = pair.slice(separator + 1);
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
kind: 'wmts', url, layer, tileMatrixSet,
|
|
203
|
+
style: params.get('styles') ?? '',
|
|
204
|
+
format: params.get('format') || 'image/png',
|
|
205
|
+
dimensions, raw
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function looksLikeWfs(raw) {
|
|
209
|
+
return /\burl\s*=\s*['"]/.test(raw) && /\btypename\s*=\s*['"]/i.test(raw);
|
|
210
|
+
}
|
|
211
|
+
function looksLikeFilePath(raw) {
|
|
212
|
+
// No '=' before the first '|' or end → looks like a path with optional |layername
|
|
213
|
+
const pathPart = raw.split('|')[0] ?? raw;
|
|
214
|
+
if (pathPart.includes('='))
|
|
215
|
+
return false;
|
|
216
|
+
// Has a path separator or a file extension or a parent ref
|
|
217
|
+
return /[\\/.]/.test(pathPart) || pathPart.startsWith('.');
|
|
218
|
+
}
|
|
219
|
+
function parseFileDataSource(raw, trimmed) {
|
|
220
|
+
const { source, subset } = splitOffSubset(trimmed);
|
|
221
|
+
const [pathPart = '', ...optionParts] = source.split('|');
|
|
222
|
+
const url = readOnlineFileUrl(pathPart.trim());
|
|
223
|
+
const normalisedPath = url ?? pathPart.trim().replace(/\\/g, '/');
|
|
224
|
+
const filename = url ? basename(new URL(url).pathname) : basename(normalisedPath);
|
|
225
|
+
// Retain the full relative path for cloud loaders that need to resolve
|
|
226
|
+
// files inside a folder share. Falls back to filename when no directory.
|
|
227
|
+
const relPath = normalisedPath || filename;
|
|
228
|
+
let layerName = null;
|
|
229
|
+
for (const opt of optionParts) {
|
|
230
|
+
const match = /^layername\s*=\s*(.*)$/i.exec(opt.trim());
|
|
231
|
+
if (match) {
|
|
232
|
+
layerName = match[1].trim();
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
kind: 'file', filename, relPath, layerName,
|
|
238
|
+
...(url ? { url } : {}),
|
|
239
|
+
geometryTypeFilter: readGeometryTypeFilter(optionParts),
|
|
240
|
+
...(subset ? { featureFilter: { expression: subset, dialect: 'ogr_sql' } } : {}),
|
|
241
|
+
raw
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The address of an online file: the path after GDAL's `/vsicurl/` prefix,
|
|
246
|
+
* which QGIS writes for a file it reads over HTTP, or a path that is itself an
|
|
247
|
+
* `http`/`https` address. Null for a file on disk, and for an address with
|
|
248
|
+
* credentials in it.
|
|
249
|
+
*/
|
|
250
|
+
function readOnlineFileUrl(path) {
|
|
251
|
+
const address = path.replace(/^\/vsicurl\//i, '');
|
|
252
|
+
if (!/^https?:\/\//i.test(address))
|
|
253
|
+
return null;
|
|
254
|
+
try {
|
|
255
|
+
const parsed = new URL(address);
|
|
256
|
+
return parsed.username || parsed.password ? null : parsed.href;
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* An OGR source's `|subset=` filter and the source without it. Everything
|
|
264
|
+
* after the option is the filter, `|` included, as QGIS reads it
|
|
265
|
+
* (`QgsOgrProviderMetadata::decodeUri`, `src/core/providers/ogr/qgsogrprovidermetadata.cpp`,
|
|
266
|
+
* `qgis/QGIS@master`, read 2026-10-26), and the option's name is matched with
|
|
267
|
+
* its case. A blank filter is none.
|
|
268
|
+
*/
|
|
269
|
+
function splitOffSubset(source) {
|
|
270
|
+
const at = source.indexOf('|subset=');
|
|
271
|
+
if (at === -1)
|
|
272
|
+
return { source, subset: null };
|
|
273
|
+
const subset = source.slice(at + '|subset='.length);
|
|
274
|
+
return { source: source.slice(0, at), subset: subset.trim() ? subset : null };
|
|
275
|
+
}
|
|
276
|
+
/** A file source option `readGeometryTypeFilter` reads as `geometrytype=`, the type name captured. */
|
|
277
|
+
export const GEOMETRY_TYPE_OPTION = /^geometrytype=([a-zA-Z0-9]*)$/i;
|
|
278
|
+
/**
|
|
279
|
+
* The shape a file source's `|geometrytype=` option keeps, read as QGIS's OGR
|
|
280
|
+
* provider reads it (qgis/QGIS@99f68421f54e473d777d6693b859ab91a06cce30,
|
|
281
|
+
* `src/core/providers/ogr/`): the key in any case, the value matched exactly
|
|
282
|
+
* against its type names (`ogrWkbGeometryTypeFromName`), then reduced to its
|
|
283
|
+
* single-part, straight-edged shape (`ogrWkbSingleFlattenAndLinear`), so a
|
|
284
|
+
* `MultiPoint` filter keeps points. `uniqueGeometryType=yes` turns the filter
|
|
285
|
+
* off. Only the first `geometrytype=` counts, as in QGIS. A geometry
|
|
286
|
+
* collection or `None` filter, and a name QGIS does not know, give no filter.
|
|
287
|
+
*/
|
|
288
|
+
function readGeometryTypeFilter(optionParts) {
|
|
289
|
+
let typeName = null;
|
|
290
|
+
for (const opt of optionParts) {
|
|
291
|
+
const geometryType = GEOMETRY_TYPE_OPTION.exec(opt.trim());
|
|
292
|
+
if (geometryType && typeName === null)
|
|
293
|
+
typeName = geometryType[1];
|
|
294
|
+
if (/^uniqueGeometryType=yes$/i.test(opt.trim()))
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
return typeName === null ? null : GEOMETRY_TYPE_FILTERS[typeName] ?? null;
|
|
298
|
+
}
|
|
299
|
+
const GEOMETRY_TYPE_FILTERS = {
|
|
300
|
+
Point: 'Point',
|
|
301
|
+
MultiPoint: 'Point',
|
|
302
|
+
Point25D: 'Point',
|
|
303
|
+
MultiPoint25D: 'Point',
|
|
304
|
+
LineString: 'LineString',
|
|
305
|
+
MultiLineString: 'LineString',
|
|
306
|
+
LineString25D: 'LineString',
|
|
307
|
+
MultiLineString25D: 'LineString',
|
|
308
|
+
CircularString: 'LineString',
|
|
309
|
+
CircularStringZ: 'LineString',
|
|
310
|
+
CompoundCurve: 'LineString',
|
|
311
|
+
CompoundCurveZ: 'LineString',
|
|
312
|
+
MultiCurve: 'LineString',
|
|
313
|
+
MultiCurveZ: 'LineString',
|
|
314
|
+
Polygon: 'Polygon',
|
|
315
|
+
MultiPolygon: 'Polygon',
|
|
316
|
+
Polygon25D: 'Polygon',
|
|
317
|
+
MultiPolygon25D: 'Polygon',
|
|
318
|
+
CurvePolygon: 'Polygon',
|
|
319
|
+
CurvePolygonZ: 'Polygon',
|
|
320
|
+
MultiSurface: 'Polygon',
|
|
321
|
+
MultiSurfaceZ: 'Polygon'
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* A Delimited Text source: the file its `file:` URL names, and the options its
|
|
325
|
+
* query gives, read as `QgsDelimitedTextFile::setFromUrl` reads them
|
|
326
|
+
* (`src/providers/delimitedtext/qgsdelimitedtextfile.cpp`, `qgis/QGIS@99f68421`,
|
|
327
|
+
* read 2026-10-24). QGIS stores a relative path as `file:./data.csv?…`, and
|
|
328
|
+
* reads one without the `file:` scheme too (`relativeToAbsoluteUri`,
|
|
329
|
+
* `qgsdelimitedtextprovider.cpp`). A tab is written `\t`. Null where the split
|
|
330
|
+
* is not `csv` or `plain`, or the URL names no file.
|
|
331
|
+
*/
|
|
332
|
+
function parseDelimitedTextDataSource(raw, trimmed) {
|
|
333
|
+
const queryStart = trimmed.indexOf('?');
|
|
334
|
+
const location = queryStart === -1 ? trimmed : trimmed.slice(0, queryStart);
|
|
335
|
+
const query = new Map();
|
|
336
|
+
for (const pair of (queryStart === -1 ? '' : trimmed.slice(queryStart + 1)).split('&')) {
|
|
337
|
+
if (!pair)
|
|
338
|
+
continue;
|
|
339
|
+
const separator = pair.indexOf('=');
|
|
340
|
+
const key = decodeQueryPart(separator === -1 ? pair : pair.slice(0, separator));
|
|
341
|
+
// The first value wins, as `QUrlQuery::queryItemValue` gives it.
|
|
342
|
+
if (!query.has(key))
|
|
343
|
+
query.set(key, separator === -1 ? '' : decodeQueryPart(pair.slice(separator + 1)));
|
|
344
|
+
}
|
|
345
|
+
const type = query.get('type') ?? query.get('delimiterType') ?? 'csv';
|
|
346
|
+
if (type !== 'csv' && type !== 'plain')
|
|
347
|
+
return null;
|
|
348
|
+
const path = filePathOfUrl(location);
|
|
349
|
+
if (!path)
|
|
350
|
+
return null;
|
|
351
|
+
const decodeChars = (chars) => chars.replaceAll('\\t', '\t');
|
|
352
|
+
const isYes = (value, fallback) => (value === undefined ? fallback : !value.toUpperCase().startsWith('N'));
|
|
353
|
+
const skipLines = Number.parseInt(query.get('skipLines') ?? '0', 10);
|
|
354
|
+
const options = {
|
|
355
|
+
delimiter: decodeChars(query.get('delimiter') ?? ','),
|
|
356
|
+
// `plain` is the older name, whose quotes were either kind and which had no escape.
|
|
357
|
+
quote: decodeChars(query.get('quote') ?? (type === 'plain' ? '\'"' : '"')),
|
|
358
|
+
escape: decodeChars(query.get('escape') ?? (type === 'plain' ? '' : '"')),
|
|
359
|
+
skipLines: Number.isFinite(skipLines) && skipLines > 0 ? skipLines : 0,
|
|
360
|
+
header: isYes(query.get('useHeader'), true),
|
|
361
|
+
trim: query.has('trimFields') && isYes(query.get('trimFields'), false)
|
|
362
|
+
};
|
|
363
|
+
if (!options.delimiter)
|
|
364
|
+
return null;
|
|
365
|
+
// The filter is a QGIS expression here, not GDAL's SQL.
|
|
366
|
+
const subset = query.get('subset')?.trim() ? query.get('subset') : null;
|
|
367
|
+
const file = parseFileDataSource(raw, path);
|
|
368
|
+
return file.kind === 'file'
|
|
369
|
+
? { ...file, delimitedText: options, ...(subset ? { featureFilter: { expression: subset, dialect: 'qgis_expression' } } : {}) }
|
|
370
|
+
: null;
|
|
371
|
+
}
|
|
372
|
+
/** A query key or value with its percent-escapes decoded, kept as it is where one is malformed. */
|
|
373
|
+
function decodeQueryPart(part) {
|
|
374
|
+
try {
|
|
375
|
+
return decodeURIComponent(part);
|
|
376
|
+
}
|
|
377
|
+
catch {
|
|
378
|
+
return part;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* The path a `file:` URL names: `file:./data.csv` is relative, `file:///C:/x.csv`
|
|
383
|
+
* a Windows drive and `file:///home/x.csv` an absolute path. A location
|
|
384
|
+
* without the scheme is a path already.
|
|
385
|
+
*/
|
|
386
|
+
function filePathOfUrl(location) {
|
|
387
|
+
let path = location.replace(/^file:/i, '');
|
|
388
|
+
if (path.startsWith('///'))
|
|
389
|
+
path = path.slice(2);
|
|
390
|
+
else if (path.startsWith('//'))
|
|
391
|
+
path = path.slice(1);
|
|
392
|
+
if (/^\/[a-zA-Z]:\//.test(path))
|
|
393
|
+
path = path.slice(1);
|
|
394
|
+
return decodeQueryPart(path.trim());
|
|
395
|
+
}
|
|
396
|
+
function basename(pathLike) {
|
|
397
|
+
// Handle both forward and back slashes since QGS authors run on any OS.
|
|
398
|
+
const parts = pathLike.split(/[\\/]/);
|
|
399
|
+
return parts[parts.length - 1] ?? pathLike;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Parses QGIS's WFS/PostGIS-style URI: space-separated key='value' or
|
|
403
|
+
* key="value" pairs. Quotes are required around values that contain spaces.
|
|
404
|
+
* QGIS escapes a quote or a backslash inside a value with a backslash
|
|
405
|
+
* (`QgsDataSourceUri::escape`, `src/core/qgsdatasourceuri.cpp`,
|
|
406
|
+
* `qgis/QGIS@master`, read 2026-10-26), as a WFS layer's `filter` needs.
|
|
407
|
+
*/
|
|
408
|
+
function parseSpaceSeparatedKeyValues(raw) {
|
|
409
|
+
const out = {};
|
|
410
|
+
// Match key='...' or key="..."
|
|
411
|
+
const re = /(\w+)\s*=\s*(?:'((?:\\.|[^'\\])*)'|"((?:\\.|[^"\\])*)")/g;
|
|
412
|
+
let m;
|
|
413
|
+
while ((m = re.exec(raw)) !== null) {
|
|
414
|
+
const key = m[1];
|
|
415
|
+
const value = (m[2] ?? m[3] ?? '').replace(/\\(.)/g, '$1');
|
|
416
|
+
out[key] = value;
|
|
417
|
+
}
|
|
418
|
+
return out;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* A WFS source's `sql=` statement and the source without it. QGIS writes it
|
|
422
|
+
* last and unquoted (`QgsDataSourceUri::uri`, same source as above), so the
|
|
423
|
+
* first `sql=` that starts a word outside a quoted value begins it, and
|
|
424
|
+
* everything after it is the statement.
|
|
425
|
+
*/
|
|
426
|
+
function splitOffWfsSql(source) {
|
|
427
|
+
let quote = null;
|
|
428
|
+
for (let at = 0; at < source.length; at += 1) {
|
|
429
|
+
const char = source[at];
|
|
430
|
+
if (quote) {
|
|
431
|
+
if (char === '\\')
|
|
432
|
+
at += 1;
|
|
433
|
+
else if (char === quote)
|
|
434
|
+
quote = null;
|
|
435
|
+
}
|
|
436
|
+
else if (char === '\'' || char === '"') {
|
|
437
|
+
quote = char;
|
|
438
|
+
}
|
|
439
|
+
else if (source.startsWith('sql=', at) && (at === 0 || /\s/.test(source[at - 1]))) {
|
|
440
|
+
const sql = source.slice(at + 'sql='.length);
|
|
441
|
+
return { source: source.slice(0, at), sql: sql.trim() ? sql : null };
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return { source, sql: null };
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* A layer of an ArcGIS FeatureServer or MapServer. QGIS's provider reads the
|
|
448
|
+
* service layer from `url`, signs in through `authcfg`, `urlprefix` or the
|
|
449
|
+
* source's HTTP headers, keeps only features overlapping `bbox`, and sends
|
|
450
|
+
* `sql=` to the service as the query's `where` (`QgsAfsProvider`,
|
|
451
|
+
* `src/providers/arcgisrest/qgsafsprovider.cpp`, and `QgsAfsSharedData`,
|
|
452
|
+
* beside it, `qgis/QGIS@master`, read 2026-11-05).
|
|
453
|
+
*
|
|
454
|
+
* Null for a source needing a sign-in or a header, for one limited to a box,
|
|
455
|
+
* which this does not apply, and for an address that is not a service layer.
|
|
456
|
+
*/
|
|
457
|
+
function parseArcgisFeatureServerDataSource(raw, trimmed) {
|
|
458
|
+
const { source, sql } = splitOffWfsSql(trimmed);
|
|
459
|
+
const params = parseSpaceSeparatedKeyValues(source);
|
|
460
|
+
if (['authcfg', 'urlprefix', 'referer', 'bbox'].some((key) => params[key]?.trim()))
|
|
461
|
+
return null;
|
|
462
|
+
// `http-header:` keys hold a colon, which the key-value reader leaves out.
|
|
463
|
+
if (/(?:^|\s)http-header:[\w-]+\s*=\s*(['"])(?!\1)/.test(source))
|
|
464
|
+
return null;
|
|
465
|
+
const url = params.url;
|
|
466
|
+
if (!url || !/\/(FeatureServer|MapServer)\/\d+\/?$/.test(url))
|
|
467
|
+
return null;
|
|
468
|
+
try {
|
|
469
|
+
const parsed = new URL(url);
|
|
470
|
+
if (!['https:', 'http:'].includes(parsed.protocol) || parsed.username || parsed.password || parsed.search)
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
catch {
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
return { kind: 'arcgis', url: url.replace(/\/$/, ''), where: sql?.trim() ? sql.trim() : null, raw };
|
|
477
|
+
}
|
|
478
|
+
function sniffProviderHint(raw) {
|
|
479
|
+
if (/\bdbname\s*=/.test(raw))
|
|
480
|
+
return 'postgres';
|
|
481
|
+
if (/\bservice\s*=\s*['"]?(wms|wmts)/i.test(raw))
|
|
482
|
+
return 'wms';
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MapExtent } from '../model/QgsProject.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the initial map view extent from <mapcanvas><extent>.
|
|
4
|
+
*
|
|
5
|
+
* The mapcanvas element looks like:
|
|
6
|
+
* <mapcanvas annotationsVisible="1" name="theMapCanvas">
|
|
7
|
+
* <units>degrees</units>
|
|
8
|
+
* <extent>
|
|
9
|
+
* <xmin>...</xmin> <ymin>...</ymin> <xmax>...</xmax> <ymax>...</ymax>
|
|
10
|
+
* </extent>
|
|
11
|
+
* ...
|
|
12
|
+
* </mapcanvas>
|
|
13
|
+
*
|
|
14
|
+
* Returns null if no usable extent is found — caller falls back to layer
|
|
15
|
+
* extents or defaults.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseMapExtent(qgisRoot: Element, projectCrs: string | null): MapExtent | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { devLog } from "../util/devLog.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reads the initial map view extent from <mapcanvas><extent>.
|
|
4
|
+
*
|
|
5
|
+
* The mapcanvas element looks like:
|
|
6
|
+
* <mapcanvas annotationsVisible="1" name="theMapCanvas">
|
|
7
|
+
* <units>degrees</units>
|
|
8
|
+
* <extent>
|
|
9
|
+
* <xmin>...</xmin> <ymin>...</ymin> <xmax>...</xmax> <ymax>...</ymax>
|
|
10
|
+
* </extent>
|
|
11
|
+
* ...
|
|
12
|
+
* </mapcanvas>
|
|
13
|
+
*
|
|
14
|
+
* Returns null if no usable extent is found — caller falls back to layer
|
|
15
|
+
* extents or defaults.
|
|
16
|
+
*/
|
|
17
|
+
export function parseMapExtent(qgisRoot, projectCrs) {
|
|
18
|
+
try {
|
|
19
|
+
// Pick the first <mapcanvas>. Projects can technically have multiple, but
|
|
20
|
+
// the first is the primary view.
|
|
21
|
+
const mapcanvas = qgisRoot.querySelector('mapcanvas');
|
|
22
|
+
if (!mapcanvas)
|
|
23
|
+
return null;
|
|
24
|
+
const extent = mapcanvas.querySelector('extent');
|
|
25
|
+
if (!extent)
|
|
26
|
+
return null;
|
|
27
|
+
const xmin = readNumber(extent, 'xmin');
|
|
28
|
+
const ymin = readNumber(extent, 'ymin');
|
|
29
|
+
const xmax = readNumber(extent, 'xmax');
|
|
30
|
+
const ymax = readNumber(extent, 'ymax');
|
|
31
|
+
if (xmin === null || ymin === null || xmax === null || ymax === null)
|
|
32
|
+
return null;
|
|
33
|
+
// The mapcanvas may have its own CRS via <destinationsrs>. Fall back to
|
|
34
|
+
// project CRS otherwise, since most projects render in the project CRS.
|
|
35
|
+
const canvasCrs = mapcanvas.querySelector('destinationsrs spatialrefsys authid')?.textContent?.trim() || null;
|
|
36
|
+
return { xmin, ymin, xmax, ymax, crs: canvasCrs ?? projectCrs };
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
devLog('qgs/parseExtent', 'failed to read map extent', { error: String(err) });
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function readNumber(parent, tag) {
|
|
44
|
+
const text = parent.querySelector(tag)?.textContent?.trim();
|
|
45
|
+
if (!text)
|
|
46
|
+
return null;
|
|
47
|
+
const value = Number(text);
|
|
48
|
+
return Number.isFinite(value) ? value : null;
|
|
49
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LayerFormLayout } from '../model/QgsProject.ts';
|
|
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 declare function parseFormLayout(maplayer: Element): LayerFormLayout | null;
|