@opengeoweb/webmap-react 8.4.1 → 9.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 +776 -56
- package/package.json +1 -1
- package/src/lib/components/MapDraw/storyComponents/index.d.ts +1 -0
- package/src/lib/components/MapDrawTool/{MapDrawToolDoubleControls.stories.d.ts → MapDrawToolMultipleDrawTools.stories.d.ts} +1 -1
- package/src/lib/components/MapDrawTool/index.d.ts +3 -1
- package/src/lib/components/MapDrawTool/storyExamplesMapDrawTool.d.ts +8 -0
- package/src/lib/components/MapDrawTool/storyExamplesMapDrawToolIntersection.d.ts +9 -0
- package/src/lib/components/MapDrawTool/storyExamplesMapDrawToolMultipleDrawTools.d.ts +11 -0
- package/src/lib/components/MapDrawTool/useMapDrawTool.d.ts +4 -1
- package/src/lib/components/MapDrawTool/utils.d.ts +3 -0
- package/src/lib/components/MapView/MapViewLayer.d.ts +1 -1
- package/src/lib/components/ReactMapView/types.d.ts +1 -0
- package/src/lib/components/MapDrawTool/storyUtils.d.ts +0 -3
package/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CustomTooltip, ToolContainerDraggable, dateUtils, CustomIconButton } fr
|
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
import * as ReactDOM from 'react-dom';
|
|
7
7
|
import ReactDOM__default, { findDOMNode } from 'react-dom';
|
|
8
|
-
import { Delete, Edit, DrawRegion, DrawPolygon, Location, Home, Add, Minus, Close } from '@opengeoweb/theme';
|
|
8
|
+
import { Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, Home, Add, Minus, Close } from '@opengeoweb/theme';
|
|
9
9
|
|
|
10
10
|
/* *
|
|
11
11
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -490,10 +490,10 @@ var store$2 = sharedStore;
|
|
|
490
490
|
(shared$4.exports = function (key, value) {
|
|
491
491
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
492
492
|
})('versions', []).push({
|
|
493
|
-
version: '3.33.
|
|
493
|
+
version: '3.33.2',
|
|
494
494
|
mode: 'global',
|
|
495
495
|
copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
|
|
496
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.33.
|
|
496
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE',
|
|
497
497
|
source: 'https://github.com/zloirock/core-js'
|
|
498
498
|
});
|
|
499
499
|
|
|
@@ -1811,13 +1811,12 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
|
|
|
1811
1811
|
}, function () {
|
|
1812
1812
|
var state = getInternalState$1(this);
|
|
1813
1813
|
var target = state.target;
|
|
1814
|
-
var kind = state.kind;
|
|
1815
1814
|
var index = state.index++;
|
|
1816
1815
|
if (!target || index >= target.length) {
|
|
1817
1816
|
state.target = undefined;
|
|
1818
1817
|
return createIterResultObject(undefined, true);
|
|
1819
1818
|
}
|
|
1820
|
-
switch (kind) {
|
|
1819
|
+
switch (state.kind) {
|
|
1821
1820
|
case 'keys': return createIterResultObject(index, false);
|
|
1822
1821
|
case 'values': return createIterResultObject(target[index], false);
|
|
1823
1822
|
} return createIterResultObject([index, target[index]], false);
|
|
@@ -3912,10 +3911,10 @@ function useEventCallback(fn) {
|
|
|
3912
3911
|
useEnhancedEffect$1(() => {
|
|
3913
3912
|
ref.current = fn;
|
|
3914
3913
|
});
|
|
3915
|
-
return React.
|
|
3914
|
+
return React.useRef((...args) =>
|
|
3916
3915
|
// @ts-expect-error hide `this`
|
|
3917
3916
|
// tslint:disable-next-line:ban-comma-operator
|
|
3918
|
-
(0, ref.current)(...args)
|
|
3917
|
+
(0, ref.current)(...args)).current;
|
|
3919
3918
|
}
|
|
3920
3919
|
|
|
3921
3920
|
function useForkRef(...refs) {
|
|
@@ -7179,7 +7178,7 @@ process.env.NODE_ENV !== "production" ? GlobalStyles$2.propTypes = {
|
|
|
7179
7178
|
} : void 0;
|
|
7180
7179
|
|
|
7181
7180
|
/**
|
|
7182
|
-
* @mui/styled-engine v5.14.
|
|
7181
|
+
* @mui/styled-engine v5.14.16
|
|
7183
7182
|
*
|
|
7184
7183
|
* @license MIT
|
|
7185
7184
|
* This source code is licensed under the MIT license found in the
|
|
@@ -40520,9 +40519,6 @@ function nadgrid(key, data) {
|
|
|
40520
40519
|
var view = new DataView(data);
|
|
40521
40520
|
var isLittleEndian = detectLittleEndian(view);
|
|
40522
40521
|
var header = readHeader(view, isLittleEndian);
|
|
40523
|
-
if (header.nSubgrids > 1) {
|
|
40524
|
-
console.log('Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored');
|
|
40525
|
-
}
|
|
40526
40522
|
var subgrids = readSubgrids(view, header, isLittleEndian);
|
|
40527
40523
|
var nadgrid = {header: header, subgrids: subgrids};
|
|
40528
40524
|
loadedNadgrids[key] = nadgrid;
|
|
@@ -40609,6 +40605,7 @@ function readSubgrids(view, header, isLittleEndian) {
|
|
|
40609
40605
|
count: subHeader.gridNodeCount,
|
|
40610
40606
|
cvs: mapNodes(nodes)
|
|
40611
40607
|
});
|
|
40608
|
+
gridOffset += 176 + subHeader.gridNodeCount * 16;
|
|
40612
40609
|
}
|
|
40613
40610
|
return grids;
|
|
40614
40611
|
}
|
|
@@ -41028,6 +41025,7 @@ function applyGridShift(source, inverse, point) {
|
|
|
41028
41025
|
var input = {x: -point.x, y: point.y};
|
|
41029
41026
|
var output = {x: Number.NaN, y: Number.NaN};
|
|
41030
41027
|
var attemptedGrids = [];
|
|
41028
|
+
outer:
|
|
41031
41029
|
for (var i = 0; i < source.grids.length; i++) {
|
|
41032
41030
|
var grid = source.grids[i];
|
|
41033
41031
|
attemptedGrids.push(grid.name);
|
|
@@ -41043,19 +41041,22 @@ function applyGridShift(source, inverse, point) {
|
|
|
41043
41041
|
}
|
|
41044
41042
|
continue;
|
|
41045
41043
|
}
|
|
41046
|
-
var
|
|
41047
|
-
|
|
41048
|
-
|
|
41049
|
-
|
|
41050
|
-
|
|
41051
|
-
|
|
41052
|
-
|
|
41053
|
-
|
|
41054
|
-
|
|
41055
|
-
|
|
41056
|
-
|
|
41057
|
-
|
|
41058
|
-
|
|
41044
|
+
var subgrids = grid.grid.subgrids;
|
|
41045
|
+
for (var j = 0, jj = subgrids.length; j < jj; j++) {
|
|
41046
|
+
var subgrid = subgrids[j];
|
|
41047
|
+
// skip tables that don't match our point at all
|
|
41048
|
+
var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0;
|
|
41049
|
+
var minX = subgrid.ll[0] - epsilon;
|
|
41050
|
+
var minY = subgrid.ll[1] - epsilon;
|
|
41051
|
+
var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;
|
|
41052
|
+
var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;
|
|
41053
|
+
if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) {
|
|
41054
|
+
continue;
|
|
41055
|
+
}
|
|
41056
|
+
output = applySubgridShift(input, inverse, subgrid);
|
|
41057
|
+
if (!isNaN(output.x)) {
|
|
41058
|
+
break outer;
|
|
41059
|
+
}
|
|
41059
41060
|
}
|
|
41060
41061
|
}
|
|
41061
41062
|
if (isNaN(output.x)) {
|
|
@@ -46498,6 +46499,93 @@ function polygon(coordinates, properties, options) {
|
|
|
46498
46499
|
};
|
|
46499
46500
|
return feature(geom, properties, options);
|
|
46500
46501
|
}
|
|
46502
|
+
/**
|
|
46503
|
+
* Creates a {@link LineString} {@link Feature} from an Array of Positions.
|
|
46504
|
+
*
|
|
46505
|
+
* @name lineString
|
|
46506
|
+
* @param {Array<Array<number>>} coordinates an array of Positions
|
|
46507
|
+
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
|
|
46508
|
+
* @param {Object} [options={}] Optional Parameters
|
|
46509
|
+
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
|
|
46510
|
+
* @param {string|number} [options.id] Identifier associated with the Feature
|
|
46511
|
+
* @returns {Feature<LineString>} LineString Feature
|
|
46512
|
+
* @example
|
|
46513
|
+
* var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});
|
|
46514
|
+
* var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});
|
|
46515
|
+
*
|
|
46516
|
+
* //=linestring1
|
|
46517
|
+
* //=linestring2
|
|
46518
|
+
*/
|
|
46519
|
+
function lineString$1(coordinates, properties, options) {
|
|
46520
|
+
if (options === void 0) { options = {}; }
|
|
46521
|
+
if (coordinates.length < 2) {
|
|
46522
|
+
throw new Error("coordinates must be an array of two or more positions");
|
|
46523
|
+
}
|
|
46524
|
+
var geom = {
|
|
46525
|
+
type: "LineString",
|
|
46526
|
+
coordinates: coordinates,
|
|
46527
|
+
};
|
|
46528
|
+
return feature(geom, properties, options);
|
|
46529
|
+
}
|
|
46530
|
+
/**
|
|
46531
|
+
* Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
|
|
46532
|
+
*
|
|
46533
|
+
* @name featureCollection
|
|
46534
|
+
* @param {Feature[]} features input features
|
|
46535
|
+
* @param {Object} [options={}] Optional Parameters
|
|
46536
|
+
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
|
|
46537
|
+
* @param {string|number} [options.id] Identifier associated with the Feature
|
|
46538
|
+
* @returns {FeatureCollection} FeatureCollection of Features
|
|
46539
|
+
* @example
|
|
46540
|
+
* var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});
|
|
46541
|
+
* var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});
|
|
46542
|
+
* var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});
|
|
46543
|
+
*
|
|
46544
|
+
* var collection = turf.featureCollection([
|
|
46545
|
+
* locationA,
|
|
46546
|
+
* locationB,
|
|
46547
|
+
* locationC
|
|
46548
|
+
* ]);
|
|
46549
|
+
*
|
|
46550
|
+
* //=collection
|
|
46551
|
+
*/
|
|
46552
|
+
function featureCollection(features, options) {
|
|
46553
|
+
if (options === void 0) { options = {}; }
|
|
46554
|
+
var fc = { type: "FeatureCollection" };
|
|
46555
|
+
if (options.id) {
|
|
46556
|
+
fc.id = options.id;
|
|
46557
|
+
}
|
|
46558
|
+
if (options.bbox) {
|
|
46559
|
+
fc.bbox = options.bbox;
|
|
46560
|
+
}
|
|
46561
|
+
fc.features = features;
|
|
46562
|
+
return fc;
|
|
46563
|
+
}
|
|
46564
|
+
/**
|
|
46565
|
+
* Creates a {@link Feature<MultiLineString>} based on a
|
|
46566
|
+
* coordinate array. Properties can be added optionally.
|
|
46567
|
+
*
|
|
46568
|
+
* @name multiLineString
|
|
46569
|
+
* @param {Array<Array<Array<number>>>} coordinates an array of LineStrings
|
|
46570
|
+
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
|
|
46571
|
+
* @param {Object} [options={}] Optional Parameters
|
|
46572
|
+
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
|
|
46573
|
+
* @param {string|number} [options.id] Identifier associated with the Feature
|
|
46574
|
+
* @returns {Feature<MultiLineString>} a MultiLineString feature
|
|
46575
|
+
* @throws {Error} if no coordinates are passed
|
|
46576
|
+
* @example
|
|
46577
|
+
* var multiLine = turf.multiLineString([[[0,0],[10,10]]]);
|
|
46578
|
+
*
|
|
46579
|
+
* //=multiLine
|
|
46580
|
+
*/
|
|
46581
|
+
function multiLineString(coordinates, properties, options) {
|
|
46582
|
+
if (options === void 0) { options = {}; }
|
|
46583
|
+
var geom = {
|
|
46584
|
+
type: "MultiLineString",
|
|
46585
|
+
coordinates: coordinates,
|
|
46586
|
+
};
|
|
46587
|
+
return feature(geom, properties, options);
|
|
46588
|
+
}
|
|
46501
46589
|
/**
|
|
46502
46590
|
* Creates a {@link Feature<MultiPolygon>} based on a
|
|
46503
46591
|
* coordinate array. Properties can be added optionally.
|
|
@@ -46553,6 +46641,43 @@ function isObject$4(input) {
|
|
|
46553
46641
|
return !!input && input.constructor === Object;
|
|
46554
46642
|
}
|
|
46555
46643
|
|
|
46644
|
+
/**
|
|
46645
|
+
* Callback for featureEach
|
|
46646
|
+
*
|
|
46647
|
+
* @callback featureEachCallback
|
|
46648
|
+
* @param {Feature<any>} currentFeature The current Feature being processed.
|
|
46649
|
+
* @param {number} featureIndex The current index of the Feature being processed.
|
|
46650
|
+
*/
|
|
46651
|
+
|
|
46652
|
+
/**
|
|
46653
|
+
* Iterate over features in any GeoJSON object, similar to
|
|
46654
|
+
* Array.forEach.
|
|
46655
|
+
*
|
|
46656
|
+
* @name featureEach
|
|
46657
|
+
* @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object
|
|
46658
|
+
* @param {Function} callback a method that takes (currentFeature, featureIndex)
|
|
46659
|
+
* @returns {void}
|
|
46660
|
+
* @example
|
|
46661
|
+
* var features = turf.featureCollection([
|
|
46662
|
+
* turf.point([26, 37], {foo: 'bar'}),
|
|
46663
|
+
* turf.point([36, 53], {hello: 'world'})
|
|
46664
|
+
* ]);
|
|
46665
|
+
*
|
|
46666
|
+
* turf.featureEach(features, function (currentFeature, featureIndex) {
|
|
46667
|
+
* //=currentFeature
|
|
46668
|
+
* //=featureIndex
|
|
46669
|
+
* });
|
|
46670
|
+
*/
|
|
46671
|
+
function featureEach(geojson, callback) {
|
|
46672
|
+
if (geojson.type === "Feature") {
|
|
46673
|
+
callback(geojson, 0);
|
|
46674
|
+
} else if (geojson.type === "FeatureCollection") {
|
|
46675
|
+
for (var i = 0; i < geojson.features.length; i++) {
|
|
46676
|
+
if (callback(geojson.features[i], i) === false) break;
|
|
46677
|
+
}
|
|
46678
|
+
}
|
|
46679
|
+
}
|
|
46680
|
+
|
|
46556
46681
|
/**
|
|
46557
46682
|
* Callback for geomEach
|
|
46558
46683
|
*
|
|
@@ -47545,6 +47670,237 @@ function checkValidity(ring) {
|
|
|
47545
47670
|
);
|
|
47546
47671
|
}
|
|
47547
47672
|
|
|
47673
|
+
/**
|
|
47674
|
+
* Converts a {@link Polygon} to {@link LineString|(Multi)LineString} or {@link MultiPolygon} to a
|
|
47675
|
+
* {@link FeatureCollection} of {@link LineString|(Multi)LineString}.
|
|
47676
|
+
*
|
|
47677
|
+
* @name polygonToLine
|
|
47678
|
+
* @param {Feature<Polygon|MultiPolygon>} poly Feature to convert
|
|
47679
|
+
* @param {Object} [options={}] Optional parameters
|
|
47680
|
+
* @param {Object} [options.properties={}] translates GeoJSON properties to Feature
|
|
47681
|
+
* @returns {FeatureCollection|Feature<LineString|MultiLinestring>} converted (Multi)Polygon to (Multi)LineString
|
|
47682
|
+
* @example
|
|
47683
|
+
* var poly = turf.polygon([[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]);
|
|
47684
|
+
*
|
|
47685
|
+
* var line = turf.polygonToLine(poly);
|
|
47686
|
+
*
|
|
47687
|
+
* //addToMap
|
|
47688
|
+
* var addToMap = [line];
|
|
47689
|
+
*/
|
|
47690
|
+
function polygonToLineString (poly, options) {
|
|
47691
|
+
if (options === void 0) { options = {}; }
|
|
47692
|
+
var geom = getGeom(poly);
|
|
47693
|
+
if (!options.properties && poly.type === "Feature") {
|
|
47694
|
+
options.properties = poly.properties;
|
|
47695
|
+
}
|
|
47696
|
+
switch (geom.type) {
|
|
47697
|
+
case "Polygon":
|
|
47698
|
+
return polygonToLine(geom, options);
|
|
47699
|
+
case "MultiPolygon":
|
|
47700
|
+
return multiPolygonToLine(geom, options);
|
|
47701
|
+
default:
|
|
47702
|
+
throw new Error("invalid poly");
|
|
47703
|
+
}
|
|
47704
|
+
}
|
|
47705
|
+
/**
|
|
47706
|
+
* @private
|
|
47707
|
+
*/
|
|
47708
|
+
function polygonToLine(poly, options) {
|
|
47709
|
+
if (options === void 0) { options = {}; }
|
|
47710
|
+
var geom = getGeom(poly);
|
|
47711
|
+
var coords = geom.coordinates;
|
|
47712
|
+
var properties = options.properties
|
|
47713
|
+
? options.properties
|
|
47714
|
+
: poly.type === "Feature"
|
|
47715
|
+
? poly.properties
|
|
47716
|
+
: {};
|
|
47717
|
+
return coordsToLine(coords, properties);
|
|
47718
|
+
}
|
|
47719
|
+
/**
|
|
47720
|
+
* @private
|
|
47721
|
+
*/
|
|
47722
|
+
function multiPolygonToLine(multiPoly, options) {
|
|
47723
|
+
if (options === void 0) { options = {}; }
|
|
47724
|
+
var geom = getGeom(multiPoly);
|
|
47725
|
+
var coords = geom.coordinates;
|
|
47726
|
+
var properties = options.properties
|
|
47727
|
+
? options.properties
|
|
47728
|
+
: multiPoly.type === "Feature"
|
|
47729
|
+
? multiPoly.properties
|
|
47730
|
+
: {};
|
|
47731
|
+
var lines = [];
|
|
47732
|
+
coords.forEach(function (coord) {
|
|
47733
|
+
lines.push(coordsToLine(coord, properties));
|
|
47734
|
+
});
|
|
47735
|
+
return featureCollection(lines);
|
|
47736
|
+
}
|
|
47737
|
+
/**
|
|
47738
|
+
* @private
|
|
47739
|
+
*/
|
|
47740
|
+
function coordsToLine(coords, properties) {
|
|
47741
|
+
if (coords.length > 1) {
|
|
47742
|
+
return multiLineString(coords, properties);
|
|
47743
|
+
}
|
|
47744
|
+
return lineString$1(coords[0], properties);
|
|
47745
|
+
}
|
|
47746
|
+
|
|
47747
|
+
/**
|
|
47748
|
+
* Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise.
|
|
47749
|
+
*
|
|
47750
|
+
* @name booleanClockwise
|
|
47751
|
+
* @param {Feature<LineString>|LineString|Array<Array<number>>} line to be evaluated
|
|
47752
|
+
* @returns {boolean} true/false
|
|
47753
|
+
* @example
|
|
47754
|
+
* var clockwiseRing = turf.lineString([[0,0],[1,1],[1,0],[0,0]]);
|
|
47755
|
+
* var counterClockwiseRing = turf.lineString([[0,0],[1,0],[1,1],[0,0]]);
|
|
47756
|
+
*
|
|
47757
|
+
* turf.booleanClockwise(clockwiseRing)
|
|
47758
|
+
* //=true
|
|
47759
|
+
* turf.booleanClockwise(counterClockwiseRing)
|
|
47760
|
+
* //=false
|
|
47761
|
+
*/
|
|
47762
|
+
function booleanClockwise(line) {
|
|
47763
|
+
var ring = getCoords(line);
|
|
47764
|
+
var sum = 0;
|
|
47765
|
+
var i = 1;
|
|
47766
|
+
var prev;
|
|
47767
|
+
var cur;
|
|
47768
|
+
while (i < ring.length) {
|
|
47769
|
+
prev = cur || ring[0];
|
|
47770
|
+
cur = ring[i];
|
|
47771
|
+
sum += (cur[0] - prev[0]) * (cur[1] + prev[1]);
|
|
47772
|
+
i++;
|
|
47773
|
+
}
|
|
47774
|
+
return sum > 0;
|
|
47775
|
+
}
|
|
47776
|
+
|
|
47777
|
+
/**
|
|
47778
|
+
* Rewind {@link LineString|(Multi)LineString} or {@link Polygon|(Multi)Polygon} outer ring counterclockwise and inner rings clockwise (Uses {@link http://en.wikipedia.org/wiki/Shoelace_formula|Shoelace Formula}).
|
|
47779
|
+
*
|
|
47780
|
+
* @name rewind
|
|
47781
|
+
* @param {GeoJSON} geojson input GeoJSON Polygon
|
|
47782
|
+
* @param {Object} [options={}] Optional parameters
|
|
47783
|
+
* @param {boolean} [options.reverse=false] enable reverse winding
|
|
47784
|
+
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
|
|
47785
|
+
* @returns {GeoJSON} rewind Polygon
|
|
47786
|
+
* @example
|
|
47787
|
+
* var polygon = turf.polygon([[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]);
|
|
47788
|
+
*
|
|
47789
|
+
* var rewind = turf.rewind(polygon);
|
|
47790
|
+
*
|
|
47791
|
+
* //addToMap
|
|
47792
|
+
* var addToMap = [rewind];
|
|
47793
|
+
*/
|
|
47794
|
+
function rewind(geojson, options) {
|
|
47795
|
+
// Optional parameters
|
|
47796
|
+
options = options || {};
|
|
47797
|
+
if (!isObject$4(options)) throw new Error("options is invalid");
|
|
47798
|
+
var reverse = options.reverse || false;
|
|
47799
|
+
var mutate = options.mutate || false;
|
|
47800
|
+
|
|
47801
|
+
// validation
|
|
47802
|
+
if (!geojson) throw new Error("<geojson> is required");
|
|
47803
|
+
if (typeof reverse !== "boolean")
|
|
47804
|
+
throw new Error("<reverse> must be a boolean");
|
|
47805
|
+
if (typeof mutate !== "boolean")
|
|
47806
|
+
throw new Error("<mutate> must be a boolean");
|
|
47807
|
+
|
|
47808
|
+
// prevent input mutation
|
|
47809
|
+
if (mutate === false) geojson = clone(geojson);
|
|
47810
|
+
|
|
47811
|
+
// Support Feature Collection or Geometry Collection
|
|
47812
|
+
var results = [];
|
|
47813
|
+
switch (geojson.type) {
|
|
47814
|
+
case "GeometryCollection":
|
|
47815
|
+
geomEach(geojson, function (geometry) {
|
|
47816
|
+
rewindFeature(geometry, reverse);
|
|
47817
|
+
});
|
|
47818
|
+
return geojson;
|
|
47819
|
+
case "FeatureCollection":
|
|
47820
|
+
featureEach(geojson, function (feature) {
|
|
47821
|
+
featureEach(rewindFeature(feature, reverse), function (result) {
|
|
47822
|
+
results.push(result);
|
|
47823
|
+
});
|
|
47824
|
+
});
|
|
47825
|
+
return featureCollection(results);
|
|
47826
|
+
}
|
|
47827
|
+
// Support Feature or Geometry Objects
|
|
47828
|
+
return rewindFeature(geojson, reverse);
|
|
47829
|
+
}
|
|
47830
|
+
|
|
47831
|
+
/**
|
|
47832
|
+
* Rewind
|
|
47833
|
+
*
|
|
47834
|
+
* @private
|
|
47835
|
+
* @param {Geometry|Feature<any>} geojson Geometry or Feature
|
|
47836
|
+
* @param {Boolean} [reverse=false] enable reverse winding
|
|
47837
|
+
* @returns {Geometry|Feature<any>} rewind Geometry or Feature
|
|
47838
|
+
*/
|
|
47839
|
+
function rewindFeature(geojson, reverse) {
|
|
47840
|
+
var type = geojson.type === "Feature" ? geojson.geometry.type : geojson.type;
|
|
47841
|
+
|
|
47842
|
+
// Support all GeoJSON Geometry Objects
|
|
47843
|
+
switch (type) {
|
|
47844
|
+
case "GeometryCollection":
|
|
47845
|
+
geomEach(geojson, function (geometry) {
|
|
47846
|
+
rewindFeature(geometry, reverse);
|
|
47847
|
+
});
|
|
47848
|
+
return geojson;
|
|
47849
|
+
case "LineString":
|
|
47850
|
+
rewindLineString(getCoords(geojson), reverse);
|
|
47851
|
+
return geojson;
|
|
47852
|
+
case "Polygon":
|
|
47853
|
+
rewindPolygon(getCoords(geojson), reverse);
|
|
47854
|
+
return geojson;
|
|
47855
|
+
case "MultiLineString":
|
|
47856
|
+
getCoords(geojson).forEach(function (lineCoords) {
|
|
47857
|
+
rewindLineString(lineCoords, reverse);
|
|
47858
|
+
});
|
|
47859
|
+
return geojson;
|
|
47860
|
+
case "MultiPolygon":
|
|
47861
|
+
getCoords(geojson).forEach(function (lineCoords) {
|
|
47862
|
+
rewindPolygon(lineCoords, reverse);
|
|
47863
|
+
});
|
|
47864
|
+
return geojson;
|
|
47865
|
+
case "Point":
|
|
47866
|
+
case "MultiPoint":
|
|
47867
|
+
return geojson;
|
|
47868
|
+
}
|
|
47869
|
+
}
|
|
47870
|
+
|
|
47871
|
+
/**
|
|
47872
|
+
* Rewind LineString - outer ring clockwise
|
|
47873
|
+
*
|
|
47874
|
+
* @private
|
|
47875
|
+
* @param {Array<Array<number>>} coords GeoJSON LineString geometry coordinates
|
|
47876
|
+
* @param {Boolean} [reverse=false] enable reverse winding
|
|
47877
|
+
* @returns {void} mutates coordinates
|
|
47878
|
+
*/
|
|
47879
|
+
function rewindLineString(coords, reverse) {
|
|
47880
|
+
if (booleanClockwise(coords) === reverse) coords.reverse();
|
|
47881
|
+
}
|
|
47882
|
+
|
|
47883
|
+
/**
|
|
47884
|
+
* Rewind Polygon - outer ring counterclockwise and inner rings clockwise.
|
|
47885
|
+
*
|
|
47886
|
+
* @private
|
|
47887
|
+
* @param {Array<Array<Array<number>>>} coords GeoJSON Polygon geometry coordinates
|
|
47888
|
+
* @param {Boolean} [reverse=false] enable reverse winding
|
|
47889
|
+
* @returns {void} mutates coordinates
|
|
47890
|
+
*/
|
|
47891
|
+
function rewindPolygon(coords, reverse) {
|
|
47892
|
+
// outer ring
|
|
47893
|
+
if (booleanClockwise(coords[0]) !== reverse) {
|
|
47894
|
+
coords[0].reverse();
|
|
47895
|
+
}
|
|
47896
|
+
// inner rings
|
|
47897
|
+
for (var i = 1; i < coords.length; i++) {
|
|
47898
|
+
if (booleanClockwise(coords[i]) === reverse) {
|
|
47899
|
+
coords[i].reverse();
|
|
47900
|
+
}
|
|
47901
|
+
}
|
|
47902
|
+
}
|
|
47903
|
+
|
|
47548
47904
|
/**
|
|
47549
47905
|
* splaytree v3.1.2
|
|
47550
47906
|
* Fast Splay tree for Node and browser
|
|
@@ -52814,6 +53170,37 @@ const SelectField = ({
|
|
|
52814
53170
|
}) : getLabel(value.toString())))));
|
|
52815
53171
|
};
|
|
52816
53172
|
|
|
53173
|
+
const IntersectionSelect = ({
|
|
53174
|
+
intersections,
|
|
53175
|
+
onChangeIntersection
|
|
53176
|
+
}) => {
|
|
53177
|
+
const [activeIntersection, setActiveIntersection] = React__default.useState(0);
|
|
53178
|
+
return /*#__PURE__*/React__default.createElement(Grid$1, {
|
|
53179
|
+
item: true,
|
|
53180
|
+
sm: 12
|
|
53181
|
+
}, /*#__PURE__*/React__default.createElement(FormControl$1, {
|
|
53182
|
+
variant: "filled",
|
|
53183
|
+
sx: {
|
|
53184
|
+
width: '100%'
|
|
53185
|
+
}
|
|
53186
|
+
}, /*#__PURE__*/React__default.createElement(InputLabel$1, {
|
|
53187
|
+
id: "demo-intersection"
|
|
53188
|
+
}, "Intersection shapes"), /*#__PURE__*/React__default.createElement(Select$1, {
|
|
53189
|
+
labelId: "demo-intersection",
|
|
53190
|
+
value: activeIntersection.toString(),
|
|
53191
|
+
onChange: event => {
|
|
53192
|
+
const featureIndex = parseInt(event.target.value, 10);
|
|
53193
|
+
setActiveIntersection(featureIndex);
|
|
53194
|
+
onChangeIntersection(intersections[featureIndex].geojson);
|
|
53195
|
+
}
|
|
53196
|
+
}, intersections.map((listItem, index) => {
|
|
53197
|
+
return /*#__PURE__*/React__default.createElement(MenuItem$1, {
|
|
53198
|
+
key: listItem.title,
|
|
53199
|
+
value: index
|
|
53200
|
+
}, listItem.title);
|
|
53201
|
+
}))));
|
|
53202
|
+
};
|
|
53203
|
+
|
|
52817
53204
|
function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b("MapSet").F(r,t):v(r)?b("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
|
|
52818
53205
|
|
|
52819
53206
|
/**
|
|
@@ -52987,6 +53374,20 @@ const isGeoJSONFeatureCreatedByTool = (existingJSON, newGeoJSON) => {
|
|
|
52987
53374
|
const newTool = newGeoJSON.type === 'Feature' ? (_b = newGeoJSON.properties) === null || _b === void 0 ? void 0 : _b.selectionType : (_c = newGeoJSON.features[0].properties) === null || _c === void 0 ? void 0 : _c.selectionType;
|
|
52988
53375
|
return lastUsedTool !== undefined && newTool !== undefined ? lastUsedTool === newTool : false;
|
|
52989
53376
|
};
|
|
53377
|
+
const rewindGeometry = geoJSON => {
|
|
53378
|
+
return produce(geoJSON, geoJSONDraft => {
|
|
53379
|
+
if (geoJSONDraft && geoJSONDraft.features.length > 0 && geoJSONDraft.features[0].geometry.type === 'Polygon' && geoJSONDraft.features[0].geometry.coordinates[0].length > 1) {
|
|
53380
|
+
const {
|
|
53381
|
+
geometry
|
|
53382
|
+
} = geoJSON.features[0];
|
|
53383
|
+
const lineString = polygonToLineString(geometry);
|
|
53384
|
+
if (booleanClockwise(lineString.geometry.coordinates)) {
|
|
53385
|
+
// eslint-disable-next-line no-param-reassign
|
|
53386
|
+
geoJSONDraft.features[0].geometry = rewind(geoJSONDraft.features[0].geometry);
|
|
53387
|
+
}
|
|
53388
|
+
}
|
|
53389
|
+
});
|
|
53390
|
+
};
|
|
52990
53391
|
|
|
52991
53392
|
const defaultIntersectionStyleProperties = Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
|
|
52992
53393
|
'fill-opacity': 0.5
|
|
@@ -53074,7 +53475,10 @@ const useMapDrawTool = ({
|
|
|
53074
53475
|
defaultGeoJSON: _defaultGeoJSON = emptyGeoJSON,
|
|
53075
53476
|
defaultGeoJSONIntersection: _defaultGeoJSONIntersection = emptyIntersectionShape,
|
|
53076
53477
|
defaultGeoJSONIntersectionBounds,
|
|
53077
|
-
defaultGeoJSONIntersectionProperties: _defaultGeoJSONIntersectionProperties = defaultIntersectionStyleProperties
|
|
53478
|
+
defaultGeoJSONIntersectionProperties: _defaultGeoJSONIntersectionProperties = defaultIntersectionStyleProperties,
|
|
53479
|
+
geoJSONLayerId: _geoJSONLayerId = 'draw-layer',
|
|
53480
|
+
geoJSONIntersectionLayerId: _geoJSONIntersectionLayerId = 'intersection-layer',
|
|
53481
|
+
geoJSONIntersectionBoundsLayerId: _geoJSONIntersectionBoundsLayerId = 'static-layer'
|
|
53078
53482
|
}) => {
|
|
53079
53483
|
// geoJSON feature collections
|
|
53080
53484
|
const [geoJSON, setGeoJSON] = React__default.useState(_defaultGeoJSON);
|
|
@@ -53114,7 +53518,7 @@ const useMapDrawTool = ({
|
|
|
53114
53518
|
reset(shouldDeleteShape);
|
|
53115
53519
|
return;
|
|
53116
53520
|
}
|
|
53117
|
-
setActiveTool(newMode.drawModeId);
|
|
53521
|
+
setActiveTool(newMode.isSelectable ? newMode.drawModeId : '');
|
|
53118
53522
|
// updates shape
|
|
53119
53523
|
const isNewSelectedTool = !isGeoJSONFeatureCreatedByTool(geoJSON, newMode.shape);
|
|
53120
53524
|
const shouldUpdateShape = !geoJSON.features.length || _shouldAllowMultipleShapes || isNewSelectedTool;
|
|
@@ -53124,7 +53528,7 @@ const useMapDrawTool = ({
|
|
|
53124
53528
|
}
|
|
53125
53529
|
// handle modes and update feature layer index
|
|
53126
53530
|
setDrawMode(newMode.value);
|
|
53127
|
-
setEditMode(!!newMode.value);
|
|
53531
|
+
setEditMode(!!newMode.value && newMode.isSelectable);
|
|
53128
53532
|
};
|
|
53129
53533
|
const changeGeoJSON = (updatedGeoJSON, reason = '') => {
|
|
53130
53534
|
const geoJSONFeatureCollection = getFeatureCollection(updatedGeoJSON, _shouldAllowMultipleShapes, geoJSON);
|
|
@@ -53186,7 +53590,7 @@ const useMapDrawTool = ({
|
|
|
53186
53590
|
isInEditMode: false
|
|
53187
53591
|
};
|
|
53188
53592
|
};
|
|
53189
|
-
const layers = [...(geoJSONIntersectionBounds ? [getLayer('geoJSONIntersectionBounds',
|
|
53593
|
+
const layers = [...(geoJSONIntersectionBounds ? [getLayer('geoJSONIntersectionBounds', _geoJSONIntersectionBoundsLayerId), getLayer('geoJSONIntersection', _geoJSONIntersectionLayerId)] : []), getLayer('geoJSON', _geoJSONLayerId)];
|
|
53190
53594
|
return {
|
|
53191
53595
|
geoJSON,
|
|
53192
53596
|
geoJSONIntersection,
|
|
@@ -53211,8 +53615,24 @@ const useMapDrawTool = ({
|
|
|
53211
53615
|
};
|
|
53212
53616
|
};
|
|
53213
53617
|
|
|
53618
|
+
const opacityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
|
|
53619
|
+
const fillOptions = [defaultGeoJSONStyleProperties.fill, '#6e1e91', '#FF00FF', '#33ccFF', '#8F8'];
|
|
53620
|
+
const strokeWidthOptions = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
|
|
53621
|
+
const getToolIcon = id => {
|
|
53622
|
+
const defaultIcon = getIcon(id);
|
|
53623
|
+
if (defaultIcon) {
|
|
53624
|
+
return defaultIcon;
|
|
53625
|
+
}
|
|
53626
|
+
if (id === 'tool-fir') {
|
|
53627
|
+
return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
|
|
53628
|
+
}
|
|
53629
|
+
if (id === 'tool-custom-line') {
|
|
53630
|
+
return /*#__PURE__*/React__default.createElement(ArrowUp, null);
|
|
53631
|
+
}
|
|
53632
|
+
return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
|
|
53633
|
+
};
|
|
53214
53634
|
// custom buttons
|
|
53215
|
-
const shapeButtonNL = {
|
|
53635
|
+
const shapeButtonNL$2 = {
|
|
53216
53636
|
drawModeId: 'tool-fir',
|
|
53217
53637
|
value: DRAWMODE.POLYGON,
|
|
53218
53638
|
title: 'Custom FIR NL polygon',
|
|
@@ -53233,8 +53653,8 @@ const customLineButton = {
|
|
|
53233
53653
|
},
|
|
53234
53654
|
isSelectable: false
|
|
53235
53655
|
};
|
|
53236
|
-
// example options
|
|
53237
53656
|
const basicExampleDrawOptions = {
|
|
53657
|
+
defaultDrawModes: [...defaultModes, shapeButtonNL$2, customLineButton],
|
|
53238
53658
|
defaultGeoJSON: {
|
|
53239
53659
|
type: 'FeatureCollection',
|
|
53240
53660
|
features: [{
|
|
@@ -53252,7 +53672,7 @@ const basicExampleDrawOptions = {
|
|
|
53252
53672
|
const basicExampleMultipleShapeDrawOptions = {
|
|
53253
53673
|
shouldAllowMultipleShapes: true,
|
|
53254
53674
|
// add multiple tools, and update all with custom color
|
|
53255
|
-
defaultDrawModes: [...defaultModes, shapeButtonNL, customLineButton].map(mode => Object.assign(Object.assign({}, mode), {
|
|
53675
|
+
defaultDrawModes: [...defaultModes, shapeButtonNL$2, customLineButton].map(mode => Object.assign(Object.assign({}, mode), {
|
|
53256
53676
|
shape: Object.assign(Object.assign({}, mode.shape), {
|
|
53257
53677
|
properties: Object.assign(Object.assign({}, mode.shape.properties), {
|
|
53258
53678
|
stroke: '#8F8',
|
|
@@ -53265,6 +53685,295 @@ const basicExampleMultipleShapeDrawOptions = {
|
|
|
53265
53685
|
}))
|
|
53266
53686
|
};
|
|
53267
53687
|
|
|
53688
|
+
const getIntersectionToolIcon = id => {
|
|
53689
|
+
const defaultIcon = getIcon(id);
|
|
53690
|
+
if (defaultIcon) {
|
|
53691
|
+
return defaultIcon;
|
|
53692
|
+
}
|
|
53693
|
+
if (id === 'fir-nl') {
|
|
53694
|
+
return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
|
|
53695
|
+
}
|
|
53696
|
+
if (id === 'fir-be') {
|
|
53697
|
+
return /*#__PURE__*/React__default.createElement(DrawFIRLand, {
|
|
53698
|
+
sx: {
|
|
53699
|
+
transform: `scaleY(-1)`
|
|
53700
|
+
}
|
|
53701
|
+
});
|
|
53702
|
+
}
|
|
53703
|
+
return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
|
|
53704
|
+
};
|
|
53705
|
+
// custom buttons
|
|
53706
|
+
const shapeButtonNL$1 = {
|
|
53707
|
+
drawModeId: 'tool-fir',
|
|
53708
|
+
value: DRAWMODE.POLYGON,
|
|
53709
|
+
title: 'Custom FIR NL polygon',
|
|
53710
|
+
shape: intersectionFeatureNL,
|
|
53711
|
+
isSelectable: false
|
|
53712
|
+
};
|
|
53713
|
+
const shapeButtonBE$1 = {
|
|
53714
|
+
drawModeId: 'fir-be',
|
|
53715
|
+
value: DRAWMODE.POLYGON,
|
|
53716
|
+
title: 'Custom FIR BE polygon',
|
|
53717
|
+
shape: intersectionFeatureBE,
|
|
53718
|
+
isSelectable: false
|
|
53719
|
+
};
|
|
53720
|
+
const geoJSONIntersectionBoundsStyle$1 = {
|
|
53721
|
+
stroke: '#000000',
|
|
53722
|
+
'stroke-width': 1.5,
|
|
53723
|
+
'stroke-opacity': 1,
|
|
53724
|
+
fill: '#0075a9',
|
|
53725
|
+
'fill-opacity': 0.0
|
|
53726
|
+
};
|
|
53727
|
+
const featurePropsIntersectionEnd = {
|
|
53728
|
+
stroke: '#000000',
|
|
53729
|
+
'stroke-width': 1.5,
|
|
53730
|
+
'stroke-opacity': 1,
|
|
53731
|
+
fill: '#6e1e91',
|
|
53732
|
+
'fill-opacity': 0.5
|
|
53733
|
+
};
|
|
53734
|
+
const intersectionShapeNL$1 = {
|
|
53735
|
+
type: 'FeatureCollection',
|
|
53736
|
+
features: [Object.assign(Object.assign({}, intersectionFeatureNL), {
|
|
53737
|
+
properties: geoJSONIntersectionBoundsStyle$1
|
|
53738
|
+
})]
|
|
53739
|
+
};
|
|
53740
|
+
const intersectionShapeBE$1 = {
|
|
53741
|
+
type: 'FeatureCollection',
|
|
53742
|
+
features: [Object.assign(Object.assign({}, intersectionFeatureBE), {
|
|
53743
|
+
properties: geoJSONIntersectionBoundsStyle$1
|
|
53744
|
+
})]
|
|
53745
|
+
};
|
|
53746
|
+
const exampleIntersections = [{
|
|
53747
|
+
title: 'NL',
|
|
53748
|
+
geojson: intersectionShapeNL$1
|
|
53749
|
+
}, {
|
|
53750
|
+
title: 'BE',
|
|
53751
|
+
geojson: intersectionShapeBE$1
|
|
53752
|
+
}];
|
|
53753
|
+
const exampleIntersectionOptions = {
|
|
53754
|
+
defaultGeoJSONIntersectionBounds: intersectionShapeNL$1,
|
|
53755
|
+
defaultDrawModes: [defaultPoint, defaultPolygon, defaultBox, shapeButtonNL$1, shapeButtonBE$1, defaultDelete]
|
|
53756
|
+
};
|
|
53757
|
+
const exampleIntersectionWithShapeOptions = {
|
|
53758
|
+
defaultGeoJSON: {
|
|
53759
|
+
type: 'FeatureCollection',
|
|
53760
|
+
features: [{
|
|
53761
|
+
type: 'Feature',
|
|
53762
|
+
properties: Object.assign(Object.assign({}, featurePropsIntersectionEnd), {
|
|
53763
|
+
selectionType: 'poly'
|
|
53764
|
+
}),
|
|
53765
|
+
geometry: {
|
|
53766
|
+
type: 'Polygon',
|
|
53767
|
+
coordinates: [[[5.711880814773656, 55.12656218004421], [7.663910745234145, 55.970965630799725], [10.075241835802988, 52.35182632872327], [6.673542618750517, 51.77828698943017], [4.506215269489237, 53.442721496909385], [5.711880814773656, 55.12656218004421]]]
|
|
53768
|
+
}
|
|
53769
|
+
}]
|
|
53770
|
+
},
|
|
53771
|
+
defaultGeoJSONIntersection: {
|
|
53772
|
+
type: 'FeatureCollection',
|
|
53773
|
+
features: [{
|
|
53774
|
+
type: 'Feature',
|
|
53775
|
+
properties: Object.assign(Object.assign({}, featurePropsIntersectionEnd), {
|
|
53776
|
+
selectionType: 'poly'
|
|
53777
|
+
}),
|
|
53778
|
+
geometry: {
|
|
53779
|
+
type: 'Polygon',
|
|
53780
|
+
coordinates: [[[4.506215269489237, 53.442721496909385], [6.515104876543458, 51.89996184648691], [7.053095, 52.237764], [7.031389, 52.268885], [7.063612, 52.346109], [7.065557, 52.385828], [7.133055, 52.888887], [7.14218, 52.898244], [7.191667, 53.3], [6.5, 53.666667], [6.500002, 55.000002], [5.621260209964854, 55.00000082834584], [4.506215269489237, 53.442721496909385]]]
|
|
53781
|
+
}
|
|
53782
|
+
}]
|
|
53783
|
+
},
|
|
53784
|
+
defaultGeoJSONIntersectionBounds: intersectionShapeNL$1,
|
|
53785
|
+
defaultDrawModes: [Object.assign(Object.assign({}, defaultPoint), {
|
|
53786
|
+
shape: Object.assign(Object.assign({}, defaultPoint.shape), {
|
|
53787
|
+
properties: Object.assign(Object.assign({}, defaultPoint.shape.properties), featurePropsIntersectionEnd)
|
|
53788
|
+
})
|
|
53789
|
+
}), Object.assign(Object.assign({}, defaultPolygon), {
|
|
53790
|
+
shape: Object.assign(Object.assign({}, defaultPolygon.shape), {
|
|
53791
|
+
properties: Object.assign(Object.assign({}, defaultPolygon.shape.properties), featurePropsIntersectionEnd)
|
|
53792
|
+
})
|
|
53793
|
+
}), Object.assign(Object.assign({}, defaultBox), {
|
|
53794
|
+
shape: Object.assign(Object.assign({}, defaultBox.shape), {
|
|
53795
|
+
properties: Object.assign(Object.assign({}, defaultBox.shape.properties), featurePropsIntersectionEnd)
|
|
53796
|
+
})
|
|
53797
|
+
}), Object.assign(Object.assign({}, shapeButtonNL$1), {
|
|
53798
|
+
shape: Object.assign(Object.assign({}, shapeButtonNL$1.shape), {
|
|
53799
|
+
properties: Object.assign(Object.assign({}, shapeButtonNL$1.shape.properties), featurePropsIntersectionEnd)
|
|
53800
|
+
})
|
|
53801
|
+
}), Object.assign(Object.assign({}, shapeButtonBE$1), {
|
|
53802
|
+
shape: Object.assign(Object.assign({}, shapeButtonBE$1.shape), {
|
|
53803
|
+
properties: Object.assign(Object.assign({}, shapeButtonBE$1.shape.properties), featurePropsIntersectionEnd)
|
|
53804
|
+
})
|
|
53805
|
+
}), defaultDelete],
|
|
53806
|
+
defaultGeoJSONIntersectionProperties: featurePropsIntersectionEnd
|
|
53807
|
+
};
|
|
53808
|
+
|
|
53809
|
+
const firButtonDrawId = 'fir-button';
|
|
53810
|
+
// styles and shapes
|
|
53811
|
+
const featurePropertiesStart = defaultGeoJSONStyleProperties;
|
|
53812
|
+
const featurePropertiesEnd = {
|
|
53813
|
+
stroke: '#6e1e91',
|
|
53814
|
+
'stroke-width': 1.5,
|
|
53815
|
+
'stroke-opacity': 1,
|
|
53816
|
+
fill: '#6e1e91',
|
|
53817
|
+
'fill-opacity': 0.25
|
|
53818
|
+
};
|
|
53819
|
+
const geoJSONIntersectionBoundsStyle = {
|
|
53820
|
+
stroke: '#000000',
|
|
53821
|
+
'stroke-width': 1.5,
|
|
53822
|
+
'stroke-opacity': 1,
|
|
53823
|
+
fill: '#0075a9',
|
|
53824
|
+
'fill-opacity': 0.0
|
|
53825
|
+
};
|
|
53826
|
+
const intersectionShapeNL = {
|
|
53827
|
+
type: 'FeatureCollection',
|
|
53828
|
+
features: [Object.assign(Object.assign({}, intersectionFeatureNL), {
|
|
53829
|
+
properties: Object.assign(Object.assign({}, geoJSONIntersectionBoundsStyle), {
|
|
53830
|
+
selectionType: 'fir'
|
|
53831
|
+
})
|
|
53832
|
+
})]
|
|
53833
|
+
};
|
|
53834
|
+
const intersectionShapeBE = {
|
|
53835
|
+
type: 'FeatureCollection',
|
|
53836
|
+
features: [Object.assign(Object.assign({}, intersectionFeatureBE), {
|
|
53837
|
+
properties: Object.assign(Object.assign({}, geoJSONIntersectionBoundsStyle), {
|
|
53838
|
+
selectionType: 'fir'
|
|
53839
|
+
})
|
|
53840
|
+
})]
|
|
53841
|
+
};
|
|
53842
|
+
// custom buttons
|
|
53843
|
+
const shapeButtonNL = {
|
|
53844
|
+
drawModeId: firButtonDrawId,
|
|
53845
|
+
value: DRAWMODE.POLYGON,
|
|
53846
|
+
title: 'Custom FIR NL polygon',
|
|
53847
|
+
shape: intersectionShapeNL,
|
|
53848
|
+
isSelectable: false
|
|
53849
|
+
};
|
|
53850
|
+
const shapeButtonBE = {
|
|
53851
|
+
drawModeId: firButtonDrawId,
|
|
53852
|
+
value: DRAWMODE.POLYGON,
|
|
53853
|
+
title: 'Custom FIR BE polygon',
|
|
53854
|
+
shape: intersectionShapeBE,
|
|
53855
|
+
isSelectable: false
|
|
53856
|
+
};
|
|
53857
|
+
const exampleIntersectionsMultiDrawTool = [{
|
|
53858
|
+
title: 'NL',
|
|
53859
|
+
geojson: shapeButtonNL.shape
|
|
53860
|
+
}, {
|
|
53861
|
+
title: 'BE',
|
|
53862
|
+
geojson: shapeButtonBE.shape
|
|
53863
|
+
}];
|
|
53864
|
+
const getDoubleControlToolIcon = drawMode => {
|
|
53865
|
+
const {
|
|
53866
|
+
drawModeId
|
|
53867
|
+
} = drawMode;
|
|
53868
|
+
const defaultIcon = getIcon(drawModeId);
|
|
53869
|
+
if (defaultIcon) {
|
|
53870
|
+
return defaultIcon;
|
|
53871
|
+
}
|
|
53872
|
+
if (drawModeId === firButtonDrawId) {
|
|
53873
|
+
return /*#__PURE__*/React__default.createElement(DrawFIRLand, {
|
|
53874
|
+
sx: Object.assign({}, drawMode.title === shapeButtonBE.title && {
|
|
53875
|
+
transform: `scaleY(-1)`
|
|
53876
|
+
})
|
|
53877
|
+
});
|
|
53878
|
+
}
|
|
53879
|
+
return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
|
|
53880
|
+
};
|
|
53881
|
+
const getEditModes = geoJSONProperties => [Object.assign(Object.assign({}, defaultPoint), {
|
|
53882
|
+
shape: Object.assign(Object.assign({}, defaultPoint.shape), {
|
|
53883
|
+
properties: Object.assign(Object.assign({}, defaultPoint.shape.properties), geoJSONProperties)
|
|
53884
|
+
})
|
|
53885
|
+
}), Object.assign(Object.assign({}, defaultPolygon), {
|
|
53886
|
+
shape: Object.assign(Object.assign({}, defaultPolygon.shape), {
|
|
53887
|
+
properties: Object.assign(Object.assign({}, defaultPolygon.shape.properties), geoJSONProperties)
|
|
53888
|
+
})
|
|
53889
|
+
}), Object.assign(Object.assign({}, defaultBox), {
|
|
53890
|
+
shape: Object.assign(Object.assign({}, defaultBox.shape), {
|
|
53891
|
+
properties: Object.assign(Object.assign({}, defaultBox.shape.properties), geoJSONProperties)
|
|
53892
|
+
})
|
|
53893
|
+
}), Object.assign(Object.assign({}, shapeButtonNL), {
|
|
53894
|
+
shape: Object.assign(Object.assign({}, shapeButtonNL.shape), {
|
|
53895
|
+
features: [Object.assign(Object.assign({}, intersectionFeatureNL), {
|
|
53896
|
+
properties: Object.assign(Object.assign({}, intersectionShapeNL.features[0].properties), geoJSONProperties)
|
|
53897
|
+
})]
|
|
53898
|
+
})
|
|
53899
|
+
}), defaultDelete];
|
|
53900
|
+
const getUpdatedFirShape = isNL => isNL ? intersectionShapeNL : intersectionShapeBE;
|
|
53901
|
+
const getFirTitle = isNL => isNL ? shapeButtonNL.title : shapeButtonBE.title;
|
|
53902
|
+
const updateEditModeButtonsWithFir = (drawModes, newFirGeoJSON) => {
|
|
53903
|
+
const isNL = newFirGeoJSON === intersectionShapeNL;
|
|
53904
|
+
return drawModes.map(mode => {
|
|
53905
|
+
if (mode.drawModeId === firButtonDrawId) {
|
|
53906
|
+
return Object.assign(Object.assign({}, mode), {
|
|
53907
|
+
shape: getUpdatedFirShape(isNL),
|
|
53908
|
+
title: getFirTitle(isNL)
|
|
53909
|
+
});
|
|
53910
|
+
}
|
|
53911
|
+
return mode;
|
|
53912
|
+
});
|
|
53913
|
+
};
|
|
53914
|
+
// example configs
|
|
53915
|
+
const startToolExampleConfig = {
|
|
53916
|
+
defaultGeoJSONIntersectionBounds: intersectionShapeNL,
|
|
53917
|
+
defaultDrawModes: getEditModes(featurePropertiesStart),
|
|
53918
|
+
defaultGeoJSON: {
|
|
53919
|
+
type: 'FeatureCollection',
|
|
53920
|
+
features: [{
|
|
53921
|
+
type: 'Feature',
|
|
53922
|
+
properties: Object.assign(Object.assign({}, featurePropertiesStart), {
|
|
53923
|
+
selectionType: 'box'
|
|
53924
|
+
}),
|
|
53925
|
+
geometry: {
|
|
53926
|
+
type: 'Polygon',
|
|
53927
|
+
coordinates: [[[9.451665078283622, 53.21804334226515], [4.734608638338736, 53.21804334226515], [4.734608638338736, 54.57650543915101], [9.451665078283622, 54.57650543915101], [9.451665078283622, 53.21804334226515]]]
|
|
53928
|
+
}
|
|
53929
|
+
}]
|
|
53930
|
+
},
|
|
53931
|
+
defaultGeoJSONIntersection: {
|
|
53932
|
+
type: 'FeatureCollection',
|
|
53933
|
+
features: [{
|
|
53934
|
+
type: 'Feature',
|
|
53935
|
+
properties: Object.assign(Object.assign({}, defaultIntersectionStyleProperties), {
|
|
53936
|
+
selectionType: 'box'
|
|
53937
|
+
}),
|
|
53938
|
+
geometry: {
|
|
53939
|
+
type: 'Polygon',
|
|
53940
|
+
coordinates: [[[4.734608638338736, 53.21804334226515], [7.181571844927457, 53.21804334226515], [7.191667, 53.3], [6.5, 53.666667], [6.500001364755953, 54.57650543915101], [4.734608638338736, 54.57650543915101], [4.734608638338736, 53.21804334226515]]]
|
|
53941
|
+
}
|
|
53942
|
+
}]
|
|
53943
|
+
}
|
|
53944
|
+
};
|
|
53945
|
+
const endToolExampleConfig = {
|
|
53946
|
+
defaultGeoJSONIntersectionBounds: intersectionShapeNL,
|
|
53947
|
+
defaultDrawModes: getEditModes(featurePropertiesEnd),
|
|
53948
|
+
defaultGeoJSONIntersectionProperties: featurePropertiesEnd,
|
|
53949
|
+
defaultGeoJSON: {
|
|
53950
|
+
type: 'FeatureCollection',
|
|
53951
|
+
features: [{
|
|
53952
|
+
type: 'Feature',
|
|
53953
|
+
properties: Object.assign(Object.assign({}, featurePropertiesEnd), {
|
|
53954
|
+
selectionType: 'poly'
|
|
53955
|
+
}),
|
|
53956
|
+
geometry: {
|
|
53957
|
+
type: 'Polygon',
|
|
53958
|
+
coordinates: [[[2.3408785046353606, 52.57033268070152], [8.870833501723242, 51.74975701659361], [-0.088053542798945, 50.72496422996941], [2.3408785046353606, 52.57033268070152]]]
|
|
53959
|
+
}
|
|
53960
|
+
}]
|
|
53961
|
+
},
|
|
53962
|
+
defaultGeoJSONIntersection: {
|
|
53963
|
+
type: 'FeatureCollection',
|
|
53964
|
+
features: [{
|
|
53965
|
+
type: 'Feature',
|
|
53966
|
+
properties: Object.assign(Object.assign({}, featurePropertiesEnd), {
|
|
53967
|
+
selectionType: 'poly'
|
|
53968
|
+
}),
|
|
53969
|
+
geometry: {
|
|
53970
|
+
type: 'Polygon',
|
|
53971
|
+
coordinates: [[[2.000002, 51.500002], [3.370001, 51.369722], [3.362223, 51.320002], [3.36389, 51.313608], [3.373613, 51.309999], [3.952501, 51.214441], [4.397501, 51.452776], [5.078611, 51.391665], [5.249839243115953, 51.335557264081125], [6.173465572431757, 51.44120940537001], [5.94639, 51.811663], [6.405001, 51.830828], [6.708618091513499, 52.02146813052448], [2.8253551673020594, 52.50945174669971], [2.000002, 51.500002]]]
|
|
53972
|
+
}
|
|
53973
|
+
}]
|
|
53974
|
+
}
|
|
53975
|
+
};
|
|
53976
|
+
|
|
53268
53977
|
var fails$5 = fails$j;
|
|
53269
53978
|
var global$4 = global$h;
|
|
53270
53979
|
|
|
@@ -54010,6 +54719,30 @@ function debounce$2 (delay, callback, options) {
|
|
|
54010
54719
|
const setLayerInfo = (wmLayer, mapId, onUpdateLayerInformation) => {
|
|
54011
54720
|
const origin = 'ReactMapViewParseLayer';
|
|
54012
54721
|
const map = webmapUtils.getWMJSMapById(mapId);
|
|
54722
|
+
const mapDimensions = map === null || map === void 0 ? void 0 : map.mapdimensions.map(mapdim => {
|
|
54723
|
+
return {
|
|
54724
|
+
units: mapdim.units,
|
|
54725
|
+
currentValue: mapdim.currentValue,
|
|
54726
|
+
name: mapdim.name
|
|
54727
|
+
};
|
|
54728
|
+
});
|
|
54729
|
+
const layerDimensions = wmLayer.dimensions.map(dim => {
|
|
54730
|
+
const {
|
|
54731
|
+
name,
|
|
54732
|
+
units,
|
|
54733
|
+
synced
|
|
54734
|
+
} = dim;
|
|
54735
|
+
return {
|
|
54736
|
+
name,
|
|
54737
|
+
units,
|
|
54738
|
+
currentValue: dim.getValue(),
|
|
54739
|
+
minValue: dim.getFirstValue(),
|
|
54740
|
+
maxValue: dim.getLastValue(),
|
|
54741
|
+
timeInterval: dim.getDimInterval(),
|
|
54742
|
+
values: dim.getValues(),
|
|
54743
|
+
synced
|
|
54744
|
+
};
|
|
54745
|
+
});
|
|
54013
54746
|
/* Update list of layers for service */
|
|
54014
54747
|
const updateObject = {
|
|
54015
54748
|
origin,
|
|
@@ -54021,34 +54754,12 @@ const setLayerInfo = (wmLayer, mapId, onUpdateLayerInformation) => {
|
|
|
54021
54754
|
mapDimensions: {
|
|
54022
54755
|
mapId,
|
|
54023
54756
|
origin,
|
|
54024
|
-
dimensions:
|
|
54025
|
-
return {
|
|
54026
|
-
units: mapdim.units,
|
|
54027
|
-
currentValue: mapdim.currentValue,
|
|
54028
|
-
name: mapdim.name
|
|
54029
|
-
};
|
|
54030
|
-
}) || []
|
|
54757
|
+
dimensions: mapDimensions !== null && mapDimensions !== void 0 ? mapDimensions : []
|
|
54031
54758
|
},
|
|
54032
54759
|
layerDimensions: {
|
|
54033
54760
|
origin,
|
|
54034
54761
|
layerId: wmLayer.id,
|
|
54035
|
-
dimensions:
|
|
54036
|
-
const {
|
|
54037
|
-
name,
|
|
54038
|
-
units,
|
|
54039
|
-
synced
|
|
54040
|
-
} = dim;
|
|
54041
|
-
return {
|
|
54042
|
-
name,
|
|
54043
|
-
units,
|
|
54044
|
-
currentValue: dim.getValue(),
|
|
54045
|
-
minValue: dim.getFirstValue(),
|
|
54046
|
-
maxValue: dim.getLastValue(),
|
|
54047
|
-
timeInterval: dim.getDimInterval(),
|
|
54048
|
-
values: dim.getValues(),
|
|
54049
|
-
synced
|
|
54050
|
-
};
|
|
54051
|
-
})
|
|
54762
|
+
dimensions: layerDimensions
|
|
54052
54763
|
}
|
|
54053
54764
|
};
|
|
54054
54765
|
onUpdateLayerInformation === null || onUpdateLayerInformation === void 0 ? void 0 : onUpdateLayerInformation(updateObject);
|
|
@@ -54638,6 +55349,15 @@ class ReactMapView extends React.Component {
|
|
|
54638
55349
|
}
|
|
54639
55350
|
}
|
|
54640
55351
|
}
|
|
55352
|
+
/* Check if srs */
|
|
55353
|
+
if (!prevProps || prevProps.srs !== props.srs) {
|
|
55354
|
+
if (props.bbox.left !== undefined) {
|
|
55355
|
+
wmjsMap.suspendEvent('onupdatebbox');
|
|
55356
|
+
wmjsMap.setProjection(props.srs, new WMBBOX(props.bbox));
|
|
55357
|
+
wmjsMap.resumeEvent('onupdatebbox');
|
|
55358
|
+
wmjsMap.draw();
|
|
55359
|
+
}
|
|
55360
|
+
}
|
|
54641
55361
|
/* Check display/hide map cursor */
|
|
54642
55362
|
if (!prevProps || prevProps.displayMapPin !== props.displayMapPin) {
|
|
54643
55363
|
if (props.displayMapPin === true) {
|
|
@@ -56890,4 +57610,4 @@ var publicLayers = /*#__PURE__*/Object.freeze({
|
|
|
56890
57610
|
msgNaturalEUMETSAT: msgNaturalEUMETSAT
|
|
56891
57611
|
});
|
|
56892
57612
|
|
|
56893
|
-
export { CanvasComponent, DRAWMODE, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, Legend, LegendDialog, LegendLayout, MapControlButton, MapControls, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, ReactMapView, ReactMapViewLayer, SearchDialog, SelectField, StoryLayoutGrid, ZoomControls, addFeatureProperties, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, checkHoverFeatures, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, distance, drawPolyStoryStyles, emptyGeoJSON, featureBox, featureMultiPoint, featurePoint, featurePolygon, formatTime, getDrawFunctionFromStore, getFeatureCollection, getGeoJSONPropertyValue, getGeoJson, getIcon, getTimeDimension, intersectGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, lineString, moveFeature, publicLayers, publicServices, registerDrawFunction, simpleBoxGeoJSON, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, useGeoJSON, useMapDrawTool };
|
|
57613
|
+
export { CanvasComponent, DRAWMODE, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, IntersectionSelect, Legend, LegendDialog, LegendLayout, MapControlButton, MapControls, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, ReactMapView, ReactMapViewLayer, SearchDialog, SelectField, StoryLayoutGrid, ZoomControls, addFeatureProperties, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, checkHoverFeatures, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, distance, drawPolyStoryStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, formatTime, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getTimeDimension, getToolIcon, intersectGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, lineString, moveFeature, opacityOptions, publicLayers, publicServices, registerDrawFunction, rewindGeometry, simpleBoxGeoJSON, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, updateEditModeButtonsWithFir, useGeoJSON, useMapDrawTool };
|
package/package.json
CHANGED
|
@@ -2,4 +2,6 @@ export * from './types';
|
|
|
2
2
|
export { useMapDrawTool, defaultPoint, defaultDelete, defaultPolygon, defaultBox, defaultIntersectionStyleProperties, getIcon, currentlySupportedDrawModes, defaultModes, } from './useMapDrawTool';
|
|
3
3
|
export type { MapDrawToolOptions } from './useMapDrawTool';
|
|
4
4
|
export * from './utils';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './storyExamplesMapDrawTool';
|
|
6
|
+
export * from './storyExamplesMapDrawToolIntersection';
|
|
7
|
+
export * from './storyExamplesMapDrawToolMultipleDrawTools';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MapDrawToolOptions } from './useMapDrawTool';
|
|
3
|
+
export declare const opacityOptions: number[];
|
|
4
|
+
export declare const fillOptions: any[];
|
|
5
|
+
export declare const strokeWidthOptions: number[];
|
|
6
|
+
export declare const getToolIcon: (id: string) => React.ReactElement;
|
|
7
|
+
export declare const basicExampleDrawOptions: MapDrawToolOptions;
|
|
8
|
+
export declare const basicExampleMultipleShapeDrawOptions: MapDrawToolOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MapDrawToolOptions } from './useMapDrawTool';
|
|
3
|
+
export declare const getIntersectionToolIcon: (id: string) => React.ReactElement;
|
|
4
|
+
export declare const exampleIntersections: {
|
|
5
|
+
title: string;
|
|
6
|
+
geojson: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
|
|
7
|
+
}[];
|
|
8
|
+
export declare const exampleIntersectionOptions: MapDrawToolOptions;
|
|
9
|
+
export declare const exampleIntersectionWithShapeOptions: MapDrawToolOptions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawMode } from './types';
|
|
3
|
+
import { MapDrawToolOptions } from './useMapDrawTool';
|
|
4
|
+
export declare const exampleIntersectionsMultiDrawTool: {
|
|
5
|
+
title: string;
|
|
6
|
+
geojson: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
|
|
7
|
+
}[];
|
|
8
|
+
export declare const getDoubleControlToolIcon: (drawMode: DrawMode) => React.ReactElement;
|
|
9
|
+
export declare const updateEditModeButtonsWithFir: (drawModes: DrawMode[], newFirGeoJSON: GeoJSON.FeatureCollection) => DrawMode[];
|
|
10
|
+
export declare const startToolExampleConfig: MapDrawToolOptions;
|
|
11
|
+
export declare const endToolExampleConfig: MapDrawToolOptions;
|
|
@@ -38,6 +38,9 @@ export interface MapDrawToolOptions {
|
|
|
38
38
|
defaultGeoJSONIntersection?: GeoJSON.FeatureCollection;
|
|
39
39
|
defaultGeoJSONIntersectionBounds?: GeoJSON.FeatureCollection;
|
|
40
40
|
defaultGeoJSONIntersectionProperties?: GeoJSON.GeoJsonProperties;
|
|
41
|
+
geoJSONLayerId?: string;
|
|
42
|
+
geoJSONIntersectionLayerId?: string;
|
|
43
|
+
geoJSONIntersectionBoundsLayerId?: string;
|
|
41
44
|
}
|
|
42
45
|
export declare const getIcon: (drawModeId: string) => React.ReactElement | null;
|
|
43
46
|
export declare const defaultPoint: {
|
|
@@ -101,5 +104,5 @@ export declare const currentlySupportedDrawModes: ({
|
|
|
101
104
|
shape: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
|
|
102
105
|
isSelectable: boolean;
|
|
103
106
|
})[];
|
|
104
|
-
export declare const useMapDrawTool: ({ defaultDrawModes, shouldAllowMultipleShapes, defaultGeoJSON, defaultGeoJSONIntersection, defaultGeoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties, }: MapDrawToolOptions) => MapDrawToolProps;
|
|
107
|
+
export declare const useMapDrawTool: ({ defaultDrawModes, shouldAllowMultipleShapes, defaultGeoJSON, defaultGeoJSONIntersection, defaultGeoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties, geoJSONLayerId, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, }: MapDrawToolOptions) => MapDrawToolProps;
|
|
105
108
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Feature } from '@turf/turf';
|
|
2
|
+
import { FeatureCollection } from 'geojson';
|
|
1
3
|
import { DrawMode } from './types';
|
|
2
4
|
/**
|
|
3
5
|
* Adds properties to the first geojson feature based on the given property object.
|
|
@@ -39,3 +41,4 @@ export declare const createInterSections: (geojson: GeoJSON.FeatureCollection, o
|
|
|
39
41
|
export declare const getGeoJson: (geojson: GeoJSON.FeatureCollection, shouldAllowMultipleShapes: boolean) => GeoJSON.FeatureCollection;
|
|
40
42
|
export declare const getFeatureCollection: (geoJSONFeature: GeoJSON.Feature | GeoJSON.FeatureCollection, shouldAllowMultipleShapes: boolean, geoJSONFeatureCollection?: GeoJSON.FeatureCollection) => GeoJSON.FeatureCollection;
|
|
41
43
|
export declare const isGeoJSONFeatureCreatedByTool: (existingJSON: GeoJSON.FeatureCollection, newGeoJSON: GeoJSON.Feature | GeoJSON.FeatureCollection) => boolean;
|
|
44
|
+
export declare const rewindGeometry: (geoJSON: FeatureCollection) => FeatureCollection;
|
|
@@ -10,7 +10,7 @@ export interface MapViewLayerProps extends LayerFoundation {
|
|
|
10
10
|
updateGeojson?: (geoJson: GeoJSON.FeatureCollection, reason: string) => void;
|
|
11
11
|
exitDrawModeCallback?: (reason: DrawModeExitCallback) => void;
|
|
12
12
|
selectedFeatureIndex?: number;
|
|
13
|
-
onClickFeature?: (event
|
|
13
|
+
onClickFeature?: (event?: FeatureEvent) => void;
|
|
14
14
|
onHoverFeature?: (event: FeatureEvent) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare const MapViewLayer: React.FC<MapViewLayerProps>;
|