@opengeoweb/webmap-react 9.21.0 → 9.22.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
4
|
-
import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } from '@opengeoweb/webmap';
|
|
4
|
+
import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, getPixelCoordFromLatLong, WMJSMAP_LONLAT_EPSGCODE, getLatLongFromPixelCoord, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } from '@opengeoweb/webmap';
|
|
5
5
|
import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils } from '@opengeoweb/shared';
|
|
6
6
|
import i18n from 'i18next';
|
|
7
7
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
@@ -175,24 +175,24 @@ var nl = {
|
|
|
175
175
|
"webmap-react-click-disconnect": "Klik om laag los te koppelen",
|
|
176
176
|
"webmap-react-click-connect": "Klik om laag te koppelen",
|
|
177
177
|
"webmap-react-layer-info": "Laag Informatie",
|
|
178
|
-
"webmap-react-vertical-level": "
|
|
179
|
-
"webmap-react-hpa": "
|
|
180
|
-
"webmap-react-ensemble-member": "
|
|
181
|
-
"webmap-react-member": "
|
|
182
|
-
"webmap-react-probability": "
|
|
183
|
-
"webmap-react-percent": "
|
|
184
|
-
"webmap-react-level": "
|
|
185
|
-
"webmap-react-west": "
|
|
186
|
-
"webmap-react-east": "
|
|
187
|
-
"webmap-react-north": "
|
|
188
|
-
"webmap-react-south": "
|
|
189
|
-
"webmap-react-new-linestring-created": "
|
|
190
|
-
"webmap-react-new-feature": "
|
|
191
|
-
"webmap-react-new-point": "
|
|
192
|
-
"webmap-react-point": "
|
|
193
|
-
"webmap-react-polygon": "
|
|
194
|
-
"webmap-react-box": "
|
|
195
|
-
"webmap-react-linestring": "
|
|
178
|
+
"webmap-react-vertical-level": "Verticaal niveau",
|
|
179
|
+
"webmap-react-hpa": "hPa",
|
|
180
|
+
"webmap-react-ensemble-member": "Ensemble lid",
|
|
181
|
+
"webmap-react-member": "lid",
|
|
182
|
+
"webmap-react-probability": "Waarschijnlijkheid",
|
|
183
|
+
"webmap-react-percent": "%",
|
|
184
|
+
"webmap-react-level": "Niveau",
|
|
185
|
+
"webmap-react-west": "west",
|
|
186
|
+
"webmap-react-east": "oost",
|
|
187
|
+
"webmap-react-north": "noord",
|
|
188
|
+
"webmap-react-south": "zuid",
|
|
189
|
+
"webmap-react-new-linestring-created": "nieuw punt in lijn gemaakt",
|
|
190
|
+
"webmap-react-new-feature": "nieuwe feature gemaakt",
|
|
191
|
+
"webmap-react-new-point": "nieuw punt gemaakt",
|
|
192
|
+
"webmap-react-point": "Punt",
|
|
193
|
+
"webmap-react-polygon": "Polygoon",
|
|
194
|
+
"webmap-react-box": "Rechthoek",
|
|
195
|
+
"webmap-react-linestring": "Lijn"
|
|
196
196
|
};
|
|
197
197
|
var webmapReactTranslations = {
|
|
198
198
|
en: en,
|
|
@@ -2748,13 +2748,16 @@ const isBetween = (a, c, b) => {
|
|
|
2748
2748
|
};
|
|
2749
2749
|
const convertGeoCoordsToScreenCoords = (featureCoords, mapId) => {
|
|
2750
2750
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
2751
|
+
if (!webmapjs) {
|
|
2752
|
+
return [];
|
|
2753
|
+
}
|
|
2751
2754
|
const XYCoords = [];
|
|
2752
2755
|
for (const featureCoord of featureCoords) {
|
|
2753
2756
|
if (featureCoord.length < 2) {
|
|
2754
2757
|
// eslint-disable-next-line no-continue
|
|
2755
2758
|
continue;
|
|
2756
2759
|
}
|
|
2757
|
-
const coord =
|
|
2760
|
+
const coord = getPixelCoordFromLatLong(webmapjs, {
|
|
2758
2761
|
x: featureCoord[0],
|
|
2759
2762
|
y: featureCoord[1]
|
|
2760
2763
|
});
|
|
@@ -2764,14 +2767,17 @@ const convertGeoCoordsToScreenCoords = (featureCoords, mapId) => {
|
|
|
2764
2767
|
};
|
|
2765
2768
|
const getPixelCoordFromGeoCoord = (featureCoords, mapId) => {
|
|
2766
2769
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
2770
|
+
if (!webmapjs) {
|
|
2771
|
+
return [];
|
|
2772
|
+
}
|
|
2767
2773
|
const {
|
|
2768
2774
|
width,
|
|
2769
2775
|
height
|
|
2770
2776
|
} = webmapjs.getSize();
|
|
2771
|
-
const bbox = webmapjs.
|
|
2777
|
+
const bbox = webmapjs.getDrawBBOX();
|
|
2772
2778
|
const proj = webmapjs.getProj4();
|
|
2773
2779
|
const XYCoords = [];
|
|
2774
|
-
const from = getProj4(
|
|
2780
|
+
const from = getProj4(WMJSMAP_LONLAT_EPSGCODE);
|
|
2775
2781
|
const to = getProj4(proj.crs);
|
|
2776
2782
|
for (const featureCoord of featureCoords) {
|
|
2777
2783
|
if (featureCoord.length < 2) {
|
|
@@ -3273,6 +3279,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3273
3279
|
}
|
|
3274
3280
|
}
|
|
3275
3281
|
componentDidUpdate(prevProps) {
|
|
3282
|
+
var _a;
|
|
3276
3283
|
const {
|
|
3277
3284
|
geojson,
|
|
3278
3285
|
isInEditMode,
|
|
@@ -3299,7 +3306,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3299
3306
|
return;
|
|
3300
3307
|
}
|
|
3301
3308
|
}
|
|
3302
|
-
webmapUtils.getWMJSMapById(mapId).draw('MapDraw::componentDidUpdateIsInEditMode');
|
|
3309
|
+
(_a = webmapUtils.getWMJSMapById(mapId)) === null || _a === void 0 ? void 0 : _a.draw('MapDraw::componentDidUpdateIsInEditMode');
|
|
3303
3310
|
}
|
|
3304
3311
|
/* Handle toggle delete */
|
|
3305
3312
|
if (isInDeleteMode !== prevIsInDeleteMode) {
|
|
@@ -3510,7 +3517,10 @@ class MapDraw extends React.PureComponent {
|
|
|
3510
3517
|
return undefined;
|
|
3511
3518
|
}
|
|
3512
3519
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
3513
|
-
|
|
3520
|
+
if (!webmapjs) {
|
|
3521
|
+
return undefined;
|
|
3522
|
+
}
|
|
3523
|
+
this.mouseGeoCoord = getLatLongFromPixelCoord(webmapjs, {
|
|
3514
3524
|
x: mouseX,
|
|
3515
3525
|
y: mouseY
|
|
3516
3526
|
});
|
|
@@ -3606,9 +3616,12 @@ class MapDraw extends React.PureComponent {
|
|
|
3606
3616
|
mapId
|
|
3607
3617
|
} = this.props;
|
|
3608
3618
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
3619
|
+
if (!webmapjs) {
|
|
3620
|
+
return false;
|
|
3621
|
+
}
|
|
3609
3622
|
if (this.myDrawMode === DRAWMODE.POLYGON) {
|
|
3610
3623
|
if (this.selectedEdge !== EDGE.NONE && this.myEditMode !== EDITMODE.DELETE_FEATURES) {
|
|
3611
|
-
this.mouseGeoCoord =
|
|
3624
|
+
this.mouseGeoCoord = getLatLongFromPixelCoord(webmapjs, {
|
|
3612
3625
|
x: mouseX,
|
|
3613
3626
|
y: mouseY
|
|
3614
3627
|
});
|
|
@@ -3628,7 +3641,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3628
3641
|
}
|
|
3629
3642
|
if (this.myDrawMode === DRAWMODE.LINESTRING) {
|
|
3630
3643
|
if (this.selectedEdge !== EDGE.NONE && this.myEditMode !== EDITMODE.DELETE_FEATURES) {
|
|
3631
|
-
this.mouseGeoCoord =
|
|
3644
|
+
this.mouseGeoCoord = getLatLongFromPixelCoord(webmapjs, {
|
|
3632
3645
|
x: mouseX,
|
|
3633
3646
|
y: mouseY
|
|
3634
3647
|
});
|
|
@@ -3663,6 +3676,9 @@ class MapDraw extends React.PureComponent {
|
|
|
3663
3676
|
selectedFeatureIndex
|
|
3664
3677
|
} = this.props;
|
|
3665
3678
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
3679
|
+
if (!webmapjs) {
|
|
3680
|
+
return;
|
|
3681
|
+
}
|
|
3666
3682
|
if (this.myEditMode === EDITMODE.EMPTY) {
|
|
3667
3683
|
this.myEditMode = EDITMODE.ADD_FEATURE;
|
|
3668
3684
|
if (!this.geojson.features[selectedFeatureIndex]) {
|
|
@@ -3670,7 +3686,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3670
3686
|
}
|
|
3671
3687
|
const feature = this.getSelectedFeature();
|
|
3672
3688
|
this.initializeFeatureCoordinates(feature, this.myDrawMode);
|
|
3673
|
-
this.mouseGeoCoord =
|
|
3689
|
+
this.mouseGeoCoord = getLatLongFromPixelCoord(webmapjs, {
|
|
3674
3690
|
x: mouseX,
|
|
3675
3691
|
y: mouseY
|
|
3676
3692
|
});
|
|
@@ -3774,9 +3790,12 @@ class MapDraw extends React.PureComponent {
|
|
|
3774
3790
|
mapId
|
|
3775
3791
|
} = this.props;
|
|
3776
3792
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
3793
|
+
if (!webmapjs) {
|
|
3794
|
+
return false;
|
|
3795
|
+
}
|
|
3777
3796
|
if (this.myDrawMode === DRAWMODE.MULTIPOINT) {
|
|
3778
3797
|
if (this.myEditMode === EDITMODE.ADD_FEATURE && this.snappedPolygonIndex !== SNAPPEDFEATURE.NONE) {
|
|
3779
|
-
this.mouseGeoCoord =
|
|
3798
|
+
this.mouseGeoCoord = getLatLongFromPixelCoord(webmapjs, {
|
|
3780
3799
|
x: mouseX,
|
|
3781
3800
|
y: mouseY
|
|
3782
3801
|
});
|
|
@@ -3802,9 +3821,12 @@ class MapDraw extends React.PureComponent {
|
|
|
3802
3821
|
mapId
|
|
3803
3822
|
} = this.props;
|
|
3804
3823
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
3824
|
+
if (!webmapjs) {
|
|
3825
|
+
return false;
|
|
3826
|
+
}
|
|
3805
3827
|
if (this.myDrawMode === DRAWMODE.POLYGON) {
|
|
3806
3828
|
if (this.myEditMode === EDITMODE.ADD_FEATURE && this.snappedPolygonIndex !== SNAPPEDFEATURE.NONE) {
|
|
3807
|
-
this.mouseGeoCoord =
|
|
3829
|
+
this.mouseGeoCoord = getLatLongFromPixelCoord(webmapjs, {
|
|
3808
3830
|
x: mouseX,
|
|
3809
3831
|
y: mouseY
|
|
3810
3832
|
});
|
|
@@ -3842,9 +3864,12 @@ class MapDraw extends React.PureComponent {
|
|
|
3842
3864
|
mapId
|
|
3843
3865
|
} = this.props;
|
|
3844
3866
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
3867
|
+
if (!webmapjs) {
|
|
3868
|
+
return false;
|
|
3869
|
+
}
|
|
3845
3870
|
if (this.myDrawMode === DRAWMODE.LINESTRING) {
|
|
3846
3871
|
if (this.myEditMode === EDITMODE.ADD_FEATURE) {
|
|
3847
|
-
this.mouseGeoCoord =
|
|
3872
|
+
this.mouseGeoCoord = getLatLongFromPixelCoord(webmapjs, {
|
|
3848
3873
|
x: mouseX,
|
|
3849
3874
|
y: mouseY
|
|
3850
3875
|
});
|
|
@@ -3959,7 +3984,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3959
3984
|
this.deletePolygon(polygonIndex);
|
|
3960
3985
|
}
|
|
3961
3986
|
this.featureHasChanged('deleteFeature');
|
|
3962
|
-
webmapjs.draw('MapDraw::deletefeatures');
|
|
3987
|
+
webmapjs === null || webmapjs === void 0 ? void 0 : webmapjs.draw('MapDraw::deletefeatures');
|
|
3963
3988
|
}
|
|
3964
3989
|
mouseUp(event) {
|
|
3965
3990
|
const {
|
|
@@ -4060,7 +4085,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4060
4085
|
featureCoords.pop();
|
|
4061
4086
|
}
|
|
4062
4087
|
this.featureHasChanged('cancelEdit');
|
|
4063
|
-
webmapjs.draw('MapDraw::cancelEdit');
|
|
4088
|
+
webmapjs === null || webmapjs === void 0 ? void 0 : webmapjs.draw('MapDraw::cancelEdit');
|
|
4064
4089
|
} else {
|
|
4065
4090
|
/* When in deletefeatures mode, remove any vertex under the mousecursor */
|
|
4066
4091
|
// eslint-disable-next-line no-lonely-if
|
|
@@ -4648,7 +4673,10 @@ class MapDraw extends React.PureComponent {
|
|
|
4648
4673
|
mapId
|
|
4649
4674
|
} = this.props;
|
|
4650
4675
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
4651
|
-
|
|
4676
|
+
if (!webmapjs) {
|
|
4677
|
+
return undefined;
|
|
4678
|
+
}
|
|
4679
|
+
const image = webmapjs === null || webmapjs === void 0 ? void 0 : webmapjs.getMapImageStore.getImage(featureProperties.imageURL);
|
|
4652
4680
|
if (image.isLoaded() === false && image.hasError() === false && image.isLoading() === false) {
|
|
4653
4681
|
image.load();
|
|
4654
4682
|
/* After the image is loaded the canvas will be redrawn and drawIcon will be triggered again
|
|
@@ -9567,8 +9595,7 @@ const getLayerUpdateInfo = (wmLayer, mapId) => {
|
|
|
9567
9595
|
return updateObject;
|
|
9568
9596
|
};
|
|
9569
9597
|
|
|
9570
|
-
/**
|
|
9571
|
-
* Returns filtered list of props with geoJson
|
|
9598
|
+
/** Returns filtered list of props with geoJson
|
|
9572
9599
|
* @param children React.ReactNode, layers with geoJson
|
|
9573
9600
|
*/
|
|
9574
9601
|
const getFeatureLayers = children => children && Array.isArray(children) ? children
|
|
@@ -9685,6 +9712,9 @@ const setWMLayerPropsBasedOnChildProps = (child, wmLayer, mapViewProps) => {
|
|
|
9685
9712
|
};
|
|
9686
9713
|
const addWMLayerPropsBasedOnChildProps = (child, mapId, props, onUpdateLayerInformation) => {
|
|
9687
9714
|
const wmjsMap = getWMJSMapById(mapId);
|
|
9715
|
+
if (!wmjsMap) {
|
|
9716
|
+
return;
|
|
9717
|
+
}
|
|
9688
9718
|
const keepOnTop = child.layerType === LayerType.overLayer || false;
|
|
9689
9719
|
const newWMLayer = new WMLayer(Object.assign(Object.assign({}, child), {
|
|
9690
9720
|
keepOnTop
|
|
@@ -9723,6 +9753,9 @@ const removeWMLayerFromMap = (wmLayer, mapId, onUpdateLayerInformation) => {
|
|
|
9723
9753
|
wmLayer.remove();
|
|
9724
9754
|
/// Trigger update of all map dimensions
|
|
9725
9755
|
const wmjsMap = getWMJSMapById(mapId);
|
|
9756
|
+
if (!wmjsMap) {
|
|
9757
|
+
return;
|
|
9758
|
+
}
|
|
9726
9759
|
onUpdateLayerInformation && onUpdateLayerInformation({
|
|
9727
9760
|
origin: ORIGIN_REACTMAPVIEW_UTILS_ONUPDATELAYERINFO,
|
|
9728
9761
|
layerStyle: null,
|
|
@@ -9785,8 +9818,7 @@ class ReactMapView extends React.Component {
|
|
|
9785
9818
|
const {
|
|
9786
9819
|
shouldAutoFetch
|
|
9787
9820
|
} = this.props;
|
|
9788
|
-
/*
|
|
9789
|
-
TODO, Maarten Plieger, 2021-09-02, https://gitlab.com/opengeoweb/opengeoweb/-/issues/1159:
|
|
9821
|
+
/* TODO, Maarten Plieger, 2021-09-02, https://gitlab.com/opengeoweb/opengeoweb/-/issues/1159:
|
|
9790
9822
|
This causes many issues, we should improve the update strategy.
|
|
9791
9823
|
Certain presets have >20 layers. This causes 20 times parsing the GetCapabilities for a minor update of the store.
|
|
9792
9824
|
*/
|
|
@@ -9797,6 +9829,9 @@ class ReactMapView extends React.Component {
|
|
|
9797
9829
|
mapId
|
|
9798
9830
|
} = this.props;
|
|
9799
9831
|
const wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
9832
|
+
if (!wmjsMap) {
|
|
9833
|
+
return;
|
|
9834
|
+
}
|
|
9800
9835
|
const layers = wmjsMap.getLayers();
|
|
9801
9836
|
layers.forEach(layer => {
|
|
9802
9837
|
if (layer.enabled !== false) {
|
|
@@ -10118,6 +10153,9 @@ class ReactMapView extends React.Component {
|
|
|
10118
10153
|
mapId
|
|
10119
10154
|
} = this.props;
|
|
10120
10155
|
const wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
10156
|
+
if (!wmjsMap) {
|
|
10157
|
+
return;
|
|
10158
|
+
}
|
|
10121
10159
|
wmjsMap.getListener().suspendEvents();
|
|
10122
10160
|
wmjsMap.draw();
|
|
10123
10161
|
wmjsMap.getListener().resumeEvents();
|
|
@@ -10130,7 +10168,7 @@ class ReactMapView extends React.Component {
|
|
|
10130
10168
|
bbox,
|
|
10131
10169
|
onMapPinChangeLocation
|
|
10132
10170
|
} = this.props;
|
|
10133
|
-
/* Check if we have something to mount
|
|
10171
|
+
/* Check if we have something to mount IWMJSMap on */
|
|
10134
10172
|
if (this.adagucWebMapJSRef.current === null) {
|
|
10135
10173
|
console.warn('No this.adagucWebMapJSRef.current yet ');
|
|
10136
10174
|
return null;
|
|
@@ -10212,6 +10250,9 @@ class ReactMapView extends React.Component {
|
|
|
10212
10250
|
mapId
|
|
10213
10251
|
} = this.props;
|
|
10214
10252
|
const wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
10253
|
+
if (!wmjsMap) {
|
|
10254
|
+
return;
|
|
10255
|
+
}
|
|
10215
10256
|
wmjsMap.setSize(newWidth, newHeight);
|
|
10216
10257
|
}
|
|
10217
10258
|
}
|
|
@@ -10397,9 +10438,11 @@ const ProfileAxis = ({
|
|
|
10397
10438
|
mapId
|
|
10398
10439
|
}) => {
|
|
10399
10440
|
const drawAxisOnMapDisplay = (ctx, webMap, axisStyle) => {
|
|
10400
|
-
const bbox = webMap.
|
|
10401
|
-
const
|
|
10402
|
-
|
|
10441
|
+
const bbox = webMap.getDrawBBOX();
|
|
10442
|
+
const {
|
|
10443
|
+
width,
|
|
10444
|
+
height
|
|
10445
|
+
} = webMap.getSize();
|
|
10403
10446
|
const offY = height - 50;
|
|
10404
10447
|
const offX = 20;
|
|
10405
10448
|
try {
|
|
@@ -10427,7 +10470,8 @@ const ProfileAxis = ({
|
|
|
10427
10470
|
};
|
|
10428
10471
|
// Draw on map canvas callback function
|
|
10429
10472
|
const beforeCanvasDisplay = ctx => {
|
|
10430
|
-
|
|
10473
|
+
const webmapjs = getWMJSMapById(mapId);
|
|
10474
|
+
webmapjs && drawAxisOnMapDisplay(ctx, webmapjs, axisStyle);
|
|
10431
10475
|
};
|
|
10432
10476
|
// unMount logic
|
|
10433
10477
|
const unMount = () => {
|
|
@@ -10439,7 +10483,7 @@ const ProfileAxis = ({
|
|
|
10439
10483
|
// Mount logic
|
|
10440
10484
|
const webMap = getWMJSMapById(mapId);
|
|
10441
10485
|
if (webMap && webMap.getProjection().srs === 'GFI:TIME_ELEVATION') {
|
|
10442
|
-
webMap.
|
|
10486
|
+
webMap.displayScaleBarInMap(false);
|
|
10443
10487
|
webMap.hideMouseCursorProperties();
|
|
10444
10488
|
webMap.setTimeOffset('');
|
|
10445
10489
|
webMap.addListener('beforecanvasdisplay', beforeCanvasDisplay, true);
|
|
@@ -10554,13 +10598,17 @@ const drawHeightAxis = (ctx, bbox, offsetX, offsetY, width, height, axisStyle) =
|
|
|
10554
10598
|
ctx.stroke();
|
|
10555
10599
|
};
|
|
10556
10600
|
const drawCursor = (ctx, bbox, offsetX, offsetY, width, height, webMapJS, axisStyle) => {
|
|
10601
|
+
const {
|
|
10602
|
+
mouseX: mapMouseX,
|
|
10603
|
+
mouseY: mapMouseY
|
|
10604
|
+
} = webMapJS.getMapMouseCoordinates();
|
|
10557
10605
|
// Do not draw if mouse is not in the map
|
|
10558
|
-
if (
|
|
10606
|
+
if (mapMouseX < 5 && mapMouseY < 5) {
|
|
10559
10607
|
return;
|
|
10560
10608
|
}
|
|
10561
10609
|
/* Draw cursor line */
|
|
10562
|
-
const mouseX = Math.round(
|
|
10563
|
-
const mouseY = Math.round(
|
|
10610
|
+
const mouseX = Math.round(mapMouseX) + 0.5;
|
|
10611
|
+
const mouseY = Math.round(mapMouseY) + 0.5;
|
|
10564
10612
|
ctx.strokeStyle = '#303030';
|
|
10565
10613
|
ctx.setLineDash([15, 5]);
|
|
10566
10614
|
ctx.beginPath();
|
|
@@ -10648,15 +10696,18 @@ const MapView = _a => {
|
|
|
10648
10696
|
mapId: mapId
|
|
10649
10697
|
}), jsx(ZoomControls, {
|
|
10650
10698
|
onZoomIn: () => {
|
|
10651
|
-
|
|
10652
|
-
|
|
10699
|
+
var _a;
|
|
10700
|
+
(_a = webmapUtils.getWMJSMapById(mapId)) === null || _a === void 0 ? void 0 : _a.zoomIn(undefined);
|
|
10653
10701
|
},
|
|
10654
10702
|
onZoomOut: () => {
|
|
10655
|
-
|
|
10656
|
-
|
|
10703
|
+
var _a;
|
|
10704
|
+
(_a = webmapUtils.getWMJSMapById(mapId)) === null || _a === void 0 ? void 0 : _a.zoomOut();
|
|
10657
10705
|
},
|
|
10658
10706
|
onZoomReset: () => {
|
|
10659
10707
|
const wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
10708
|
+
if (!wmjsMap) {
|
|
10709
|
+
return;
|
|
10710
|
+
}
|
|
10660
10711
|
wmjsMap.zoomToLayer(wmjsMap.getActiveLayer());
|
|
10661
10712
|
}
|
|
10662
10713
|
})]
|
|
@@ -10670,7 +10721,11 @@ const MapView = _a => {
|
|
|
10670
10721
|
showLegend: false,
|
|
10671
10722
|
displayTimeInMap: false,
|
|
10672
10723
|
onWMJSMount: id => {
|
|
10673
|
-
|
|
10724
|
+
const webMapJS = webmapUtils.getWMJSMapById(id);
|
|
10725
|
+
if (!webMapJS) {
|
|
10726
|
+
return;
|
|
10727
|
+
}
|
|
10728
|
+
wmjsMapRef.current = webMapJS;
|
|
10674
10729
|
if (onWMJSMount) {
|
|
10675
10730
|
onWMJSMount(id);
|
|
10676
10731
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/webmap-react",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.22.0",
|
|
4
4
|
"description": "GeoWeb react wrapper for webmap",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@opengeoweb/webmap": "*",
|
|
12
12
|
"axios": "1.5.0",
|
|
13
13
|
"@opengeoweb/theme": "*",
|
|
14
|
-
"@mui/material": "
|
|
14
|
+
"@mui/material": "^5.16.0",
|
|
15
15
|
"@opengeoweb/shared": "*",
|
|
16
16
|
"lodash": "^4.17.21",
|
|
17
17
|
"proj4": "^2.9.2",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { LayerFoundation,
|
|
2
|
+
import { LayerFoundation, IWMJSMap, WMLayer } from '@opengeoweb/webmap';
|
|
3
3
|
import { DrawModeExitCallback, FeatureEvent } from '../MapDraw';
|
|
4
4
|
export interface MapViewLayerProps extends LayerFoundation {
|
|
5
5
|
id: string;
|
|
6
|
-
onLayerReady?: (layer: WMLayer, webmap?:
|
|
6
|
+
onLayerReady?: (layer: WMLayer, webmap?: IWMJSMap) => void;
|
|
7
7
|
onLayerError?: (layer: WMLayer, error?: Error) => void;
|
|
8
8
|
isInEditMode?: boolean;
|
|
9
9
|
drawMode?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { IWMJSMap, WMLayer, WMBBOX } from '@opengeoweb/webmap';
|
|
4
4
|
import { ReactMapViewProps } from './types';
|
|
5
5
|
import type { MapViewLayerProps } from '../MapView';
|
|
6
6
|
export declare const ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION = "ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION";
|
|
@@ -51,7 +51,7 @@ export declare class ReactMapView extends React.Component<ReactMapViewProps, Rea
|
|
|
51
51
|
clearRefetchTimer: () => void;
|
|
52
52
|
updateWMJSMapProps(prevProps: ReactMapViewProps, props: ReactMapViewProps): void;
|
|
53
53
|
drawDebounced(): void;
|
|
54
|
-
mountWMJSMap():
|
|
54
|
+
mountWMJSMap(): IWMJSMap | null;
|
|
55
55
|
resize(): void;
|
|
56
56
|
render(): React.ReactElement;
|
|
57
57
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Bbox, Dimension,
|
|
2
|
+
import { Bbox, Dimension, IWMJSMap } from '@opengeoweb/webmap';
|
|
3
3
|
export interface ReactMapViewProps {
|
|
4
4
|
listeners?: {
|
|
5
5
|
name?: string;
|
|
6
6
|
data: string;
|
|
7
7
|
keep: boolean;
|
|
8
|
-
callbackfunction: (webMap:
|
|
8
|
+
callbackfunction: (webMap: IWMJSMap, value: string) => void;
|
|
9
9
|
}[];
|
|
10
10
|
srs?: string;
|
|
11
11
|
bbox?: Bbox;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Dimension, LayerFoundation,
|
|
1
|
+
import { Dimension, LayerFoundation, IWMJSMap, WMLayer } from '@opengeoweb/webmap';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FeatureLayer } from '../MapDraw';
|
|
4
4
|
import type { MapViewLayerProps, MapViewProps } from '../MapView';
|
|
5
5
|
import { ReactMapViewProps, UpdateLayerInfoPayload } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Returns filtered list of props with geoJson
|
|
6
|
+
/** Returns filtered list of props with geoJson
|
|
8
7
|
* @param children React.ReactNode, layers with geoJson
|
|
9
8
|
*/
|
|
10
9
|
export declare const getFeatureLayers: (children: React.ReactNode) => FeatureLayer[];
|
|
@@ -24,4 +23,4 @@ export declare const parseWMJSLayer: (wmLayer: WMLayer, forceReload: boolean) =>
|
|
|
24
23
|
export declare const setWMLayerPropsBasedOnChildProps: (child: MapViewLayerProps, wmLayer: WMLayer, mapViewProps: ReactMapViewProps) => boolean;
|
|
25
24
|
export declare const addWMLayerPropsBasedOnChildProps: (child: MapViewLayerProps, mapId: string, props: MapViewProps, onUpdateLayerInformation?: ((payload: UpdateLayerInfoPayload) => void) | undefined) => void;
|
|
26
25
|
export declare const removeWMLayerFromMap: (wmLayer: WMLayer, mapId: string, onUpdateLayerInformation?: ((payload: UpdateLayerInfoPayload) => void) | undefined) => void;
|
|
27
|
-
export declare const orderLayers: (wmjsMap:
|
|
26
|
+
export declare const orderLayers: (wmjsMap: IWMJSMap, _reactMapViewLayers: MapViewLayerProps[]) => boolean;
|