ol-wfst 4.2.0 → 4.4.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.
Files changed (87) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +72 -22
  3. package/dist/@enums.d.ts +17 -0
  4. package/dist/@enums.d.ts.map +1 -0
  5. package/dist/@types.d.ts +206 -0
  6. package/dist/@types.d.ts.map +1 -0
  7. package/dist/Geoserver.d.ts +275 -0
  8. package/dist/Geoserver.d.ts.map +1 -0
  9. package/dist/WfsLayer.d.ts +51 -0
  10. package/dist/WfsLayer.d.ts.map +1 -0
  11. package/dist/WmsLayer.d.ts +69 -0
  12. package/dist/WmsLayer.d.ts.map +1 -0
  13. package/dist/css/ol-wfst.bootstrap5.css +18 -18
  14. package/dist/css/ol-wfst.bootstrap5.min.css +1 -1
  15. package/dist/css/ol-wfst.css +26 -39
  16. package/dist/css/ol-wfst.min.css +1 -1
  17. package/dist/defaults.d.ts +4 -0
  18. package/dist/defaults.d.ts.map +1 -0
  19. package/dist/index-umd.d.ts +3 -0
  20. package/dist/index-umd.d.ts.map +1 -0
  21. package/dist/modules/EditControlChanges.d.ts +18 -0
  22. package/dist/modules/EditControlChanges.d.ts.map +1 -0
  23. package/dist/modules/EditFieldsModal.d.ts +19 -0
  24. package/dist/modules/EditFieldsModal.d.ts.map +1 -0
  25. package/dist/modules/EditOverlay.d.ts +8 -0
  26. package/dist/modules/EditOverlay.d.ts.map +1 -0
  27. package/dist/modules/LayersControl.d.ts +38 -0
  28. package/dist/modules/LayersControl.d.ts.map +1 -0
  29. package/dist/modules/Uploads.d.ts +50 -0
  30. package/dist/modules/Uploads.d.ts.map +1 -0
  31. package/dist/modules/base/BaseLayer.d.ts +62 -0
  32. package/dist/modules/base/BaseLayer.d.ts.map +1 -0
  33. package/dist/modules/base/WfsSource.d.ts +49 -0
  34. package/dist/modules/base/WfsSource.d.ts.map +1 -0
  35. package/dist/modules/base/WmsSource.d.ts +47 -0
  36. package/dist/modules/base/WmsSource.d.ts.map +1 -0
  37. package/dist/modules/editLayer.d.ts +4 -0
  38. package/dist/modules/editLayer.d.ts.map +1 -0
  39. package/dist/modules/errors.d.ts +12 -0
  40. package/dist/modules/errors.d.ts.map +1 -0
  41. package/dist/modules/helpers.d.ts +7 -0
  42. package/dist/modules/helpers.d.ts.map +1 -0
  43. package/dist/modules/i18n/en.d.ts +3 -0
  44. package/dist/modules/i18n/en.d.ts.map +1 -0
  45. package/dist/modules/i18n/es.d.ts +3 -0
  46. package/dist/modules/i18n/es.d.ts.map +1 -0
  47. package/dist/modules/i18n/index.d.ts +15 -0
  48. package/dist/modules/i18n/index.d.ts.map +1 -0
  49. package/dist/modules/i18n/zh.d.ts +3 -0
  50. package/dist/modules/i18n/zh.d.ts.map +1 -0
  51. package/dist/modules/loading.d.ts +3 -0
  52. package/dist/modules/loading.d.ts.map +1 -0
  53. package/dist/modules/state.d.ts +22 -0
  54. package/dist/modules/state.d.ts.map +1 -0
  55. package/dist/modules/styleFunction.d.ts +13 -0
  56. package/dist/modules/styleFunction.d.ts.map +1 -0
  57. package/dist/myPragma.d.ts +2 -0
  58. package/dist/myPragma.d.ts.map +1 -0
  59. package/dist/ol-wfst.d.ts +340 -0
  60. package/dist/ol-wfst.d.ts.map +1 -0
  61. package/dist/ol-wfst.js +99 -56
  62. package/dist/ol-wfst.js.map +1 -1
  63. package/dist/ol-wfst.min.js +3 -3
  64. package/dist/ol-wfst.min.js.map +1 -1
  65. package/lib/@types.d.ts +14 -9
  66. package/lib/@types.d.ts.map +1 -1
  67. package/lib/Geoserver.d.ts.map +1 -1
  68. package/lib/WfsLayer.d.ts +2 -4
  69. package/lib/WfsLayer.d.ts.map +1 -1
  70. package/lib/WmsLayer.d.ts +2 -2
  71. package/lib/WmsLayer.d.ts.map +1 -1
  72. package/lib/modules/EditFieldsModal.d.ts +2 -2
  73. package/lib/modules/EditFieldsModal.d.ts.map +1 -1
  74. package/lib/modules/LayersControl.d.ts +8 -4
  75. package/lib/modules/LayersControl.d.ts.map +1 -1
  76. package/lib/modules/base/WfsSource.d.ts +2 -1
  77. package/lib/modules/base/WfsSource.d.ts.map +1 -1
  78. package/lib/ol-wfst.d.ts +25 -22
  79. package/lib/ol-wfst.d.ts.map +1 -1
  80. package/lib/ol-wfst.js +99 -56
  81. package/lib/ol-wfst.js.map +1 -1
  82. package/lib/style/css/ol-gisify.css +26 -39
  83. package/lib/style/css/ol-wfst.bootstrap5.css +18 -18
  84. package/lib/style/scss/ol-wfst.scss +82 -58
  85. package/package.json +5 -5
  86. package/dist/tsconfig.tsbuildinfo +0 -1
  87. package/lib/tsconfig.tsbuildinfo +0 -1
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Gastón Zalba
3
+ Copyright (c) 2024 Gastón Zalba
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -12,9 +12,9 @@
12
12
  </a>
