@opengeoweb/webmap-react 9.37.0 → 10.0.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/index.esm.js
CHANGED
|
@@ -2972,10 +2972,15 @@ var MapDraw = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
2972
2972
|
/* Draw selected feature to display it on top */
|
|
2973
2973
|
drawFeatureGeometry(this.getSelectedFeature(), selectedFeatureIndex);
|
|
2974
2974
|
/* Highlight polygon with mousehover */
|
|
2975
|
-
if (isInEditMode === true && this.mouseOverPolygonFeatureIndex === selectedFeatureIndex && this.mouseIsOverVertexNr === VERTEX.NONE && this.snappedPolygonIndex === SNAPPEDFEATURE.NONE && this.selectedEdge === EDGE.NONE || this.mouseIsOverVertexNr === VERTEX.MIDDLE_POINT_OF_FEATURE || linkedFeatures) {
|
|
2975
|
+
if (isInEditMode === true && this.mouseOverPolygonFeatureIndex === selectedFeatureIndex && this.mouseIsOverVertexNr === VERTEX.NONE && this.snappedPolygonIndex === SNAPPEDFEATURE.NONE && this.selectedEdge === EDGE.NONE || this.mouseIsOverVertexNr === VERTEX.MIDDLE_POINT_OF_FEATURE || linkedFeatures !== null && linkedFeatures !== void 0 && linkedFeatures.features && linkedFeatures.features.length > 0) {
|
|
2976
|
+
var _feature3$properties;
|
|
2976
2977
|
var _feature3 = this.getSelectedFeature();
|
|
2977
|
-
var
|
|
2978
|
-
|
|
2978
|
+
var isLinkedFeature = linkedFeatures === null || linkedFeatures === void 0 ? void 0 : linkedFeatures.features.some(function (linkedFeature) {
|
|
2979
|
+
return linkedFeature.id === _feature3.id;
|
|
2980
|
+
});
|
|
2981
|
+
var shouldHighlight = isLinkedFeature && ((_feature3$properties = _feature3.properties) === null || _feature3$properties === void 0 ? void 0 : _feature3$properties.selectionType) !== 'fir';
|
|
2982
|
+
if (shouldHighlight && this.mouseOverPolygonCoordinates.length >= 2) {
|
|
2983
|
+
var featureProperties = _feature3.properties;
|
|
2979
2984
|
ctx.beginPath();
|
|
2980
2985
|
ctx.moveTo(this.mouseOverPolygonCoordinates[0].x, this.mouseOverPolygonCoordinates[0].y);
|
|
2981
2986
|
for (var j = 1; j < this.mouseOverPolygonCoordinates.length; j += 1) {
|
|
@@ -6708,16 +6713,7 @@ var makeLayerPropListFromChildren = function makeLayerPropListFromChildren(child
|
|
|
6708
6713
|
return myChildren;
|
|
6709
6714
|
};
|
|
6710
6715
|
var parseWMJSLayer = function parseWMJSLayer(wmLayer, forceReload) {
|
|
6711
|
-
return
|
|
6712
|
-
var callback = function callback() {
|
|
6713
|
-
if (wmLayer.hasError) {
|
|
6714
|
-
reject(new Error(wmLayer.lastError));
|
|
6715
|
-
} else {
|
|
6716
|
-
resolve(wmLayer);
|
|
6717
|
-
}
|
|
6718
|
-
};
|
|
6719
|
-
wmLayer.parseLayer(callback, forceReload, 'ReactMapView parseWMJSLayer');
|
|
6720
|
-
});
|
|
6716
|
+
return wmLayer.parseLayer(forceReload);
|
|
6721
6717
|
};
|
|
6722
6718
|
var setWMLayerPropsBasedOnChildProps = function setWMLayerPropsBasedOnChildProps(child, wmLayer, mapViewProps) {
|
|
6723
6719
|
var needsRedraw = false;
|
|
@@ -6775,7 +6771,7 @@ var setWMLayerPropsBasedOnChildProps = function setWMLayerPropsBasedOnChildProps
|
|
|
6775
6771
|
};
|
|
6776
6772
|
var addWMLayerPropsBasedOnChildProps = function addWMLayerPropsBasedOnChildProps(child, mapId, props, onUpdateLayerInformation) {
|
|
6777
6773
|
var wmjsMap = getWMJSMapById(mapId);
|
|
6778
|
-
if (!wmjsMap) {
|
|
6774
|
+
if (!wmjsMap || wmjsMap.isDestroyed) {
|
|
6779
6775
|
return;
|
|
6780
6776
|
}
|
|
6781
6777
|
var keepOnTop = child.layerType === LayerType.overLayer || false;
|
|
@@ -6800,11 +6796,18 @@ var addWMLayerPropsBasedOnChildProps = function addWMLayerPropsBasedOnChildProps
|
|
|
6800
6796
|
if (newWMLayer.hasError === true) {
|
|
6801
6797
|
child.onLayerError && child.onLayerError(newWMLayer, new Error(newWMLayer.lastError));
|
|
6802
6798
|
}
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6799
|
+
// This ensures that MultiMapViewConnect works properly.
|
|
6800
|
+
setTimeout(function () {
|
|
6801
|
+
var wmjsMap = getWMJSMapById(mapId);
|
|
6802
|
+
if (!wmjsMap || wmjsMap.isDestroyed) {
|
|
6803
|
+
return;
|
|
6804
|
+
}
|
|
6805
|
+
setWMLayerPropsBasedOnChildProps(child, newWMLayer, props);
|
|
6806
|
+
var layerInfo = getLayerUpdateInfo(newWMLayer, mapId);
|
|
6807
|
+
onUpdateLayerInformation && onUpdateLayerInformation(layerInfo);
|
|
6808
|
+
child.onLayerReady && child.onLayerReady(newWMLayer, wmjsMap);
|
|
6809
|
+
wmjsMap.draw();
|
|
6810
|
+
}, 1);
|
|
6808
6811
|
})["catch"](function (e) {
|
|
6809
6812
|
child.onLayerError && child.onLayerError(e);
|
|
6810
6813
|
});
|
|
@@ -6901,10 +6904,6 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
|
|
|
6901
6904
|
*/
|
|
6902
6905
|
_this.onStartRefetchTimer = function (force) {
|
|
6903
6906
|
var shouldAutoFetch = _this.props.shouldAutoFetch;
|
|
6904
|
-
/* TODO, Maarten Plieger, 2021-09-02
|
|
6905
|
-
This causes many issues, we should improve the update strategy.
|
|
6906
|
-
Certain presets have >20 layers. This causes 20 times parsing the GetCapabilities for a minor update of the store.
|
|
6907
|
-
*/
|
|
6908
6907
|
_this.clearRefetchTimer();
|
|
6909
6908
|
var autoFetchInterval = Number(shouldAutoFetch); // Default true -> 1 minute
|
|
6910
6909
|
var refetch = function refetch() {
|
|
@@ -6914,20 +6913,40 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
|
|
|
6914
6913
|
var mapId = _this.props.mapId;
|
|
6915
6914
|
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6916
6915
|
var layers = wmjsMap === null || wmjsMap === void 0 ? void 0 : wmjsMap.getLayers();
|
|
6917
|
-
layers === null || layers === void 0 || layers.forEach(function (
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6916
|
+
layers === null || layers === void 0 || layers.forEach( /*#__PURE__*/function () {
|
|
6917
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(layer) {
|
|
6918
|
+
var _this2, _props, _mapId, onUpdateLayerInformation, layerInfo;
|
|
6919
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6920
|
+
while (1) switch (_context.prev = _context.next) {
|
|
6921
|
+
case 0:
|
|
6922
|
+
if (!(layer.enabled !== false)) {
|
|
6923
|
+
_context.next = 13;
|
|
6924
|
+
break;
|
|
6925
|
+
}
|
|
6926
|
+
_context.prev = 1;
|
|
6927
|
+
_context.next = 4;
|
|
6928
|
+
return layer.parseLayer();
|
|
6929
|
+
case 4:
|
|
6930
|
+
_this2 = _this, _props = _this2.props;
|
|
6931
|
+
_mapId = _props.mapId, onUpdateLayerInformation = _props.onUpdateLayerInformation;
|
|
6932
|
+
layerInfo = getLayerUpdateInfo(layer, _mapId);
|
|
6933
|
+
onUpdateLayerInformation && onUpdateLayerInformation(layerInfo);
|
|
6934
|
+
_context.next = 13;
|
|
6935
|
+
break;
|
|
6936
|
+
case 10:
|
|
6937
|
+
_context.prev = 10;
|
|
6938
|
+
_context.t0 = _context["catch"](1);
|
|
6939
|
+
console.error(_context.t0);
|
|
6940
|
+
case 13:
|
|
6941
|
+
case "end":
|
|
6942
|
+
return _context.stop();
|
|
6943
|
+
}
|
|
6944
|
+
}, _callee, null, [[1, 10]]);
|
|
6945
|
+
}));
|
|
6946
|
+
return function (_x) {
|
|
6947
|
+
return _ref.apply(this, arguments);
|
|
6948
|
+
};
|
|
6949
|
+
}());
|
|
6931
6950
|
}
|
|
6932
6951
|
};
|
|
6933
6952
|
if (autoFetchInterval > 0) {
|
|
@@ -7210,13 +7229,13 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
|
|
|
7210
7229
|
// ReactWMJSLayer Layer Childs: Detect all ReactLayers connected to WMJSLayers, remove WMJSLayer if there is no ReactLayer
|
|
7211
7230
|
var wmjsLayers = wmjsMap.getLayers();
|
|
7212
7231
|
var onUpdateLayerInformation = props.onUpdateLayerInformation,
|
|
7213
|
-
|
|
7232
|
+
_mapId2 = props.mapId;
|
|
7214
7233
|
wmjsLayers.forEach(function (wmLayer) {
|
|
7215
7234
|
var isWMLayerInReactMapViewChildren = myChildren.find(function (child) {
|
|
7216
7235
|
return child.id === wmLayer.ReactWMJSLayerId;
|
|
7217
7236
|
});
|
|
7218
7237
|
if (!isWMLayerInReactMapViewChildren) {
|
|
7219
|
-
removeWMLayerFromMap(wmLayer,
|
|
7238
|
+
removeWMLayerFromMap(wmLayer, _mapId2, onUpdateLayerInformation);
|
|
7220
7239
|
}
|
|
7221
7240
|
});
|
|
7222
7241
|
// ReactWMJSLayer BaseLayer Childs: For the baseLayers, detect all ReactLayers connected to WMJSLayers, remove WMJSLayer if there is no ReactLayer
|
|
@@ -7243,29 +7262,29 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
|
|
|
7243
7262
|
var layerIsInThisMap = wmjsMap.hasLayer(wmLayer);
|
|
7244
7263
|
if (!layerIsInThisMap) {
|
|
7245
7264
|
// Add a new layer, it is not in the this map
|
|
7246
|
-
addWMLayerPropsBasedOnChildProps(child,
|
|
7265
|
+
addWMLayerPropsBasedOnChildProps(child, _mapId2, props, onUpdateLayerInformation);
|
|
7247
7266
|
needsRedraw = true;
|
|
7248
7267
|
} else {
|
|
7249
7268
|
// Handle existing layer
|
|
7250
7269
|
if (child.name !== undefined && wmLayer.name !== child.name) {
|
|
7251
7270
|
// Handle layer name change
|
|
7252
|
-
wmLayer.setName(child.name).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7271
|
+
wmLayer.setName(child.name).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
7253
7272
|
var layerInfo;
|
|
7254
|
-
return _regeneratorRuntime().wrap(function
|
|
7255
|
-
while (1) switch (
|
|
7273
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7274
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7256
7275
|
case 0:
|
|
7257
|
-
|
|
7258
|
-
return
|
|
7276
|
+
_context2.next = 2;
|
|
7277
|
+
return wmLayer.parseLayer();
|
|
7259
7278
|
case 2:
|
|
7260
|
-
layerInfo = getLayerUpdateInfo(wmLayer,
|
|
7279
|
+
layerInfo = getLayerUpdateInfo(wmLayer, _mapId2);
|
|
7261
7280
|
setWMLayerPropsBasedOnChildProps(child, wmLayer, props);
|
|
7262
7281
|
onUpdateLayerInformation && onUpdateLayerInformation(layerInfo);
|
|
7263
7282
|
wmjsMap.draw();
|
|
7264
7283
|
case 6:
|
|
7265
7284
|
case "end":
|
|
7266
|
-
return
|
|
7285
|
+
return _context2.stop();
|
|
7267
7286
|
}
|
|
7268
|
-
},
|
|
7287
|
+
}, _callee2);
|
|
7269
7288
|
})))["catch"](function (e) {
|
|
7270
7289
|
child.onLayerError && child.onLayerError(wmLayer, e);
|
|
7271
7290
|
});
|
|
@@ -7412,7 +7431,6 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
|
|
|
7412
7431
|
linkedFeatures = _this$props5.linkedFeatures;
|
|
7413
7432
|
var adagucInitialised = this.state.adagucInitialised;
|
|
7414
7433
|
var featureLayers = getFeatureLayers(children);
|
|
7415
|
-
// TODO: Improve in https://gitlab.com/opengeoweb/opengeoweb/-/issues/4579
|
|
7416
7434
|
featureLayers.forEach(function (featureLayer) {
|
|
7417
7435
|
var wmFeatureLayer = getWMLayerById(featureLayer.id);
|
|
7418
7436
|
if (!wmFeatureLayer) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/webmap-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "GeoWeb react wrapper for webmap",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"react-resize-detector": "^9.1.0",
|
|
20
20
|
"i18next": "^23.11.5",
|
|
21
21
|
"@mui/material": "^6.1.1",
|
|
22
|
-
"react-i18next": "^15.1.1"
|
|
22
|
+
"react-i18next": "^15.1.1",
|
|
23
|
+
"@tanstack/react-query": "^5.61.5"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"react": "18",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GetCapabilitiesJson, WMSServiceInfo, LayerTree, LayerProps, WMLayer } from '@opengeoweb/webmap';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
/**
|
|
4
|
+
* Queries the WMS GetCapabilities. This is the base TanStack hook for the other hooks in this file.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} serviceUrl
|
|
7
|
+
* @returns {UseQueryResult<GetCapabilitiesJson>}
|
|
8
|
+
*/
|
|
9
|
+
export declare const useQueryGetWMSGetCapabilities: (serviceUrl: string) => UseQueryResult<GetCapabilitiesJson>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns details about the WMS service
|
|
12
|
+
*
|
|
13
|
+
* @param {string} serviceUrl
|
|
14
|
+
* @returns {(WMSServiceInfo | null)}
|
|
15
|
+
*/
|
|
16
|
+
export declare const useQueryGetWMSServiceInfo: (serviceUrl: string) => WMSServiceInfo | null;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the layer tree in hierarchical order for a WMS service. Cached by TanStack. Uses the same store as in queryWMSGetCapabilities.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} serviceUrl
|
|
21
|
+
* @returns {(LayerTree | null)}
|
|
22
|
+
*/
|
|
23
|
+
export declare const useQueryGetWMSLayersTree: (serviceUrl: string) => LayerTree | null;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the flat layer list (without hierarchy) for a WMS service. Cached by TanStack. Uses the same store as in queryWMSGetCapabilities.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} serviceUrl
|
|
28
|
+
* @returns {LayerProps[]}
|
|
29
|
+
*/
|
|
30
|
+
export declare const useQueryGetWMSLayers: (serviceUrl: string) => LayerProps[];
|
|
31
|
+
/**
|
|
32
|
+
* Returns specific layer from the WMS service
|
|
33
|
+
*
|
|
34
|
+
* @param {string} serviceUrl
|
|
35
|
+
* @param {string} name
|
|
36
|
+
* @returns {(LayerProps | null)}
|
|
37
|
+
*/
|
|
38
|
+
export declare const useQueryGetWMSLayer: (serviceUrl: string, name: string) => LayerProps | null;
|
|
39
|
+
/**
|
|
40
|
+
* Returns WMLayer instance. The layer will contains parsed dimensions and styles and keeps a state for these properties.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} serviceUrl
|
|
43
|
+
* @param {string} name
|
|
44
|
+
* @returns {(WMLayer | null)}
|
|
45
|
+
*/
|
|
46
|
+
export declare const useGetWMLayerInstance: (serviceUrl: string, name: string) => WMLayer | null;
|