13
13
  </p>
14
14
 
15
- Tiny WFS-T client to insert (drawing/uploading), modify and delete features on GeoServers using [OpenLayers](https://openlayers.org/). Layers with these types of geometries are supported: *GeometryCollection* (in this case, you can choose the geometry type of each element to draw), *Point*, *MultiPoint*, *LineString*, *MultiLineString*, *Polygon* and *MultiPolygon*.
15
+ Tiny WFS-T client to insert (drawing/uploading), modify and delete features on GeoServers using [OpenLayers](https://openlayers.org/). Layers with these types of geometries are supported: _GeometryCollection_ (in this case, you can choose the geometry type of each element to draw), _Point_, _MultiPoint_, _LineString_, _MultiLineString_, _Polygon_ and _MultiPolygon_.
16
16
 
17
- Tested with OpenLayers version 5, 6, 7 and 8.
17
+ Tested with OpenLayers version 5, 6, 7, 8 and 9.
18
18
 
19
19
  <img src="screenshots/example-1.jpg" alt="Drawing" style="width:50%; float:left;">
20
20
  <img src="screenshots/example-2.jpg" alt="Editing fields" style="width:50%; float:left;">
@@ -109,6 +109,44 @@ const wmsLayer = new WmsLayer({
109
109
  }
110
110
 
111
111
  return feature;
112
+ },
113
+ beforeShowFieldsModal: function (field, value, formElement) {
114
+ // Transform default input to a custom select
115
+ if (field.name === 'source') {
116
+ const createSelect = (name, options) => {
117
+ const createOption = (opt) => {
118
+ const option = document.createElement('option');
119
+ option.value = opt.value;
120
+ option.label = opt.label;
121
+
122
+ if (opt.value === value) {
123
+ option.selected = true;
124
+ }
125
+ return option;
126
+ };
127
+
128
+ const select = document.createElement('select');
129
+ select.className = 'ol-wfst--input-field-input';
130
+ select.name = name;
131
+
132
+ options.forEach((opt) => {
133
+ select.appendChild(createOption(opt));
134
+ });
135
+
136
+ return select;
137
+ };
138
+
139
+ return createSelect('source', [
140
+ { label: 'Select source', value: '' },
141
+ { label: 'Option 1', value: 'option1' },
142
+ { label: 'Option 2', value: 'option2' }
143
+ ]);
144
+ } else if (field.name === 'registroid') {
145
+ // add default class to the HTMLElement in a particular field
146
+ formElement.classList.add('custom-field-class');
147
+ }
148
+
149
+ return formElement;
112
150
  }
113
151
  });
114
152
 
@@ -126,7 +164,6 @@ map.addControl(wfst);
126
164
  See \[#wfsSource]
127
165
 
128
166
  ```js
129
-
130
167
  wmsLayer.setCustomParam('cql_filter', `id = 28`);
131
168
  wmsLayer.setCustomParam('env', `tags=true`);
132
169
  ```
@@ -221,14 +258,14 @@ See [CHANGELOG](./CHANGELOG.md) for details of changes in each release.
221
258
  Load `ol-wfst.js` after OpenLayers. The available classes are `Wfst`, `Wfst.Geoserver`, `Wfst.WfsLayer` and `Wfst.WmsLayer`.
222
259
 
223
260
  ```HTML
224
- <script src="https://unpkg.com/ol-wfst@4.2.0"></script>
261
+ <script src="https://unpkg.com/ol-wfst@4.4.0"></script>
225
262
  ```
226
263
 
227
264
  #### CSS
228
265
 
229
266
  ```HTML
230
- <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.2.0/dist/css/ol-wfst.min.css" />
231
- <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.2.0/dist/css/ol-wfst.bootstrap5.min.css" />
267
+ <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.4.0/dist/css/ol-wfst.min.css" />
268
+ <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.4.0/dist/css/ol-wfst.bootstrap5.min.css" />
232
269
  ```
233
270
 
234
271
  ### Parcel, Webpack, etc.
@@ -344,6 +381,7 @@ TypeScript types are shipped with the project in the dist directory and should b
344
381
  - [label](#label)
345
382
  - [geoserverVendor](#geoservervendor)
346
383
  - [strategy](#strategy)
384
+ - [beforeShowFieldsModal](#beforeshowfieldsmodal)
347
385
  - [GeoserverOptions](#geoserveroptions)
348
386
  - [url](#url)
349
387
  - [advanced](#advanced)
@@ -363,6 +401,7 @@ TypeScript types are shipped with the project in the dist directory and should b
363
401
  - [time](#time)
364
402
  - [sld](#sld)
365
403
  - [sld_body](#sld_body)
404
+ - [IProperty](#iproperty)
366
405
  - [IGeoserverDescribeFeatureType](#igeoserverdescribefeaturetype)
367
406
  - [\_parsed](#_parsed)
368
407
  - [I18n](#i18n-1)
@@ -428,7 +467,7 @@ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
428
467
 
429
468
  **Extends ol/control/[Control](https://openlayers.org/en/latest/apidoc/module-ol_control_Control-Control.html)~[Control](https://openlayers.org/en/latest/apidoc/module-ol_control_Control-Control.html)**
430
469
 
431
- Tiny WFST-T client to insert (drawing/uploading), modify and delete
470
+ Tiny WFS-T client to insert (drawing/uploading), modify and delete
432
471
  features on GeoServers using OpenLayers. Layers with these types
433
472
  of geometries are supported: "GeometryCollection" (in this case, you can
434
473
  choose the geometry type of each element to draw), "Point", "MultiPoint",
@@ -805,6 +844,13 @@ By default `all` strategy is used
805
844
 
806
845
  Type: LoadingStrategy
807
846
 
847
+ #### beforeShowFieldsModal
848
+
849
+ Hook to customize the html elements showed in the fields modal
850
+ Return `null` to hide the field from the modal
851
+
852
+ Type: function (field: [IProperty](#iproperty), value: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), formElement: [HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)): ([HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null)
853
+
808
854
  ### GeoserverOptions
809
855
 
810
856
  **_\[interface]_**
@@ -945,6 +991,10 @@ A URL-encoded StyledLayerDescriptor XML document which controls or enhances map
945
991
 
946
992
  Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
947
993
 
994
+ ### IProperty
995
+
996
+ **_\[interface]_** - Geoserver original layer properties response on DescribeFeature request
997
+
948
998
  ### IGeoserverDescribeFeatureType
949
999
 
950
1000
  **_\[interface]_** - Geoserver original response on DescribeFeature request
@@ -953,7 +1003,7 @@ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
953
1003
 
954
1004
  DescribeFeature request parsed
955
1005
 
956
- Type: {namespace: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), properties: any, geomType: GeometryType, geomField: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}
1006
+ Type: {namespace: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), properties: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[IProperty](#iproperty)>, geomType: GeometryType, geomField: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}
957
1007
 
958
1008
  ### I18n
959
1009
 
@@ -973,17 +1023,17 @@ Type: {capabilities: [string](https://developer.mozilla.org/docs/Web/JavaScript/
973
1023
 
974
1024
  ## TODO
975
1025
 
976
- * ~~Add support to diferent layer styles~~
977
- * ~~Improve widget controller: visibility toggle~~
978
- * ~~Add events~~
979
- * Add `Don't show again` option in the error modal
980
- * Allow selection of multiples features and bulk edit
981
- * Add customizables styles
982
- * Improve scss (add variables)
983
- * Add cookies to persist widget controller state
984
- * Geometry type *LinearRing* support
985
- * Tests!
986
- * Improve comments and documentation
987
- * Improve interface
988
- * Change svg imports to preserve svg structure
989
- * Improve style on editing and drawing features
1026
+ - \~~Add support to diferent layer styles~~
1027
+ - \~~Improve widget controller: visibility toggle~~
1028
+ - \~~Add events~~
1029
+ - Add `Don't show again` option in the error modal
1030
+ - Allow selection of multiples features and bulk edit
1031
+ - Add customizables styles
1032
+ - Improve scss (add variables)
1033
+ - Add cookies to persist widget controller state
1034
+ - Geometry type _LinearRing_ support
1035
+ - Tests!
1036
+ - Improve comments and documentation
1037
+ - Improve interface
1038
+ - Change svg imports to preserve svg structure
1039
+ - Improve style on editing and drawing features
@@ -0,0 +1,17 @@
1
+ export declare enum GeometryType {
2
+ Point = "Point",
3
+ LineString = "LineString",
4
+ LinearRing = "LinearRing",
5
+ Polygon = "Polygon",
6
+ MultiPoint = "MultiPoint",
7
+ MultiLineString = "MultiLineString",
8
+ MultiPolygon = "MultiPolygon",
9
+ GeometryCollection = "GeometryCollection",
10
+ Circle = "Circle"
11
+ }
12
+ export declare enum TransactionType {
13
+ Insert = "insert",
14
+ Delete = "delete",
15
+ Update = "update"
16
+ }
17
+ //# sourceMappingURL=@enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@enums.d.ts","sourceRoot":"","sources":["../src/@enums.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACpB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,kBAAkB,uBAAuB;IACzC,MAAM,WAAW;CACpB;AAED,oBAAY,eAAe;IACvB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB"}
@@ -0,0 +1,206 @@
1
+ import { GeometryType } from './@enums';
2
+ import WfsLayer from './WfsLayer';
3
+ import WmsLayer from './WmsLayer';
4
+ /**
5
+ * @public
6
+ */
7
+ export interface BaseGeoserverVendor {
8
+ /**
9
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#cql-filter
10
+ */
11
+ cql_filter?: string;
12
+ /**
13
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#sortBy
14
+ */
15
+ sortBy?: string;
16
+ /**
17
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#featureid
18
+ */
19
+ featureid?: string;
20
+ /**
21
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#filter
22
+ */
23
+ filter?: string;
24
+ /**
25
+ * WMS: https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#format-options
26
+ * WFS: https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html#format-options
27
+ */
28
+ format_options?: string;
29
+ /**
30
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#maxfeatures-and-startindex
31
+ */
32
+ maxFeatures?: string | number;
33
+ /**
34
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#maxfeatures-and-startindex
35
+ */
36
+ startIndex?: string | number;
37
+ /**
38
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#propertyname
39
+ */
40
+ propertyname?: string;
41
+ /**
42
+ * Add any other param
43
+ */
44
+ [key: string]: any;
45
+ }
46
+ /**
47
+ * **_[interface]_** - WFS geoserver options
48
+ * https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html
49
+ * @public
50
+ *
51
+ */
52
+ export interface WfsGeoserverVendor extends BaseGeoserverVendor {
53
+ /**
54
+ * https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html#xml-request-validation
55
+ */
56
+ strict?: boolean;
57
+ }
58
+ /**
59
+ * **_[interface]_** - WMS geoserver options
60
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html
61
+ * @public
62
+ */
63
+ export interface WmsGeoserverVendor extends BaseGeoserverVendor {
64
+ /**
65
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#buffer
66
+ */
67
+ buffer?: string | number;
68
+ /**
69
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#env
70
+ */
71
+ env?: string;
72
+ /**
73
+ * https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#clip
74
+ */
75
+ clip?: string;
76
+ /**
77
+ * Styles in which layers are to be rendered.
78
+ * Value is a comma-separated list of style names, or empty if default styling is required.
79
+ * Style names may be empty in the list, to use default layer styling.
80
+ */
81
+ styles?: string;
82
+ /**
83
+ * Whether the map background should be transparent. Values are true or false. Default is false
84
+ */
85
+ transparent?: boolean;
86
+ /**
87
+ * Background color for the map image. Value is in the form RRGGBB. Default is FFFFFF (white).
88
+ */
89
+ bgcolor?: string;
90
+ /**
91
+ * Time value or range for map data.
92
+ * See [Time Support in GeoServer WMS](https://docs.geoserver.org/stable/en/user/services/wms/time.html#wms-time) for more information.
93
+ */
94
+ time?: string;
95
+ /**
96
+ * A URL referencing a [StyledLayerDescriptor](https://docs.geoserver.org/stable/en/user/styling/index.html#styling)
97
+ * XML file which controls or enhances map layers and styling
98
+ */
99
+ sld?: string;
100
+ /**
101
+ * A URL-encoded StyledLayerDescriptor XML document which controls or enhances map layers and styling
102
+ */
103
+ sld_body?: string;
104
+ }
105
+ export interface ExceptionGeoserver {
106
+ code: string;
107
+ locator: string;
108
+ text: string;
109
+ }
110
+ /**
111
+ * **_[interface]_** - Geoserver original layer properties response on DescribeFeature request
112
+ * @public
113
+ */
114
+ export interface IProperty {
115
+ name: string;
116
+ nillable: boolean;
117
+ maxOccurs: number;
118
+ minOccurs: number;
119
+ type: string;
120
+ localType: string;
121
+ }
122
+ /**
123
+ * **_[interface]_** - Geoserver original response on DescribeFeature request
124
+ * @public
125
+ */
126
+ export interface IGeoserverDescribeFeatureType {
127
+ exceptions?: ExceptionGeoserver[];
128
+ elementFormDefault: string;
129
+ targetNamespace: string;
130
+ targetPrefix: string;
131
+ featureTypes: Array<{
132
+ typeName: string;
133
+ properties: Array<IProperty>;
134
+ }>;
135
+ /**
136
+ * DescribeFeature request parsed
137
+ */
138
+ _parsed: {
139
+ namespace: string;
140
+ properties: Array<IProperty>;
141
+ geomType: GeometryType;
142
+ geomField: string;
143
+ };
144
+ }
145
+ /**
146
+ * **_[interface]_**
147
+ * @private
148
+ */
149
+ export interface IWfstLayersList {
150
+ [key: string]: WfsLayer | WmsLayer;
151
+ }
152
+ /**
153
+ * **_[interface]_**
154
+ * @private
155
+ */
156
+ export interface IGeoserverOptions {
157
+ hasTransaction?: boolean;
158
+ hasLockFeature?: boolean;
159
+ useLockFeature?: boolean;
160
+ }
161
+ /**
162
+ * **_[interface]_** - Custom Language specified when creating a WFST instance
163
+ * @public
164
+ */
165
+ export interface I18n {
166
+ /** Labels section */
167
+ labels?: {
168
+ select?: string;
169
+ addElement?: string;
170
+ editElement?: string;
171
+ save?: string;
172
+ delete?: string;
173
+ cancel?: string;
174
+ apply?: string;
175
+ upload?: string;
176
+ editMode?: string;
177
+ confirmDelete?: string;
178
+ geomTypeNotSupported?: string;
179
+ editFields?: string;
180
+ editGeom?: string;
181
+ selectDrawType?: string;
182
+ uploadToLayer?: string;
183
+ uploadFeatures?: string;
184
+ validFeatures?: string;
185
+ invalidFeatures?: string;
186
+ loading?: string;
187
+ toggleVisibility?: string;
188
+ close?: string;
189
+ };
190
+ /** Errors section */
191
+ errors?: {
192
+ capabilities?: string;
193
+ wfst?: string;
194
+ layer?: string;
195
+ layerNotFound?: string;
196
+ layerNotVisible?: string;
197
+ noValidGeometry?: string;
198
+ geoserver?: string;
199
+ badFormat?: string;
200
+ badFile?: string;
201
+ lockFeature?: string;
202
+ transaction?: string;
203
+ getFeatures?: string;
204
+ };
205
+ }
206
+ //# sourceMappingURL=@types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@types.d.ts","sourceRoot":"","sources":["../src/@types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,QAAQ,MAAM,YAAY,CAAC;A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ventTypes } from 'ol/ObjectEventType.js';
3
+ import { ProjectionLike } from 'ol/proj.js';
4
+ import Circle from 'ol/geom/Circle.js';
5
+ import Geometry from 'ol/geom/Geometry.js';
6
+ import GeometryCollection from 'ol/geom/GeometryCollection.js';
7
+ import Feature from 'ol/Feature.js';
8
+ import GeoJSON from 'ol/format/GeoJSON.js';
9
+ import KML from 'ol/format/KML.js';
10
+ import WFS from 'ol/format/WFS.js';
11
+ import { State } from 'ol/source/Source.js';
12
+ import BaseEvent from 'ol/events/Event.js';
13
+ import { CombinedOnSignature, EventTypes, OnSignature } from 'ol/Observable.js';
14
+ import { EventsKey } from 'ol/events.js';
15
+ import { TransactionResponse } from 'ol/format/WFS.js';
16
+ import { TransactionType } from './@enums';
17
+ /**
18
+ * @fires change:capabilities
19
+ * @extends {ol/Object~BaseObject}
20
+ * @param options
21
+ */
22
+ export default class Geoserver extends BaseObject {
23
+ protected _options: GeoserverOptions;
24
+ protected _countRequests: number;
25
+ protected _insertFeatures: Array<Feature<Geometry>>;
26
+ protected _updateFeatures: Array<Feature<Geometry>>;
27
+ protected _deleteFeatures: Array<Feature<Geometry>>;
28
+ protected _formatWFS: WFS;
29
+ protected _formatGeoJSON: GeoJSON;
30
+ protected _formatKml: KML;
31
+ protected _xs: XMLSerializer;
32
+ protected state_: State;
33
+ on: OnSignature<EventTypes, BaseEvent, EventsKey> & OnSignature<GeoserverEventTypes | ObjectEventTypes, ObjectEvent, EventsKey> & CombinedOnSignature<GeoserverEventTypes | ObjectEventTypes | EventTypes, EventsKey>;
34
+ once: OnSignature<EventTypes, BaseEvent, EventsKey> & OnSignature<GeoserverEventTypes | ObjectEventTypes, ObjectEvent, EventsKey> & CombinedOnSignature<GeoserverEventTypes | ObjectEventTypes | EventTypes, EventsKey>;
35
+ un: OnSignature<EventTypes, BaseEvent, void> & OnSignature<GeoserverEventTypes | ObjectEventTypes, ObjectEvent, void> & CombinedOnSignature<GeoserverEventTypes | ObjectEventTypes | EventTypes, void>;
36
+ constructor(options: GeoserverOptions);
37
+ /**
38
+ *
39
+ * @returns
40
+ * @public
41
+ */
42
+ getCapabilities(): XMLDocument;
43
+ /**
44
+ * Only work for `2.0.0` getCapabilities version
45
+ * @returns
46
+ * @public
47
+ */
48
+ getParsedCapabilities(): any;
49
+ /**
50
+ *
51
+ * @param url
52
+ * @param opt_silent
53
+ * @public
54
+ */
55
+ setUrl(url: string, opt_silent?: boolean): void;
56
+ /**
57
+ *
58
+ * @returns
59
+ */
60
+ getUrl(): string;
61
+ /**
62
+ *
63
+ * @param headers
64
+ * @param opt_silent
65
+ * @returns
66
+ * @public
67
+ */
68
+ setHeaders(headers?: HeadersInit, opt_silent?: boolean): void;
69
+ /**
70
+ *
71
+ * @returns
72
+ * @public
73
+ */
74
+ getHeaders(): HeadersInit;
75
+ /**
76
+ *
77
+ * @param credentials
78
+ * @param opt_silent
79
+ * @public
80
+ */
81
+ setCredentials(credentials?: RequestCredentials, opt_silent?: boolean): void;
82
+ /**
83
+ *
84
+ * @returns
85
+ * @public
86
+ */
87
+ getCredentials(): RequestCredentials;
88
+ /**
89
+ *
90
+ * @returns
91
+ * @public
92
+ */
93
+ setAdvanced(advanced?: GeoServerAdvanced, opt_silent?: boolean): void;
94
+ /**
95
+ *
96
+ * @returns
97
+ * @public
98
+ */
99
+ getAdvanced(): GeoServerAdvanced;
100
+ /**
101
+ *
102
+ * @returns
103
+ * @public
104
+ */
105
+ hasTransaction(): boolean;
106
+ /**
107
+ *
108
+ * @returns
109
+ * @public
110
+ */
111
+ hasLockFeature(): boolean;
112
+ /**
113
+ *
114
+ * @returns
115
+ * @public
116
+ */
117
+ getUseLockFeature(): boolean;
118
+ /**
119
+ *
120
+ * @returns
121
+ * @public
122
+ */
123
+ setUseLockFeature(useLockFeature: boolean, opt_silent?: boolean): void;
124
+ /**
125
+ *
126
+ * @returns
127
+ * @public
128
+ */
129
+ isLoaded(): boolean;
130
+ /**
131
+ *
132
+ * @returns
133
+ */
134
+ getState(): State;
135
+ /**
136
+ * Get the capabilities from the GeoServer and check
137
+ * all the available operations.
138
+ *
139
+ * @fires getcapabilities
140
+ * @public
141
+ */
142
+ getAndUpdateCapabilities(): Promise<XMLDocument>;
143
+ /**
144
+ *
145
+ * @private
146
+ */
147
+ _checkGeoserverCapabilities(): void;
148
+ /**
149
+ * Make the WFS Transactions
150
+ *
151
+ * @param transactionType
152
+ * @param features
153
+ * @param layerName
154
+ * @private
155
+ */
156
+ transact(transactionType: TransactionType, features: Array<Feature<Geometry>> | Feature<Geometry>, layerName: string): Promise<TransactionResponse | false>;
157
+ /**
158
+ * @privatwe
159
+ */
160
+ _removeFeatures(features: Feature<Geometry>[]): void;
161
+ /**
162
+ *
163
+ * @param feature
164
+ * @param geom
165
+ * @private
166
+ */
167
+ _transformCircleToPolygon(feature: Feature<Geometry>, geom: Circle): void;
168
+ /**
169
+ *
170
+ * @param feature
171
+ * @private
172
+ * @param geom
173
+ */
174
+ _transformGeoemtryCollectionToGeometries(feature: Feature<Geometry>, geom: GeometryCollection): void;
175
+ /**
176
+ *
177
+ * @param feature
178
+ * @returns
179
+ * @private
180
+ */
181
+ _cloneFeature(feature: Feature<Geometry>): Feature<Geometry>;
182
+ /**
183
+ * Lock a feature in the geoserver. Useful before editing a geometry,
184
+ * to avoid changes from multiples suers
185
+ *
186
+ * @param featureId
187
+ * @param layerName
188
+ * @param retry
189
+ * @public
190
+ */
191
+ lockFeature(featureId: string | number, layerName: string, retry?: number): Promise<string>;
192
+ }
193
+ /**
194
+ * **_[interface]_**
195
+ * @public
196
+ */
197
+ export interface GeoserverOptions {
198
+ /**
199
+ * Url for OWS services. This endpoint will recive the WFS, WFST and WMS requests
200
+ *
201
+ */
202
+ url: string;
203
+ /**
204
+ * Advanced options for geoserver requests
205
+ *
206
+ */
207
+ advanced?: GeoServerAdvanced;
208
+ /**
209
+ * Http headers for GeoServer requests
210
+ * https://developer.mozilla.org/en-US/docs/Web/API/Request/headers
211
+ *
212
+ */
213
+ headers?: HeadersInit;
214
+ /**
215
+ * Credentials for fetch requests
216
+ * https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials
217
+ *
218
+ * Default is 'same-origin'
219
+ */
220
+ credentials?: RequestCredentials;
221
+ /**
222
+ * Use LockFeatue request on GeoServer when selecting features. Prevents a feature from being edited
223
+ * through a persistent feature lock. This is not always supportedd by the GeoServer.
224
+ * See https://docs.geoserver.org/stable/en/user/services/wfs/reference.html
225
+ */
226
+ useLockFeature?: boolean;
227
+ }
228
+ /**
229
+ * **_[interface]_**
230
+ *
231
+ * * Default values:
232
+ * ```javascript
233
+ * {
234
+ * getCapabilitiesVersion: '2.0.0',
235
+ * getFeatureVersion: '1.0.0',
236
+ * describeFeatureTypeVersion: '1.1.0',
237
+ * lockFeatureVersion: '1.1.0',
238
+ * wfsTransactionVersion: '1.1.0',
239
+ * projection: 'EPSG:3857',
240
+ * lockFeatureParams: {
241
+ * expiry: 5,
242
+ * lockId: 'Geoserver',
243
+ * releaseAction: 'SOME'
244
+ * }
245
+ * }
246
+ * @public
247
+ */
248
+ export interface GeoServerAdvanced {
249
+ getCapabilitiesVersion?: string;
250
+ getFeatureVersion?: string;
251
+ lockFeatureVersion?: string;
252
+ describeFeatureTypeVersion?: string;
253
+ wfsTransactionVersion?: string;
254
+ projection?: ProjectionLike;
255
+ lockFeatureParams?: {
256
+ expiry?: number | string;
257
+ lockId?: string;
258
+ releaseAction?: string;
259
+ };
260
+ }
261
+ export declare enum GeoserverProperty {
262
+ CAPABILITIES = "capabilities",
263
+ PARSED_CAPABILITIES = "parsedCapabilities",
264
+ URL = "url",
265
+ HEADERS = "headers",
266
+ CREDENTIALS = "credentials",
267
+ ADVANCED = "advanced",
268
+ HASTRASNACTION = "hasTransaction",
269
+ HASLOCKFEATURE = "hasLockFeature",
270
+ HASDESCRIBEFEATURETYPE = "hasDescribeFeatureType",
271
+ USELOCKFEATURE = "useLockFeature",
272
+ ISLOADED = "isLoaded"
273
+ }
274
+ export type GeoserverEventTypes = `change:${GeoserverProperty.CAPABILITIES}` | `change:${GeoserverProperty.PARSED_CAPABILITIES}` | `change:${GeoserverProperty.URL}` | `change:${GeoserverProperty.HEADERS}` | `change:${GeoserverProperty.CREDENTIALS}` | `change:${GeoserverProperty.ADVANCED}` | `change:${GeoserverProperty.HASTRASNACTION}` | `change:${GeoserverProperty.HASLOCKFEATURE}` | `change:${GeoserverProperty.HASDESCRIBEFEATURETYPE}` | `change:${GeoserverProperty.USELOCKFEATURE}` | `change:${GeoserverProperty.ISLOADED}`;
275
+ //# sourceMappingURL=Geoserver.d.ts.map