@geowiki/map 0.15.1-dev.0 → 0.16.0-dev.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/dist/index.js +674 -812
- package/dist/index.mjs +219 -357
- package/dist/styles.css +1 -1
- package/package.json +5 -7
package/dist/index.js
CHANGED
|
@@ -163,8 +163,7 @@ var init_GenericCache = __esm({
|
|
|
163
163
|
getFromStorage(key) {
|
|
164
164
|
try {
|
|
165
165
|
const stored = localStorage.getItem(key);
|
|
166
|
-
if (!stored)
|
|
167
|
-
return null;
|
|
166
|
+
if (!stored) return null;
|
|
168
167
|
const entry = JSON.parse(stored);
|
|
169
168
|
if (this.isValid(entry)) {
|
|
170
169
|
this.hitCount++;
|
|
@@ -449,8 +448,8 @@ var init_GenericCache = __esm({
|
|
|
449
448
|
});
|
|
450
449
|
|
|
451
450
|
// src/index.tsx
|
|
452
|
-
var
|
|
453
|
-
__export(
|
|
451
|
+
var index_exports = {};
|
|
452
|
+
__export(index_exports, {
|
|
454
453
|
Annotation: () => Annotation,
|
|
455
454
|
BasfMap: () => BasfMap,
|
|
456
455
|
BasicMap: () => BasicMap,
|
|
@@ -487,7 +486,7 @@ __export(src_exports, {
|
|
|
487
486
|
useMapLayerStore: () => useMapLayerStore,
|
|
488
487
|
useMapStore: () => useMapStore
|
|
489
488
|
});
|
|
490
|
-
module.exports = __toCommonJS(
|
|
489
|
+
module.exports = __toCommonJS(index_exports);
|
|
491
490
|
|
|
492
491
|
// src/Components/GenericControl.tsx
|
|
493
492
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -623,7 +622,7 @@ var prepareRGBImage = (array, width, height) => {
|
|
|
623
622
|
ctx == null ? void 0 : ctx.putImageData(imageData, 0, 0);
|
|
624
623
|
return canvas;
|
|
625
624
|
};
|
|
626
|
-
var getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvasContext, selectedBand) => __async(
|
|
625
|
+
var getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvasContext, selectedBand) => __async(null, null, function* () {
|
|
627
626
|
var _a, _b;
|
|
628
627
|
try {
|
|
629
628
|
var tiffWidth = rasterItem.width;
|
|
@@ -639,8 +638,7 @@ var getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvas
|
|
|
639
638
|
var rgb = null;
|
|
640
639
|
if (((_a = rasterItem.name) == null ? void 0 : _a.toLowerCase().includes("ndvi")) && ((_b = rasterItem.name) == null ? void 0 : _b.toLowerCase().includes("perc")))
|
|
641
640
|
rgb = yield getNDVIValueForPixel(ndviImageCanvasContext, xTiff, yTiff);
|
|
642
|
-
else
|
|
643
|
-
rgb = null;
|
|
641
|
+
else rgb = null;
|
|
644
642
|
return [
|
|
645
643
|
selectedValue,
|
|
646
644
|
rgb !== null && rgb !== void 0 ? {
|
|
@@ -683,12 +681,11 @@ var deepCloneRasterAssetItem = (isAnnualAnnotation, asset, assetBuffer, uri, sel
|
|
|
683
681
|
rasterItem.buffer = [...asset.buffer];
|
|
684
682
|
rasterItem.uri = [...asset.uri];
|
|
685
683
|
rasterItem.buffer[selectedBand] = new Uint32Array(assetBuffer);
|
|
686
|
-
if (Array.isArray(rasterItem.uri))
|
|
687
|
-
rasterItem.uri[selectedBand] = uri;
|
|
684
|
+
if (Array.isArray(rasterItem.uri)) rasterItem.uri[selectedBand] = uri;
|
|
688
685
|
}
|
|
689
686
|
return rasterItem;
|
|
690
687
|
};
|
|
691
|
-
var getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnnotation, selectedBand, metadata) => __async(
|
|
688
|
+
var getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnnotation, selectedBand, metadata) => __async(null, null, function* () {
|
|
692
689
|
var { newArray, canvas } = yield getEmptyPreviewRasterItemForInsert(
|
|
693
690
|
length,
|
|
694
691
|
width,
|
|
@@ -713,12 +710,12 @@ var getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnno
|
|
|
713
710
|
}
|
|
714
711
|
return rasterItem;
|
|
715
712
|
});
|
|
716
|
-
var getEmptyPreviewRasterItemForInsert = (length, width, height, labels) => __async(
|
|
713
|
+
var getEmptyPreviewRasterItemForInsert = (length, width, height, labels) => __async(null, null, function* () {
|
|
717
714
|
const newArray = new Uint32Array(length).fill(0);
|
|
718
715
|
const canvas = grayScaleArrayToCanvas(newArray, width, height, labels);
|
|
719
716
|
return { newArray, canvas };
|
|
720
717
|
});
|
|
721
|
-
var updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnnotation) => __async(
|
|
718
|
+
var updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnnotation) => __async(null, null, function* () {
|
|
722
719
|
var _a, _b, _c;
|
|
723
720
|
if (!fromRasterItem) {
|
|
724
721
|
return toPreviewRasterItem;
|
|
@@ -744,7 +741,7 @@ var updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnno
|
|
|
744
741
|
}
|
|
745
742
|
return toPreviewRasterItem;
|
|
746
743
|
});
|
|
747
|
-
var getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(
|
|
744
|
+
var getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(null, null, function* () {
|
|
748
745
|
const tiff = yield (0, import_geotiff.fromArrayBuffer)(arrayBuffer);
|
|
749
746
|
const image = yield tiff.getImage();
|
|
750
747
|
const pool = new import_geotiff.Pool();
|
|
@@ -768,7 +765,7 @@ var getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(void 0, null, fu
|
|
|
768
765
|
pool.destroy();
|
|
769
766
|
return { width, height, rasterItems };
|
|
770
767
|
});
|
|
771
|
-
var getRasterItems = (arrayBuffer, projectType) => __async(
|
|
768
|
+
var getRasterItems = (arrayBuffer, projectType) => __async(null, null, function* () {
|
|
772
769
|
const tiff = yield (0, import_geotiff.fromArrayBuffer)(arrayBuffer);
|
|
773
770
|
const image = yield tiff.getImage();
|
|
774
771
|
const pool = new import_geotiff.Pool();
|
|
@@ -808,7 +805,7 @@ var getRasterItems = (arrayBuffer, projectType) => __async(void 0, null, functio
|
|
|
808
805
|
pool.destroy();
|
|
809
806
|
return { rasters, width, height, rasterItems };
|
|
810
807
|
});
|
|
811
|
-
var getAssetItemsForLocationAssets = (assets, labels) => __async(
|
|
808
|
+
var getAssetItemsForLocationAssets = (assets, labels) => __async(null, null, function* () {
|
|
812
809
|
var rasterItems = [];
|
|
813
810
|
for (var i = 0; i < (assets == null ? void 0 : assets.length); i++) {
|
|
814
811
|
const item = assets[i];
|
|
@@ -831,7 +828,7 @@ var getAssetItemsForLocationAssets = (assets, labels) => __async(void 0, null, f
|
|
|
831
828
|
}
|
|
832
829
|
return rasterItems;
|
|
833
830
|
});
|
|
834
|
-
var getRasterAssetItemsForLocationComposite = (assets) => __async(
|
|
831
|
+
var getRasterAssetItemsForLocationComposite = (assets) => __async(null, null, function* () {
|
|
835
832
|
var rasterItems = [];
|
|
836
833
|
for (var i = 0; i < (assets == null ? void 0 : assets.length); i++) {
|
|
837
834
|
const item = assets[i];
|
|
@@ -852,7 +849,7 @@ var getRasterAssetItemsForLocationComposite = (assets) => __async(void 0, null,
|
|
|
852
849
|
}
|
|
853
850
|
return rasterItems;
|
|
854
851
|
});
|
|
855
|
-
var copyAllRasterSegments = (rasterItem, previewRasterItem, selectedValue, labelValue, labels) => __async(
|
|
852
|
+
var copyAllRasterSegments = (rasterItem, previewRasterItem, selectedValue, labelValue, labels) => __async(null, null, function* () {
|
|
856
853
|
var newBuffer = overwriteArrayBufferWithSelectedValue(
|
|
857
854
|
rasterItem.buffer,
|
|
858
855
|
previewRasterItem.buffer,
|
|
@@ -928,8 +925,7 @@ function getAdjPixel(y, x, selectedValue, array2dMatrix) {
|
|
|
928
925
|
while (pixelsToCheck.length > 0) {
|
|
929
926
|
const [xTiff, yTiff] = pixelsToCheck.pop();
|
|
930
927
|
var key = xTiff + "_" + yTiff;
|
|
931
|
-
if (checkedPixels.has(key))
|
|
932
|
-
continue;
|
|
928
|
+
if (checkedPixels.has(key)) continue;
|
|
933
929
|
checkedPixels.add(key);
|
|
934
930
|
if (array2dMatrix[yTiff][xTiff] === selectedValue) {
|
|
935
931
|
sameValPixels.push([yTiff, xTiff]);
|
|
@@ -951,7 +947,7 @@ function getAdjPixel(y, x, selectedValue, array2dMatrix) {
|
|
|
951
947
|
}
|
|
952
948
|
return sameValPixels;
|
|
953
949
|
}
|
|
954
|
-
var paintRasterSegment = (sourceRasterItem, destRasterItem, locations, bounds, labelValue, labels, paintType, selectedBand, isAnnualAnnotation) => __async(
|
|
950
|
+
var paintRasterSegment = (sourceRasterItem, destRasterItem, locations, bounds, labelValue, labels, paintType, selectedBand, isAnnualAnnotation) => __async(null, null, function* () {
|
|
955
951
|
var tiffWidth = sourceRasterItem.width;
|
|
956
952
|
var tiffHeight = sourceRasterItem.height;
|
|
957
953
|
var annotatedRaster = isAnnualAnnotation ? destRasterItem.buffer : destRasterItem.buffer[selectedBand];
|
|
@@ -1074,8 +1070,7 @@ function pointInsidePolygon(xTiff, yTiff, vs) {
|
|
|
1074
1070
|
var xi = vs[i].xTiff, yi = vs[i].yTiff;
|
|
1075
1071
|
var xj = vs[j].xTiff, yj = vs[j].yTiff;
|
|
1076
1072
|
var intersect = yi > yTiff !== yj > yTiff && xTiff < (xj - xi) * (yTiff - yi) / (yj - yi) + xi;
|
|
1077
|
-
if (intersect)
|
|
1078
|
-
inside = !inside;
|
|
1073
|
+
if (intersect) inside = !inside;
|
|
1079
1074
|
}
|
|
1080
1075
|
return inside;
|
|
1081
1076
|
}
|
|
@@ -1114,7 +1109,7 @@ function getDiagonalCoordinates(x1, y1, x2, y2) {
|
|
|
1114
1109
|
coordinates.push({ yTiff: x2, xTiff: y2 });
|
|
1115
1110
|
return coordinates;
|
|
1116
1111
|
}
|
|
1117
|
-
var getActiveLearningAnnotation = (assetHref, projectType) => __async(
|
|
1112
|
+
var getActiveLearningAnnotation = (assetHref, projectType) => __async(null, null, function* () {
|
|
1118
1113
|
const res = yield fetch(assetHref);
|
|
1119
1114
|
const buffer = yield res.arrayBuffer();
|
|
1120
1115
|
const rItems = yield getRasterItems(buffer, projectType);
|
|
@@ -1131,7 +1126,7 @@ var getActiveLearningAnnotation = (assetHref, projectType) => __async(void 0, nu
|
|
|
1131
1126
|
};
|
|
1132
1127
|
return assetItem;
|
|
1133
1128
|
});
|
|
1134
|
-
var createImageDataForNDVI = (asset) => __async(
|
|
1129
|
+
var createImageDataForNDVI = (asset) => __async(null, null, function* () {
|
|
1135
1130
|
var canvas = document.createElement("canvas");
|
|
1136
1131
|
var context = canvas.getContext("2d");
|
|
1137
1132
|
var image = new Image();
|
|
@@ -1141,7 +1136,7 @@ var createImageDataForNDVI = (asset) => __async(void 0, null, function* () {
|
|
|
1141
1136
|
context == null ? void 0 : context.drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
1142
1137
|
return context;
|
|
1143
1138
|
});
|
|
1144
|
-
var getNDVIValueForPixel = (ndviImageCanvasContext, x, y) => __async(
|
|
1139
|
+
var getNDVIValueForPixel = (ndviImageCanvasContext, x, y) => __async(null, null, function* () {
|
|
1145
1140
|
var context = ndviImageCanvasContext;
|
|
1146
1141
|
var data = context == null ? void 0 : context.getImageData(x, y, 1, 1).data;
|
|
1147
1142
|
return data;
|
|
@@ -1361,8 +1356,7 @@ function getRasterAssetItemsForLocationAssets(assets) {
|
|
|
1361
1356
|
if (Array.isArray((_a = rItem.result) == null ? void 0 : _a.base64)) {
|
|
1362
1357
|
bufferData = (_b = rItem.result) == null ? void 0 : _b.base64.map((x) => {
|
|
1363
1358
|
var _a2, _b2;
|
|
1364
|
-
if (((_a2 = rItem.result) == null ? void 0 : _a2.arrayType) == "uint8")
|
|
1365
|
-
return Buffer.from(x, "base64");
|
|
1359
|
+
if (((_a2 = rItem.result) == null ? void 0 : _a2.arrayType) == "uint8") return Buffer.from(x, "base64");
|
|
1366
1360
|
else if (((_b2 = rItem.result) == null ? void 0 : _b2.arrayType) == "uint32") {
|
|
1367
1361
|
const buffer2 = Buffer.from(x, "base64");
|
|
1368
1362
|
return new Uint32Array(
|
|
@@ -1443,16 +1437,14 @@ function ClearAnnotation(annotatedRasterAsset, isAnnualAnnotation, selectedBand,
|
|
|
1443
1437
|
selectedBand,
|
|
1444
1438
|
annotationRasterAsset.metadata
|
|
1445
1439
|
);
|
|
1446
|
-
if (isAnnualAnnotation)
|
|
1447
|
-
return { annotationRaster, pastValues };
|
|
1440
|
+
if (isAnnualAnnotation) return { annotationRaster, pastValues };
|
|
1448
1441
|
else {
|
|
1449
1442
|
var multiBandAnnotation = annotatedRasterAsset;
|
|
1450
1443
|
if (multiBandAnnotation == null ? void 0 : multiBandAnnotation.buffer[selectedBand]) {
|
|
1451
1444
|
multiBandAnnotation.buffer[selectedBand] = annotationRaster.buffer[selectedBand];
|
|
1452
1445
|
multiBandAnnotation.uri[selectedBand] = annotationRaster.uri[selectedBand];
|
|
1453
1446
|
return { multiBandAnnotation, undefined: void 0 };
|
|
1454
|
-
} else
|
|
1455
|
-
return { annotatedRasterAsset: void 0, undefined: void 0 };
|
|
1447
|
+
} else return { annotatedRasterAsset: void 0, undefined: void 0 };
|
|
1456
1448
|
}
|
|
1457
1449
|
});
|
|
1458
1450
|
}
|
|
@@ -1486,8 +1478,7 @@ function createTask(locationId, projectId, referenceDate) {
|
|
|
1486
1478
|
currentTask: res.task,
|
|
1487
1479
|
annotation_dates: yield getAnnotationDates(res == null ? void 0 : res.task)
|
|
1488
1480
|
};
|
|
1489
|
-
} else
|
|
1490
|
-
return { location: null, currentTask: null, annotation_dates: null };
|
|
1481
|
+
} else return { location: null, currentTask: null, annotation_dates: null };
|
|
1491
1482
|
});
|
|
1492
1483
|
}
|
|
1493
1484
|
function getTask(taskId) {
|
|
@@ -1515,8 +1506,7 @@ function getTask(taskId) {
|
|
|
1515
1506
|
annotation_dates: yield getAnnotationDates(res == null ? void 0 : res.task),
|
|
1516
1507
|
location: locData
|
|
1517
1508
|
};
|
|
1518
|
-
} else
|
|
1519
|
-
return { currentTask: null, annotation_dates: null, location: null };
|
|
1509
|
+
} else return { currentTask: null, annotation_dates: null, location: null };
|
|
1520
1510
|
});
|
|
1521
1511
|
}
|
|
1522
1512
|
function getActiveLearningAnnotationAsset(assetHref, labels, projectDetail) {
|
|
@@ -1568,8 +1558,7 @@ function insertEmptyBufferForSingleBand(length, width, height, selectedBand, ann
|
|
|
1568
1558
|
annotatedAsset.buffer[selectedBand] = newArray;
|
|
1569
1559
|
annotatedAsset.uri[selectedBand] = canvas.toDataURL();
|
|
1570
1560
|
return annotatedAsset;
|
|
1571
|
-
} else
|
|
1572
|
-
return null;
|
|
1561
|
+
} else return null;
|
|
1573
1562
|
});
|
|
1574
1563
|
}
|
|
1575
1564
|
function getTaskChangeDetails(taskId) {
|
|
@@ -1583,10 +1572,8 @@ function getTaskGeometryDetail(taskId) {
|
|
|
1583
1572
|
});
|
|
1584
1573
|
}
|
|
1585
1574
|
function getCentroid(geometry, has_area_of_interest, geometry_aoi, is_segment, geometry_segment) {
|
|
1586
|
-
if (has_area_of_interest)
|
|
1587
|
-
|
|
1588
|
-
if (is_segment)
|
|
1589
|
-
return geometry_segment;
|
|
1575
|
+
if (has_area_of_interest) return geometry_aoi;
|
|
1576
|
+
if (is_segment) return geometry_segment;
|
|
1590
1577
|
return geometry;
|
|
1591
1578
|
}
|
|
1592
1579
|
function showAnnotation(savedAnnotations, submittedAnnotations, annotatedRasterAsset) {
|
|
@@ -1728,7 +1715,7 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
1728
1715
|
setRecenterLocation: () => set({ recenterLocation: false }),
|
|
1729
1716
|
setTimerReset: (timerreset) => set({ timerReset: timerreset }),
|
|
1730
1717
|
setAnnotationTime: (annotationtime) => set({ annotationTime: annotationtime }),
|
|
1731
|
-
onLocationSelected: (point3) => __async(
|
|
1718
|
+
onLocationSelected: (point3) => __async(null, null, function* () {
|
|
1732
1719
|
var data = yield import_evoland_api_proxy2.LocationService.getPolygonUtmlocationLonLonLatLatWidthWidthHeightHeightGet(
|
|
1733
1720
|
point3.lng,
|
|
1734
1721
|
point3.lat,
|
|
@@ -1754,10 +1741,10 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
1754
1741
|
location: locData
|
|
1755
1742
|
});
|
|
1756
1743
|
}),
|
|
1757
|
-
onRecenterLocation: () => __async(
|
|
1744
|
+
onRecenterLocation: () => __async(null, null, function* () {
|
|
1758
1745
|
return set({ recenterLocation: true });
|
|
1759
1746
|
}),
|
|
1760
|
-
getLocationAssets: (locationId, projectId, type, taskId) => __async(
|
|
1747
|
+
getLocationAssets: (locationId, projectId, type, taskId) => __async(null, null, function* () {
|
|
1761
1748
|
var _a, _b;
|
|
1762
1749
|
const state = useEvolandStore.getState();
|
|
1763
1750
|
var {
|
|
@@ -1880,7 +1867,7 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
1880
1867
|
}
|
|
1881
1868
|
return [];
|
|
1882
1869
|
}),
|
|
1883
|
-
getLocationDetails: (locationId, projectId, user, taskId, isAdmin) => __async(
|
|
1870
|
+
getLocationDetails: (locationId, projectId, user, taskId, isAdmin) => __async(null, null, function* () {
|
|
1884
1871
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1885
1872
|
var state = useEvolandStore.getState();
|
|
1886
1873
|
var { referenceDate, reference_dates, sessionTimeOut, projectDetail, task_for_review } = state;
|
|
@@ -1969,7 +1956,7 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
1969
1956
|
}
|
|
1970
1957
|
}
|
|
1971
1958
|
}),
|
|
1972
|
-
getNextLocationDetails: (projectId) => __async(
|
|
1959
|
+
getNextLocationDetails: (projectId) => __async(null, null, function* () {
|
|
1973
1960
|
var _a, _b, _c;
|
|
1974
1961
|
set({ isLoading: true });
|
|
1975
1962
|
var state = useEvolandStore.getState();
|
|
@@ -2038,7 +2025,7 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2038
2025
|
setOpacity: (opacity) => set({ opacity }),
|
|
2039
2026
|
setCompositeOpacity: (opacity) => set({ compositeOpacity: opacity }),
|
|
2040
2027
|
setAnnotationOpacity: (opacity) => set({ annotationOpacity: opacity }),
|
|
2041
|
-
addLabel: (loc, bounds, label) => __async(
|
|
2028
|
+
addLabel: (loc, bounds, label) => __async(null, null, function* () {
|
|
2042
2029
|
var _a;
|
|
2043
2030
|
set({ isLoading: true });
|
|
2044
2031
|
var store = useEvolandStore.getState();
|
|
@@ -2098,14 +2085,14 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2098
2085
|
setShowTimeSeries: (value) => set({ showTimeSeries: value }),
|
|
2099
2086
|
reset: () => set(initialState),
|
|
2100
2087
|
setSelectedColorLabel: (label) => set({ selectedColorLabel: label }),
|
|
2101
|
-
getLegendsDetails: (array) => __async(
|
|
2088
|
+
getLegendsDetails: (array) => __async(null, null, function* () {
|
|
2102
2089
|
var store = useEvolandStore.getState();
|
|
2103
2090
|
var legends = yield getLegends(array, store.labels);
|
|
2104
2091
|
set({
|
|
2105
2092
|
legends
|
|
2106
2093
|
});
|
|
2107
2094
|
}),
|
|
2108
|
-
getLocationMetaData: (locationId, projectId, taskId) => __async(
|
|
2095
|
+
getLocationMetaData: (locationId, projectId, taskId) => __async(null, null, function* () {
|
|
2109
2096
|
var _a, _b;
|
|
2110
2097
|
set({ isLoading: true });
|
|
2111
2098
|
var state = useEvolandStore.getState();
|
|
@@ -2131,7 +2118,7 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2131
2118
|
set({ sessionTimeOut: true, isLoading: false });
|
|
2132
2119
|
}
|
|
2133
2120
|
}),
|
|
2134
|
-
getLabels: (projectId) => __async(
|
|
2121
|
+
getLabels: (projectId) => __async(null, null, function* () {
|
|
2135
2122
|
var state = useEvolandStore.getState();
|
|
2136
2123
|
if (state.labels) {
|
|
2137
2124
|
return state.labels;
|
|
@@ -2153,10 +2140,10 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2153
2140
|
});
|
|
2154
2141
|
return allLabels;
|
|
2155
2142
|
}),
|
|
2156
|
-
setBrushThickness: (value) => __async(
|
|
2143
|
+
setBrushThickness: (value) => __async(null, null, function* () {
|
|
2157
2144
|
return set({ brushThickness: value });
|
|
2158
2145
|
}),
|
|
2159
|
-
getProjectDetail: (projectId) => __async(
|
|
2146
|
+
getProjectDetail: (projectId) => __async(null, null, function* () {
|
|
2160
2147
|
set({ isLoading: true });
|
|
2161
2148
|
const projectInfo = yield import_evoland_api_proxy2.ProjectService.projectDetailProjectdetailProjectIdProjectIdGet(
|
|
2162
2149
|
projectId
|
|
@@ -2167,12 +2154,12 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2167
2154
|
isAnnualAnnotation: (projectInfo == null ? void 0 : projectInfo.project_type) == "ANNUALLY" /* ANNUALLY */ ? true : false
|
|
2168
2155
|
});
|
|
2169
2156
|
}),
|
|
2170
|
-
getTaskEvents: (taskId) => __async(
|
|
2157
|
+
getTaskEvents: (taskId) => __async(null, null, function* () {
|
|
2171
2158
|
set({ isLoading: true });
|
|
2172
2159
|
const taskevents = yield import_evoland_api_proxy2.TaskService.getTaskEventsTaskeventsTaskIdTaskIdGet(taskId);
|
|
2173
2160
|
set({ isLoading: false, taskEvents: taskevents });
|
|
2174
2161
|
}),
|
|
2175
|
-
getTaskAnnotation: (submittedAnnotationAsset, assetType) => __async(
|
|
2162
|
+
getTaskAnnotation: (submittedAnnotationAsset, assetType) => __async(null, null, function* () {
|
|
2176
2163
|
var _a, _b, _c;
|
|
2177
2164
|
if (submittedAnnotationAsset != null && submittedAnnotationAsset.length > 0) {
|
|
2178
2165
|
const state = useEvolandStore.getState();
|
|
@@ -2222,7 +2209,7 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2222
2209
|
setCurrentPosition: (position) => set({ currentPosition: position }),
|
|
2223
2210
|
setSessionTimeOut: (hasTimeOut) => set({ sessionTimeOut: hasTimeOut }),
|
|
2224
2211
|
setLatestTaskAnnotation: (locationTask) => set({ latestTaskAnnotation: locationTask }),
|
|
2225
|
-
getTaskReferenceDates: (projectId, locatioId, asset_type, setSelected) => __async(
|
|
2212
|
+
getTaskReferenceDates: (projectId, locatioId, asset_type, setSelected) => __async(null, null, function* () {
|
|
2226
2213
|
const state = useEvolandStore.getState();
|
|
2227
2214
|
const { annotation_dates, reference_dates, selectedReferenceDate } = state;
|
|
2228
2215
|
var task_ref_dates = yield getRefDates(projectId, locatioId, asset_type);
|
|
@@ -2238,7 +2225,7 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2238
2225
|
});
|
|
2239
2226
|
}
|
|
2240
2227
|
}),
|
|
2241
|
-
setSelectedReferenceDate: (currentReferenceDate) => __async(
|
|
2228
|
+
setSelectedReferenceDate: (currentReferenceDate) => __async(null, null, function* () {
|
|
2242
2229
|
const state = useEvolandStore.getState();
|
|
2243
2230
|
const { selectedReferenceDate, reference_dates } = state;
|
|
2244
2231
|
if (currentReferenceDate !== selectedReferenceDate)
|
|
@@ -2247,49 +2234,49 @@ var useEvolandStore = (0, import_zustand.create)()((set) => ({
|
|
|
2247
2234
|
selectedBand: reference_dates == null ? void 0 : reference_dates.indexOf(currentReferenceDate)
|
|
2248
2235
|
});
|
|
2249
2236
|
}),
|
|
2250
|
-
setUpdateAsset: (updateAssets) => __async(
|
|
2237
|
+
setUpdateAsset: (updateAssets) => __async(null, null, function* () {
|
|
2251
2238
|
return set({ updateAssets });
|
|
2252
2239
|
}),
|
|
2253
|
-
setComment: (comment) => __async(
|
|
2240
|
+
setComment: (comment) => __async(null, null, function* () {
|
|
2254
2241
|
return set({ comment });
|
|
2255
2242
|
}),
|
|
2256
|
-
setAnnualAnnotation: (val) => __async(
|
|
2243
|
+
setAnnualAnnotation: (val) => __async(null, null, function* () {
|
|
2257
2244
|
return set({ isAnnualAnnotation: val });
|
|
2258
2245
|
}),
|
|
2259
|
-
setSelectedBand: (bandIndex) => __async(
|
|
2246
|
+
setSelectedBand: (bandIndex) => __async(null, null, function* () {
|
|
2260
2247
|
return set({ selectedBand: bandIndex });
|
|
2261
2248
|
}),
|
|
2262
|
-
setAnnotationDates: (annotationDates) => __async(
|
|
2249
|
+
setAnnotationDates: (annotationDates) => __async(null, null, function* () {
|
|
2263
2250
|
return set({ annotation_dates: annotationDates });
|
|
2264
2251
|
}),
|
|
2265
|
-
setSavedAnnotations: (savedAnnotation) => __async(
|
|
2252
|
+
setSavedAnnotations: (savedAnnotation) => __async(null, null, function* () {
|
|
2266
2253
|
return set({ savedAnnotations: savedAnnotation });
|
|
2267
2254
|
}),
|
|
2268
|
-
setLabelList: (labels) => __async(
|
|
2255
|
+
setLabelList: (labels) => __async(null, null, function* () {
|
|
2269
2256
|
return set({ labelList: labels });
|
|
2270
2257
|
}),
|
|
2271
|
-
setLocation: (loc) => __async(
|
|
2258
|
+
setLocation: (loc) => __async(null, null, function* () {
|
|
2272
2259
|
return set({ location: loc });
|
|
2273
2260
|
}),
|
|
2274
|
-
setCurrentTask: (task) => __async(
|
|
2261
|
+
setCurrentTask: (task) => __async(null, null, function* () {
|
|
2275
2262
|
return set({ currentTask: task });
|
|
2276
2263
|
}),
|
|
2277
|
-
setTimeSeriesTypes: (types) => __async(
|
|
2264
|
+
setTimeSeriesTypes: (types) => __async(null, null, function* () {
|
|
2278
2265
|
return set({ timeSeriesTypes: types });
|
|
2279
2266
|
}),
|
|
2280
|
-
setTimeSeriesAssets: (assets) => __async(
|
|
2267
|
+
setTimeSeriesAssets: (assets) => __async(null, null, function* () {
|
|
2281
2268
|
return set({ timeSeriesAssets: assets });
|
|
2282
2269
|
}),
|
|
2283
|
-
setActiveLearningAnnotations: (active_learning) => __async(
|
|
2270
|
+
setActiveLearningAnnotations: (active_learning) => __async(null, null, function* () {
|
|
2284
2271
|
return set({ activeLearningAnnotations: active_learning });
|
|
2285
2272
|
}),
|
|
2286
|
-
setSubmittedAnnotations: (submit_annotation) => __async(
|
|
2273
|
+
setSubmittedAnnotations: (submit_annotation) => __async(null, null, function* () {
|
|
2287
2274
|
return set({ submittedAnnotations: submit_annotation });
|
|
2288
2275
|
}),
|
|
2289
|
-
setAnnotatedRasterAsset: (annotated_raster) => __async(
|
|
2276
|
+
setAnnotatedRasterAsset: (annotated_raster) => __async(null, null, function* () {
|
|
2290
2277
|
return set({ annotatedRasterAsset: annotated_raster });
|
|
2291
2278
|
}),
|
|
2292
|
-
setTaskGeometry: (task_geometry) => __async(
|
|
2279
|
+
setTaskGeometry: (task_geometry) => __async(null, null, function* () {
|
|
2293
2280
|
return set({ taskGeometry: task_geometry });
|
|
2294
2281
|
}),
|
|
2295
2282
|
setTaskForReview(taskForReview) {
|
|
@@ -2407,8 +2394,7 @@ var TiffImage = (props) => {
|
|
|
2407
2394
|
} else if (localcomment !== void 0 && (localcomment == null ? void 0 : localcomment.includes("#" + x))) {
|
|
2408
2395
|
localcomment = localcomment.replace(" #" + x, "");
|
|
2409
2396
|
this.className = "rounded-xl flex inline-flex text-secondary p-1 text-sm";
|
|
2410
|
-
} else
|
|
2411
|
-
localcomment = "#" + x + " ";
|
|
2397
|
+
} else localcomment = "#" + x + " ";
|
|
2412
2398
|
if (evolandStore.comment !== void 0 && evolandStore.comment !== null && !((_a5 = evolandStore.comment) == null ? void 0 : _a5.includes("#" + x)))
|
|
2413
2399
|
evolandStore.setComment(
|
|
2414
2400
|
evolandStore.comment + localcomment
|
|
@@ -2417,8 +2403,7 @@ var TiffImage = (props) => {
|
|
|
2417
2403
|
evolandStore.setComment(
|
|
2418
2404
|
evolandStore.comment.replace(" #" + x, "")
|
|
2419
2405
|
);
|
|
2420
|
-
else
|
|
2421
|
-
evolandStore.setComment(localcomment);
|
|
2406
|
+
else evolandStore.setComment(localcomment);
|
|
2422
2407
|
});
|
|
2423
2408
|
container.appendChild(content);
|
|
2424
2409
|
}
|
|
@@ -2459,7 +2444,7 @@ var TiffImage = (props) => {
|
|
|
2459
2444
|
bubblingMouseEvents: false,
|
|
2460
2445
|
className: "border-2 border-blue-600"
|
|
2461
2446
|
}).bringToFront();
|
|
2462
|
-
imageOverlay3.on("mouseover", (e) => __async(
|
|
2447
|
+
imageOverlay3.on("mouseover", (e) => __async(null, null, function* () {
|
|
2463
2448
|
var _a3, _b2;
|
|
2464
2449
|
if (isBrush()) {
|
|
2465
2450
|
tooltip2 = L.tooltip({ offset: L.point(20, 0), opacity: 0.6 }).setContent(
|
|
@@ -2481,21 +2466,20 @@ var TiffImage = (props) => {
|
|
|
2481
2466
|
).setLatLng(e.latlng).addTo(map);
|
|
2482
2467
|
}
|
|
2483
2468
|
}));
|
|
2484
|
-
imageOverlay3.on("mousemove", (e) => __async(
|
|
2469
|
+
imageOverlay3.on("mousemove", (e) => __async(null, null, function* () {
|
|
2485
2470
|
evolandStore.setNDVIRGBValues(ndvi);
|
|
2486
2471
|
tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
|
|
2487
2472
|
if (isDrawing) {
|
|
2488
2473
|
handleMouseMove(e);
|
|
2489
2474
|
}
|
|
2490
2475
|
}));
|
|
2491
|
-
imageOverlay3.on("mouseout", () => __async(
|
|
2476
|
+
imageOverlay3.on("mouseout", () => __async(null, null, function* () {
|
|
2492
2477
|
tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
|
|
2493
2478
|
}));
|
|
2494
|
-
imageOverlay3.on("click", (e) => __async(
|
|
2479
|
+
imageOverlay3.on("click", (e) => __async(null, null, function* () {
|
|
2495
2480
|
var _a3, _b2, _c2;
|
|
2496
2481
|
tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
|
|
2497
|
-
if (((_a3 = evolandStore.selectedRasterAsset) == null ? void 0 : _a3.type) == "CHANGE_SEGMENTATION_MASK" /* ChangeSegmentationMask */)
|
|
2498
|
-
return;
|
|
2482
|
+
if (((_a3 = evolandStore.selectedRasterAsset) == null ? void 0 : _a3.type) == "CHANGE_SEGMENTATION_MASK" /* ChangeSegmentationMask */) return;
|
|
2499
2483
|
if (evolandStore.selectedColorLabel == null && evolandStore.selectedToolType !== 6 /* ClearSegmentWithPolygon */) {
|
|
2500
2484
|
alert("Please select label");
|
|
2501
2485
|
return;
|
|
@@ -2542,25 +2526,23 @@ var TiffImage = (props) => {
|
|
|
2542
2526
|
opacity: 0.8,
|
|
2543
2527
|
lineCap: "round"
|
|
2544
2528
|
}).addTo(map);
|
|
2545
|
-
polyLine.on("click", () => __async(
|
|
2529
|
+
polyLine.on("click", () => __async(null, null, function* () {
|
|
2546
2530
|
stopPaint();
|
|
2547
2531
|
}));
|
|
2548
|
-
polyLine.on("mouseover", (e) => __async(
|
|
2532
|
+
polyLine.on("mouseover", (e) => __async(null, null, function* () {
|
|
2549
2533
|
tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
|
|
2550
2534
|
tooltip2 = L.tooltip({ offset: L.point(20, 0), opacity: 0.6 }).setContent("Click to Stop").setLatLng(e.latlng).addTo(map);
|
|
2551
2535
|
}));
|
|
2552
|
-
polyLine.on("mousemove", () => __async(
|
|
2536
|
+
polyLine.on("mousemove", () => __async(null, null, function* () {
|
|
2553
2537
|
tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
|
|
2554
2538
|
}));
|
|
2555
|
-
polyLine.on("mouseout", () => __async(
|
|
2539
|
+
polyLine.on("mouseout", () => __async(null, null, function* () {
|
|
2556
2540
|
tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
|
|
2557
2541
|
}));
|
|
2558
2542
|
}
|
|
2559
2543
|
return () => {
|
|
2560
|
-
if (imageOverlay3)
|
|
2561
|
-
|
|
2562
|
-
if (tagsPopUp)
|
|
2563
|
-
map.removeLayer(tagsPopUp);
|
|
2544
|
+
if (imageOverlay3) map.removeLayer(imageOverlay3);
|
|
2545
|
+
if (tagsPopUp) map.removeLayer(tagsPopUp);
|
|
2564
2546
|
if (rectangle3 && evolandStore.isAnnualAnnotation)
|
|
2565
2547
|
map.removeLayer(rectangle3);
|
|
2566
2548
|
if (polyLine !== void 0) {
|
|
@@ -2653,7 +2635,7 @@ var ReadOnlyTiffImage = (props) => {
|
|
|
2653
2635
|
bubblingMouseEvents: false,
|
|
2654
2636
|
className: "border-2 border-blue-600"
|
|
2655
2637
|
}).bringToBack();
|
|
2656
|
-
imageOverlay3.on("mouseover", (e) => __async(
|
|
2638
|
+
imageOverlay3.on("mouseover", (e) => __async(null, null, function* () {
|
|
2657
2639
|
var data = yield getCanvasDataFromImageArray(
|
|
2658
2640
|
props.raster,
|
|
2659
2641
|
e.latlng,
|
|
@@ -2663,7 +2645,7 @@ var ReadOnlyTiffImage = (props) => {
|
|
|
2663
2645
|
);
|
|
2664
2646
|
setNDVI(data[1]);
|
|
2665
2647
|
}));
|
|
2666
|
-
imageOverlay3.on("mousemove", () => __async(
|
|
2648
|
+
imageOverlay3.on("mousemove", () => __async(null, null, function* () {
|
|
2667
2649
|
evolandStore.setNDVIRGBValues(ndvi);
|
|
2668
2650
|
}));
|
|
2669
2651
|
imageOverlay3.addTo(map);
|
|
@@ -2681,12 +2663,9 @@ var ReadOnlyTiffImage = (props) => {
|
|
|
2681
2663
|
}).addTo(map);
|
|
2682
2664
|
}
|
|
2683
2665
|
return () => {
|
|
2684
|
-
if (imageOverlay3)
|
|
2685
|
-
|
|
2686
|
-
if (
|
|
2687
|
-
map.removeLayer(rectangle3);
|
|
2688
|
-
if (props.polygonBounds)
|
|
2689
|
-
map.removeLayer(polygon_segment);
|
|
2666
|
+
if (imageOverlay3) map.removeLayer(imageOverlay3);
|
|
2667
|
+
if (rectangle3 && showRectangleAtCenter) map.removeLayer(rectangle3);
|
|
2668
|
+
if (props.polygonBounds) map.removeLayer(polygon_segment);
|
|
2690
2669
|
};
|
|
2691
2670
|
}, [props, map, showRectangleAtCenter]);
|
|
2692
2671
|
return null;
|
|
@@ -2929,8 +2908,7 @@ var import_ui = require("@geowiki/ui");
|
|
|
2929
2908
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2930
2909
|
var EvolandContainer = ({ sessionStatus }) => {
|
|
2931
2910
|
const evolandStore = useEvolandStore();
|
|
2932
|
-
if (sessionStatus === "unauthenticated")
|
|
2933
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui.AuthenticationFailure, {});
|
|
2911
|
+
if (sessionStatus === "unauthenticated") return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui.AuthenticationFailure, {});
|
|
2934
2912
|
return evolandStore.location && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EvoLandGeometry, {});
|
|
2935
2913
|
};
|
|
2936
2914
|
|
|
@@ -2958,7 +2936,7 @@ var SelectedPoint = () => {
|
|
|
2958
2936
|
};
|
|
2959
2937
|
|
|
2960
2938
|
// src/Components/LayerStoreList.tsx
|
|
2961
|
-
var
|
|
2939
|
+
var import_core7 = require("@geowiki/core");
|
|
2962
2940
|
|
|
2963
2941
|
// src/store/mapLayers.ts
|
|
2964
2942
|
var import_zustand3 = require("zustand");
|
|
@@ -3110,8 +3088,7 @@ var defaultStyles = {
|
|
|
3110
3088
|
};
|
|
3111
3089
|
var excludedProperties = /* @__PURE__ */ new Set(["bbox", "geometry", "type"]);
|
|
3112
3090
|
var formatValue = (value) => {
|
|
3113
|
-
if (value === null || value === void 0)
|
|
3114
|
-
return "";
|
|
3091
|
+
if (value === null || value === void 0) return "";
|
|
3115
3092
|
if (typeof value === "number") {
|
|
3116
3093
|
return value.toLocaleString();
|
|
3117
3094
|
}
|
|
@@ -3347,8 +3324,7 @@ var BetterWMS = class extends import_leaflet4.default.TileLayer.WMS {
|
|
|
3347
3324
|
* Builds the URL for the GetFeatureInfo WMS request
|
|
3348
3325
|
*/
|
|
3349
3326
|
getFeatureInfoUrl(latlng) {
|
|
3350
|
-
if (!this.currentMap)
|
|
3351
|
-
return null;
|
|
3327
|
+
if (!this.currentMap) return null;
|
|
3352
3328
|
const point3 = this.currentMap.latLngToContainerPoint(latlng);
|
|
3353
3329
|
const size = this.currentMap.getSize();
|
|
3354
3330
|
const wmsParams = this.wmsParams;
|
|
@@ -3417,8 +3393,7 @@ var BetterWMS = class extends import_leaflet4.default.TileLayer.WMS {
|
|
|
3417
3393
|
return;
|
|
3418
3394
|
}
|
|
3419
3395
|
this.geoJsonLayer.addData(content);
|
|
3420
|
-
if (!this.currentMap)
|
|
3421
|
-
return;
|
|
3396
|
+
if (!this.currentMap) return;
|
|
3422
3397
|
if (this.currentPopup) {
|
|
3423
3398
|
this.currentMap.closePopup(this.currentPopup);
|
|
3424
3399
|
}
|
|
@@ -3435,8 +3410,7 @@ var BetterWMS = class extends import_leaflet4.default.TileLayer.WMS {
|
|
|
3435
3410
|
* Show loading popup
|
|
3436
3411
|
*/
|
|
3437
3412
|
showLoading(latlng) {
|
|
3438
|
-
if (!this.currentMap || this.loading || !this.canShowLoading)
|
|
3439
|
-
return;
|
|
3413
|
+
if (!this.currentMap || this.loading || !this.canShowLoading) return;
|
|
3440
3414
|
this.loading = true;
|
|
3441
3415
|
this.currentPopup = import_leaflet4.default.popup(this.popupOptions).setLatLng(latlng).setContent(this.loadingContent).openOn(this.currentMap);
|
|
3442
3416
|
}
|
|
@@ -3447,8 +3421,7 @@ var BetterWMS = class extends import_leaflet4.default.TileLayer.WMS {
|
|
|
3447
3421
|
return __async(this, null, function* () {
|
|
3448
3422
|
var _a, _b, _c;
|
|
3449
3423
|
const url = this.getFeatureInfoUrl(event.latlng);
|
|
3450
|
-
if (!url)
|
|
3451
|
-
return;
|
|
3424
|
+
if (!url) return;
|
|
3452
3425
|
try {
|
|
3453
3426
|
this.showLoading(event.latlng);
|
|
3454
3427
|
const data = yield this.fetchWithRetry(url);
|
|
@@ -3629,8 +3602,7 @@ var import_ui3 = require("@geowiki/ui");
|
|
|
3629
3602
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3630
3603
|
var FarmerClusterPopup = ({ properties }) => {
|
|
3631
3604
|
const fileUrl = (0, import_core5.useFileUrl)();
|
|
3632
|
-
if (!properties)
|
|
3633
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "No properties found" });
|
|
3605
|
+
if (!properties) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "No properties found" });
|
|
3634
3606
|
const name = properties["name"];
|
|
3635
3607
|
const description = properties["description"];
|
|
3636
3608
|
const url = "/cluster/view/" + properties["id"];
|
|
@@ -3681,13 +3653,12 @@ var BiodiversityObservationPopup = ({
|
|
|
3681
3653
|
|
|
3682
3654
|
// src/Components/Ifbn/IfbnSitePopup.tsx
|
|
3683
3655
|
var import_react6 = require("react");
|
|
3684
|
-
var
|
|
3656
|
+
var import_core6 = require("@geowiki/core");
|
|
3685
3657
|
var import_ui5 = require("@geowiki/ui");
|
|
3686
3658
|
var import_image2 = __toESM(require("next/image"));
|
|
3687
3659
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3688
3660
|
var SiteInformation = ({ data }) => {
|
|
3689
|
-
if (!data)
|
|
3690
|
-
return null;
|
|
3661
|
+
if (!data) return null;
|
|
3691
3662
|
const baseDocUrl = "https://raw.githubusercontent.com/iiasa/static/refs/heads/main/geotrees/docs/biomass_processing_protocol/";
|
|
3692
3663
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-6", children: [
|
|
3693
3664
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-4", children: [
|
|
@@ -3861,9 +3832,8 @@ var IfbnSitePopup = ({ properties }) => {
|
|
|
3861
3832
|
const [siteData, setSiteData] = (0, import_react6.useState)(null);
|
|
3862
3833
|
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
|
3863
3834
|
const [imageError, setImageError] = (0, import_react6.useState)(false);
|
|
3864
|
-
const { status: sessionStatus, data: session } = (0,
|
|
3865
|
-
if (!properties)
|
|
3866
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: "No properties found" });
|
|
3835
|
+
const { status: sessionStatus, data: session } = (0, import_core6.useSession)();
|
|
3836
|
+
if (!properties) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: "No properties found" });
|
|
3867
3837
|
const plotId = properties["Plot_ID"];
|
|
3868
3838
|
const subPlotId = properties["SubPlot_Id"];
|
|
3869
3839
|
const network = properties["Network"];
|
|
@@ -3872,7 +3842,7 @@ var IfbnSitePopup = ({ properties }) => {
|
|
|
3872
3842
|
const fallbackUrl = "https://cms.main.geo-wiki.org/geotrees/media/cocoa.png";
|
|
3873
3843
|
const baseImageUrl = "https://raw.githubusercontent.com/iiasa/static/refs/heads/main/geotrees/sites/";
|
|
3874
3844
|
const imageUrl = `${baseImageUrl}${plotId}.jpg?raw=true`;
|
|
3875
|
-
const fetchSiteData = () => __async(
|
|
3845
|
+
const fetchSiteData = () => __async(null, null, function* () {
|
|
3876
3846
|
setIsLoading(true);
|
|
3877
3847
|
try {
|
|
3878
3848
|
const response = yield fetch(
|
|
@@ -3883,8 +3853,7 @@ var IfbnSitePopup = ({ properties }) => {
|
|
|
3883
3853
|
}
|
|
3884
3854
|
}
|
|
3885
3855
|
);
|
|
3886
|
-
if (!response.ok)
|
|
3887
|
-
throw new Error("Failed to fetch data");
|
|
3856
|
+
if (!response.ok) throw new Error("Failed to fetch data");
|
|
3888
3857
|
const data = yield response.json();
|
|
3889
3858
|
setSiteData(data);
|
|
3890
3859
|
} catch (error) {
|
|
@@ -3949,25 +3918,23 @@ var IfbnSitePopup = ({ properties }) => {
|
|
|
3949
3918
|
};
|
|
3950
3919
|
|
|
3951
3920
|
// src/Components/Ifbn/IfbnPlotPopup.tsx
|
|
3952
|
-
var
|
|
3921
|
+
var import_react7 = require("react");
|
|
3953
3922
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3954
3923
|
var IfbnPlotPopup = ({ properties }) => {
|
|
3955
3924
|
console.log(properties);
|
|
3956
|
-
const [apiData, setApiData] = (0,
|
|
3957
|
-
const [isLoading, setIsLoading] = (0,
|
|
3958
|
-
const [error, setError] = (0,
|
|
3925
|
+
const [apiData, setApiData] = (0, import_react7.useState)(null);
|
|
3926
|
+
const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
|
|
3927
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
3959
3928
|
const API_URL = process.env.NEXT_PUBLIC_GEO_TREE_API_URL;
|
|
3960
|
-
(0,
|
|
3961
|
-
const fetchApiData = () => __async(
|
|
3962
|
-
if (!(properties == null ? void 0 : properties.id))
|
|
3963
|
-
return;
|
|
3929
|
+
(0, import_react7.useEffect)(() => {
|
|
3930
|
+
const fetchApiData = () => __async(null, null, function* () {
|
|
3931
|
+
if (!(properties == null ? void 0 : properties.id)) return;
|
|
3964
3932
|
setIsLoading(true);
|
|
3965
3933
|
try {
|
|
3966
3934
|
const response = yield fetch(
|
|
3967
3935
|
`${API_URL}/api/plots/by-plot-id/${properties.plot_id}`
|
|
3968
3936
|
);
|
|
3969
|
-
if (!response.ok)
|
|
3970
|
-
throw new Error("Failed to fetch data");
|
|
3937
|
+
if (!response.ok) throw new Error("Failed to fetch data");
|
|
3971
3938
|
const data = yield response.json();
|
|
3972
3939
|
console.log("API Response:", data);
|
|
3973
3940
|
setApiData(data);
|
|
@@ -4110,7 +4077,7 @@ var GeoJsonLayerPopup_default = GeoJsonLayerPopup;
|
|
|
4110
4077
|
// src/Components/GeoJsonLayer.tsx
|
|
4111
4078
|
var import_server2 = require("react-dom/server");
|
|
4112
4079
|
var import_MapPinIcon = __toESM(require("@heroicons/react/24/solid/MapPinIcon"));
|
|
4113
|
-
var
|
|
4080
|
+
var import_react8 = require("react");
|
|
4114
4081
|
var turf2 = __toESM(require("@turf/turf"));
|
|
4115
4082
|
var import_ui7 = require("@geowiki/ui");
|
|
4116
4083
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
@@ -4141,12 +4108,9 @@ var createClusterIcon = (color) => {
|
|
|
4141
4108
|
markers.forEach((marker2) => {
|
|
4142
4109
|
var _a, _b, _c;
|
|
4143
4110
|
const status = ((_c = (_b = (_a = marker2.feature) == null ? void 0 : _a.properties) == null ? void 0 : _b.Status) == null ? void 0 : _c.trim().toLowerCase()) || "default";
|
|
4144
|
-
if (status === "ongoing")
|
|
4145
|
-
|
|
4146
|
-
else
|
|
4147
|
-
statusCount.auxiliary++;
|
|
4148
|
-
else
|
|
4149
|
-
statusCount.default++;
|
|
4111
|
+
if (status === "ongoing") statusCount.ongoing++;
|
|
4112
|
+
else if (status === "auxiliary") statusCount.auxiliary++;
|
|
4113
|
+
else statusCount.default++;
|
|
4150
4114
|
});
|
|
4151
4115
|
return import_leaflet6.default.divIcon({
|
|
4152
4116
|
html: `<div style=
|
|
@@ -4168,29 +4132,29 @@ var createClusterIcon = (color) => {
|
|
|
4168
4132
|
});
|
|
4169
4133
|
};
|
|
4170
4134
|
};
|
|
4171
|
-
var GeoJsonLayer = (0,
|
|
4135
|
+
var GeoJsonLayer = (0, import_react8.memo)(
|
|
4172
4136
|
({ layer }) => {
|
|
4173
4137
|
const { isLoading, error, data } = (0, import_react_query.useQuery)({
|
|
4174
4138
|
queryKey: ["geoJson", layer.id],
|
|
4175
|
-
queryFn: () => __async(
|
|
4139
|
+
queryFn: () => __async(null, null, function* () {
|
|
4176
4140
|
const res = yield fetch(layer.url);
|
|
4177
4141
|
return yield res.json();
|
|
4178
4142
|
})
|
|
4179
4143
|
});
|
|
4180
|
-
const ref = (0,
|
|
4181
|
-
const [forceUpdate, setForceUpdate] = (0,
|
|
4182
|
-
(0,
|
|
4144
|
+
const ref = (0, import_react8.useRef)(null);
|
|
4145
|
+
const [forceUpdate, setForceUpdate] = (0, import_react8.useState)(0);
|
|
4146
|
+
(0, import_react8.useEffect)(() => {
|
|
4183
4147
|
setForceUpdate((prev) => prev + 1);
|
|
4184
4148
|
}, [layer.id]);
|
|
4185
|
-
const layerIcon = (0,
|
|
4149
|
+
const layerIcon = (0, import_react8.useMemo)(
|
|
4186
4150
|
() => createIcon(layer.color, layer.title),
|
|
4187
4151
|
[layer.color, layer.title]
|
|
4188
4152
|
);
|
|
4189
|
-
const clusterIconFunction = (0,
|
|
4153
|
+
const clusterIconFunction = (0, import_react8.useMemo)(
|
|
4190
4154
|
() => createClusterIcon(layer.color),
|
|
4191
4155
|
[layer.color]
|
|
4192
4156
|
);
|
|
4193
|
-
const onEachFeature = (0,
|
|
4157
|
+
const onEachFeature = (0, import_react8.useCallback)(
|
|
4194
4158
|
(feature, layerInfo, layerItem) => {
|
|
4195
4159
|
const popupContent = ReactDOMServer.renderToString(
|
|
4196
4160
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GeoJsonLayerPopup_default, { feature, layerItem })
|
|
@@ -4221,9 +4185,8 @@ var GeoJsonLayer = (0, import_react9.memo)(
|
|
|
4221
4185
|
},
|
|
4222
4186
|
[layerIcon]
|
|
4223
4187
|
);
|
|
4224
|
-
const processedData = (0,
|
|
4225
|
-
if (!(data == null ? void 0 : data.features))
|
|
4226
|
-
return data;
|
|
4188
|
+
const processedData = (0, import_react8.useMemo)(() => {
|
|
4189
|
+
if (!(data == null ? void 0 : data.features)) return data;
|
|
4227
4190
|
const processed = __spreadValues({}, data);
|
|
4228
4191
|
processed.features = data.features.map((feature) => {
|
|
4229
4192
|
var _a;
|
|
@@ -4239,7 +4202,7 @@ var GeoJsonLayer = (0, import_react9.memo)(
|
|
|
4239
4202
|
});
|
|
4240
4203
|
return processed;
|
|
4241
4204
|
}, [data]);
|
|
4242
|
-
const eventHandlers = (0,
|
|
4205
|
+
const eventHandlers = (0, import_react8.useMemo)(
|
|
4243
4206
|
() => ({
|
|
4244
4207
|
add: (e) => {
|
|
4245
4208
|
if (e.target._container) {
|
|
@@ -4249,10 +4212,8 @@ var GeoJsonLayer = (0, import_react9.memo)(
|
|
|
4249
4212
|
}),
|
|
4250
4213
|
[layer.id]
|
|
4251
4214
|
);
|
|
4252
|
-
if (error)
|
|
4253
|
-
|
|
4254
|
-
if (isLoading)
|
|
4255
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ui6.LoaderFull, {});
|
|
4215
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: "error" });
|
|
4216
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ui6.LoaderFull, {});
|
|
4256
4217
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4257
4218
|
MarkerClusterGroup2,
|
|
4258
4219
|
{
|
|
@@ -4275,12 +4236,12 @@ var GeoJsonLayer = (0, import_react9.memo)(
|
|
|
4275
4236
|
GeoJsonLayer.displayName = "GeoJsonLayer";
|
|
4276
4237
|
|
|
4277
4238
|
// src/Components/LayerStoreList.tsx
|
|
4278
|
-
var
|
|
4239
|
+
var import_react12 = require("react");
|
|
4279
4240
|
|
|
4280
4241
|
// src/Components/Ifbn/IfbnPlotLayer.tsx
|
|
4281
4242
|
var import_ui8 = require("@geowiki/ui");
|
|
4282
4243
|
var import_react_query2 = require("@tanstack/react-query");
|
|
4283
|
-
var
|
|
4244
|
+
var import_react9 = require("react");
|
|
4284
4245
|
var import_react_leaflet7 = require("react-leaflet");
|
|
4285
4246
|
var turf3 = __toESM(require("@turf/turf"));
|
|
4286
4247
|
var import_leaflet7 = __toESM(require("leaflet"));
|
|
@@ -4325,12 +4286,9 @@ var createClusterIcon2 = (cluster) => {
|
|
|
4325
4286
|
markers.forEach((marker2) => {
|
|
4326
4287
|
var _a, _b, _c;
|
|
4327
4288
|
const status = ((_c = (_b = (_a = marker2.feature) == null ? void 0 : _a.properties) == null ? void 0 : _b.Status) == null ? void 0 : _c.trim().toLowerCase()) || "default";
|
|
4328
|
-
if (status === "ongoing")
|
|
4329
|
-
|
|
4330
|
-
else
|
|
4331
|
-
statusCount.auxiliary++;
|
|
4332
|
-
else
|
|
4333
|
-
statusCount.default++;
|
|
4289
|
+
if (status === "ongoing") statusCount.ongoing++;
|
|
4290
|
+
else if (status === "auxiliary") statusCount.auxiliary++;
|
|
4291
|
+
else statusCount.default++;
|
|
4334
4292
|
});
|
|
4335
4293
|
let clusterColor = "#2E7D32";
|
|
4336
4294
|
if (statusCount.ongoing > statusCount.auxiliary && statusCount.ongoing > statusCount.default) {
|
|
@@ -4361,12 +4319,12 @@ var IfbnPlotLayer = ({
|
|
|
4361
4319
|
options = {}
|
|
4362
4320
|
}) => {
|
|
4363
4321
|
const { hideMarkersAboveZoom = 15 } = options;
|
|
4364
|
-
const [selectedFeature, setSelectedFeature] = (0,
|
|
4365
|
-
const [currentZoom, setCurrentZoom] = (0,
|
|
4366
|
-
const [forceUpdate, setForceUpdate] = (0,
|
|
4367
|
-
const markerClusterGroupRef = (0,
|
|
4368
|
-
const markersRef = (0,
|
|
4369
|
-
(0,
|
|
4322
|
+
const [selectedFeature, setSelectedFeature] = (0, import_react9.useState)(null);
|
|
4323
|
+
const [currentZoom, setCurrentZoom] = (0, import_react9.useState)(0);
|
|
4324
|
+
const [forceUpdate, setForceUpdate] = (0, import_react9.useState)(0);
|
|
4325
|
+
const markerClusterGroupRef = (0, import_react9.useRef)(null);
|
|
4326
|
+
const markersRef = (0, import_react9.useRef)([]);
|
|
4327
|
+
(0, import_react9.useEffect)(() => {
|
|
4370
4328
|
setForceUpdate((prev) => prev + 1);
|
|
4371
4329
|
}, [layer.id]);
|
|
4372
4330
|
const map = (0, import_react_leaflet7.useMapEvents)({
|
|
@@ -4379,7 +4337,7 @@ var IfbnPlotLayer = ({
|
|
|
4379
4337
|
});
|
|
4380
4338
|
const { isLoading, error, data } = (0, import_react_query2.useQuery)({
|
|
4381
4339
|
queryKey: ["IfbnPlotLayer", layer.id],
|
|
4382
|
-
queryFn: () => __async(
|
|
4340
|
+
queryFn: () => __async(null, null, function* () {
|
|
4383
4341
|
const res = yield fetch(`${layer.url}`);
|
|
4384
4342
|
return yield res.json();
|
|
4385
4343
|
})
|
|
@@ -4387,9 +4345,8 @@ var IfbnPlotLayer = ({
|
|
|
4387
4345
|
const shouldShowMarkers = () => {
|
|
4388
4346
|
return currentZoom <= hideMarkersAboveZoom;
|
|
4389
4347
|
};
|
|
4390
|
-
(0,
|
|
4391
|
-
if (!markerClusterGroupRef.current)
|
|
4392
|
-
return;
|
|
4348
|
+
(0, import_react9.useEffect)(() => {
|
|
4349
|
+
if (!markerClusterGroupRef.current) return;
|
|
4393
4350
|
if (shouldShowMarkers()) {
|
|
4394
4351
|
markersRef.current.forEach((marker2) => {
|
|
4395
4352
|
var _a, _b;
|
|
@@ -4412,7 +4369,7 @@ var IfbnPlotLayer = ({
|
|
|
4412
4369
|
}
|
|
4413
4370
|
return zoom >= 16 ? 0 : 80;
|
|
4414
4371
|
};
|
|
4415
|
-
(0,
|
|
4372
|
+
(0, import_react9.useEffect)(() => {
|
|
4416
4373
|
markerClusterGroupRef.current = import_leaflet7.default.markerClusterGroup({
|
|
4417
4374
|
maxClusterRadius: (zoom) => getClusterRadius(zoom),
|
|
4418
4375
|
disableClusteringAtZoom: 16,
|
|
@@ -4424,7 +4381,7 @@ var IfbnPlotLayer = ({
|
|
|
4424
4381
|
markerClusterGroupRef.current = null;
|
|
4425
4382
|
};
|
|
4426
4383
|
}, [hideMarkersAboveZoom]);
|
|
4427
|
-
(0,
|
|
4384
|
+
(0, import_react9.useEffect)(() => {
|
|
4428
4385
|
const currentRef = ref.current;
|
|
4429
4386
|
if (currentRef && markerClusterGroupRef.current) {
|
|
4430
4387
|
currentRef.addLayer(markerClusterGroupRef.current);
|
|
@@ -4476,11 +4433,9 @@ var IfbnPlotLayer = ({
|
|
|
4476
4433
|
const handleFeatureClick = (feature, latlng) => {
|
|
4477
4434
|
setSelectedFeature({ feature, latlng });
|
|
4478
4435
|
};
|
|
4479
|
-
const ref = (0,
|
|
4480
|
-
if (error)
|
|
4481
|
-
|
|
4482
|
-
if (isLoading)
|
|
4483
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui8.LoaderFull, {});
|
|
4436
|
+
const ref = (0, import_react9.useRef)(null);
|
|
4437
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: "error" });
|
|
4438
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui8.LoaderFull, {});
|
|
4484
4439
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4485
4440
|
MarkerClusterGroup2,
|
|
4486
4441
|
{
|
|
@@ -4529,7 +4484,7 @@ var IfbnPlotLayer = ({
|
|
|
4529
4484
|
};
|
|
4530
4485
|
|
|
4531
4486
|
// src/Components/CustomLayerRenderer.tsx
|
|
4532
|
-
var
|
|
4487
|
+
var import_react11 = require("react");
|
|
4533
4488
|
var import_react_leaflet9 = require("react-leaflet");
|
|
4534
4489
|
|
|
4535
4490
|
// src/store/customLayers.ts
|
|
@@ -4734,8 +4689,7 @@ var useCustomLayerStore = (0, import_zustand4.create)()((set, get) => ({
|
|
|
4734
4689
|
createLayerFromTemplate: (templateId, customData) => {
|
|
4735
4690
|
var _a, _b;
|
|
4736
4691
|
const template = get().getTemplate(templateId);
|
|
4737
|
-
if (!template)
|
|
4738
|
-
return null;
|
|
4692
|
+
if (!template) return null;
|
|
4739
4693
|
const newLayer = {
|
|
4740
4694
|
id: (0, import_uuid.v4)(),
|
|
4741
4695
|
isCustom: true,
|
|
@@ -4841,7 +4795,7 @@ var import_react_leaflet8 = require("react-leaflet");
|
|
|
4841
4795
|
var import_leaflet8 = __toESM(require("leaflet"));
|
|
4842
4796
|
var ReactDOMServer2 = __toESM(require("react-dom/server"));
|
|
4843
4797
|
var import_ui9 = require("@geowiki/ui");
|
|
4844
|
-
var
|
|
4798
|
+
var import_react10 = require("react");
|
|
4845
4799
|
var turf4 = __toESM(require("@turf/turf"));
|
|
4846
4800
|
|
|
4847
4801
|
// src/utils/GoogleSheetsUtils.ts
|
|
@@ -5106,16 +5060,11 @@ function getColumnStats(data, columnName) {
|
|
|
5106
5060
|
let type;
|
|
5107
5061
|
if (uniqueTypes.size === 1) {
|
|
5108
5062
|
const singleType = types[0];
|
|
5109
|
-
if (singleType === "string")
|
|
5110
|
-
|
|
5111
|
-
else if (singleType === "
|
|
5112
|
-
|
|
5113
|
-
else
|
|
5114
|
-
type = "boolean";
|
|
5115
|
-
else if (singleType === "object")
|
|
5116
|
-
type = "date";
|
|
5117
|
-
else
|
|
5118
|
-
type = "mixed";
|
|
5063
|
+
if (singleType === "string") type = "string";
|
|
5064
|
+
else if (singleType === "number") type = "number";
|
|
5065
|
+
else if (singleType === "boolean") type = "boolean";
|
|
5066
|
+
else if (singleType === "object") type = "date";
|
|
5067
|
+
else type = "mixed";
|
|
5119
5068
|
} else {
|
|
5120
5069
|
type = "mixed";
|
|
5121
5070
|
}
|
|
@@ -5128,21 +5077,15 @@ var GoogleSheetsPopup = ({
|
|
|
5128
5077
|
properties
|
|
5129
5078
|
}) => {
|
|
5130
5079
|
const isEmpty = (value) => {
|
|
5131
|
-
if (value === null || value === void 0)
|
|
5132
|
-
|
|
5133
|
-
if (typeof value === "
|
|
5134
|
-
|
|
5135
|
-
if (typeof value === "
|
|
5136
|
-
return isNaN(value);
|
|
5137
|
-
if (Array.isArray(value))
|
|
5138
|
-
return value.length === 0;
|
|
5139
|
-
if (typeof value === "object")
|
|
5140
|
-
return Object.keys(value).length === 0;
|
|
5080
|
+
if (value === null || value === void 0) return true;
|
|
5081
|
+
if (typeof value === "string") return value.trim() === "";
|
|
5082
|
+
if (typeof value === "number") return isNaN(value);
|
|
5083
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
5084
|
+
if (typeof value === "object") return Object.keys(value).length === 0;
|
|
5141
5085
|
return false;
|
|
5142
5086
|
};
|
|
5143
5087
|
const isUrl = (value) => {
|
|
5144
|
-
if (typeof value !== "string")
|
|
5145
|
-
return false;
|
|
5088
|
+
if (typeof value !== "string") return false;
|
|
5146
5089
|
const trimmedValue = value.trim();
|
|
5147
5090
|
const urlPatterns = [
|
|
5148
5091
|
/^https?:\/\//i,
|
|
@@ -5612,8 +5555,7 @@ function analyzeColumn(rows, columnName) {
|
|
|
5612
5555
|
};
|
|
5613
5556
|
}
|
|
5614
5557
|
function getLegendColumns(rows, excludeCoordinateColumns = []) {
|
|
5615
|
-
if (rows.length === 0)
|
|
5616
|
-
return [];
|
|
5558
|
+
if (rows.length === 0) return [];
|
|
5617
5559
|
const headers = Object.keys(rows[0]);
|
|
5618
5560
|
const legendColumns = [];
|
|
5619
5561
|
for (const header of headers) {
|
|
@@ -5750,7 +5692,7 @@ function useGenericCache({
|
|
|
5750
5692
|
const isCached = cache.has(cacheKey);
|
|
5751
5693
|
const queryOptions = {
|
|
5752
5694
|
queryKey: [cacheKey.type, cacheKey.id, cacheKey.subId, cacheKey.version],
|
|
5753
|
-
queryFn: () => __async(
|
|
5695
|
+
queryFn: () => __async(null, null, function* () {
|
|
5754
5696
|
const cachedData = cache.get(cacheKey);
|
|
5755
5697
|
if (cachedData) {
|
|
5756
5698
|
console.log(
|
|
@@ -5819,7 +5761,7 @@ function useGoogleSheetsData({
|
|
|
5819
5761
|
subId: sheetConfig.sheetId,
|
|
5820
5762
|
version: "1.0.0"
|
|
5821
5763
|
} : null;
|
|
5822
|
-
const fetchData = () => __async(
|
|
5764
|
+
const fetchData = () => __async(null, null, function* () {
|
|
5823
5765
|
if (!sheetConfig) {
|
|
5824
5766
|
throw new Error("Invalid Google Sheets configuration");
|
|
5825
5767
|
}
|
|
@@ -5994,12 +5936,12 @@ var GoogleSheetsLayer = ({
|
|
|
5994
5936
|
layer
|
|
5995
5937
|
}) => {
|
|
5996
5938
|
var _a;
|
|
5997
|
-
const ref = (0,
|
|
5939
|
+
const ref = (0, import_react10.useRef)(null);
|
|
5998
5940
|
const markerClusterGroup = import_leaflet8.default.markerClusterGroup();
|
|
5999
5941
|
const { updateLayer } = mapLayers_default();
|
|
6000
|
-
const legendConfigUpdated = (0,
|
|
6001
|
-
const [forceUpdate, setForceUpdate] = (0,
|
|
6002
|
-
const sheetConfig = (0,
|
|
5942
|
+
const legendConfigUpdated = (0, import_react10.useRef)(false);
|
|
5943
|
+
const [forceUpdate, setForceUpdate] = (0, import_react10.useState)(0);
|
|
5944
|
+
const sheetConfig = (0, import_react10.useMemo)(() => {
|
|
6003
5945
|
if (!layer.url) {
|
|
6004
5946
|
return null;
|
|
6005
5947
|
}
|
|
@@ -6036,11 +5978,11 @@ var GoogleSheetsLayer = ({
|
|
|
6036
5978
|
refetchOnMount: true,
|
|
6037
5979
|
refetchOnReconnect: true
|
|
6038
5980
|
});
|
|
6039
|
-
(0,
|
|
5981
|
+
(0, import_react10.useEffect)(() => {
|
|
6040
5982
|
if (data && !isLoading) {
|
|
6041
5983
|
}
|
|
6042
5984
|
}, [data, isLoading, isCached, layer.id, cacheStats]);
|
|
6043
|
-
(0,
|
|
5985
|
+
(0, import_react10.useEffect)(() => {
|
|
6044
5986
|
const currentRef = ref.current;
|
|
6045
5987
|
if (currentRef) {
|
|
6046
5988
|
currentRef.addLayer(markerClusterGroup);
|
|
@@ -6085,10 +6027,9 @@ var GoogleSheetsLayer = ({
|
|
|
6085
6027
|
markerClusterGroup.addLayer(marker2);
|
|
6086
6028
|
}
|
|
6087
6029
|
};
|
|
6088
|
-
const processedData = (0,
|
|
6030
|
+
const processedData = (0, import_react10.useMemo)(() => {
|
|
6089
6031
|
var _a2;
|
|
6090
|
-
if (!data)
|
|
6091
|
-
return null;
|
|
6032
|
+
if (!data) return null;
|
|
6092
6033
|
return __spreadProps(__spreadValues({}, data), {
|
|
6093
6034
|
features: (_a2 = data.features) == null ? void 0 : _a2.map((feature) => {
|
|
6094
6035
|
var _a3;
|
|
@@ -6105,7 +6046,7 @@ var GoogleSheetsLayer = ({
|
|
|
6105
6046
|
})
|
|
6106
6047
|
});
|
|
6107
6048
|
}, [data]);
|
|
6108
|
-
const legendConfig = (0,
|
|
6049
|
+
const legendConfig = (0, import_react10.useMemo)(() => {
|
|
6109
6050
|
if (!processedData || !processedData.features || processedData.features.length === 0) {
|
|
6110
6051
|
console.log(
|
|
6111
6052
|
"GoogleSheetsLayer: No processed data available for legend generation"
|
|
@@ -6177,7 +6118,7 @@ var GoogleSheetsLayer = ({
|
|
|
6177
6118
|
}
|
|
6178
6119
|
return null;
|
|
6179
6120
|
}, [processedData, layer.title, layer.id]);
|
|
6180
|
-
const updateLayerWithLegend = (0,
|
|
6121
|
+
const updateLayerWithLegend = (0, import_react10.useCallback)(() => {
|
|
6181
6122
|
if (legendConfig && layer.id && !legendConfigUpdated.current) {
|
|
6182
6123
|
if (JSON.stringify(layer.legendConfig) !== JSON.stringify(legendConfig)) {
|
|
6183
6124
|
console.log("GoogleSheetsLayer: Updating layer with legend config");
|
|
@@ -6199,10 +6140,10 @@ var GoogleSheetsLayer = ({
|
|
|
6199
6140
|
});
|
|
6200
6141
|
}
|
|
6201
6142
|
}, [legendConfig, layer, updateLayer]);
|
|
6202
|
-
(0,
|
|
6143
|
+
(0, import_react10.useEffect)(() => {
|
|
6203
6144
|
updateLayerWithLegend();
|
|
6204
6145
|
}, [updateLayerWithLegend]);
|
|
6205
|
-
(0,
|
|
6146
|
+
(0, import_react10.useEffect)(() => {
|
|
6206
6147
|
legendConfigUpdated.current = false;
|
|
6207
6148
|
}, [processedData]);
|
|
6208
6149
|
if (error) {
|
|
@@ -6361,10 +6302,10 @@ var createPopupContent = (feature, layer) => {
|
|
|
6361
6302
|
}
|
|
6362
6303
|
return null;
|
|
6363
6304
|
};
|
|
6364
|
-
var GeoJSONRenderer = (0,
|
|
6305
|
+
var GeoJSONRenderer = (0, import_react11.memo)(
|
|
6365
6306
|
({ layer }) => {
|
|
6366
6307
|
const { layerData, styleConfig, opacity } = layer;
|
|
6367
|
-
const style = (0,
|
|
6308
|
+
const style = (0, import_react11.useMemo)(
|
|
6368
6309
|
() => ({
|
|
6369
6310
|
fillColor: (styleConfig == null ? void 0 : styleConfig.fillColor) || "#3388ff",
|
|
6370
6311
|
weight: (styleConfig == null ? void 0 : styleConfig.strokeWidth) || 2,
|
|
@@ -6374,7 +6315,7 @@ var GeoJSONRenderer = (0, import_react12.memo)(
|
|
|
6374
6315
|
}),
|
|
6375
6316
|
[styleConfig, opacity]
|
|
6376
6317
|
);
|
|
6377
|
-
const onEachFeature = (0,
|
|
6318
|
+
const onEachFeature = (0, import_react11.useCallback)((feature, leafletLayer) => {
|
|
6378
6319
|
if (feature.properties) {
|
|
6379
6320
|
const popupContent = Object.entries(feature.properties).map(([key, value]) => `<strong>${key}:</strong> ${value}`).join("<br/>");
|
|
6380
6321
|
leafletLayer.bindPopup(popupContent);
|
|
@@ -6396,11 +6337,11 @@ var GeoJSONRenderer = (0, import_react12.memo)(
|
|
|
6396
6337
|
}
|
|
6397
6338
|
);
|
|
6398
6339
|
GeoJSONRenderer.displayName = "GeoJSONRenderer";
|
|
6399
|
-
var MarkerRenderer = (0,
|
|
6340
|
+
var MarkerRenderer = (0, import_react11.memo)(
|
|
6400
6341
|
({ layer }) => {
|
|
6401
6342
|
var _a;
|
|
6402
6343
|
const { layerData, opacity } = layer;
|
|
6403
|
-
const pointFeatures = (0,
|
|
6344
|
+
const pointFeatures = (0, import_react11.useMemo)(
|
|
6404
6345
|
() => {
|
|
6405
6346
|
var _a2;
|
|
6406
6347
|
return ((_a2 = layerData == null ? void 0 : layerData.features) == null ? void 0 : _a2.filter(
|
|
@@ -6409,7 +6350,7 @@ var MarkerRenderer = (0, import_react12.memo)(
|
|
|
6409
6350
|
},
|
|
6410
6351
|
[layerData == null ? void 0 : layerData.features]
|
|
6411
6352
|
);
|
|
6412
|
-
const popupOptions = (0,
|
|
6353
|
+
const popupOptions = (0, import_react11.useMemo)(
|
|
6413
6354
|
() => {
|
|
6414
6355
|
var _a2;
|
|
6415
6356
|
return ((_a2 = layer.popupConfig) == null ? void 0 : _a2.popupOptions) || {
|
|
@@ -6459,15 +6400,15 @@ var MarkerRenderer = (0, import_react12.memo)(
|
|
|
6459
6400
|
}
|
|
6460
6401
|
);
|
|
6461
6402
|
MarkerRenderer.displayName = "MarkerRenderer";
|
|
6462
|
-
var MarkerClusterRenderer = (0,
|
|
6403
|
+
var MarkerClusterRenderer = (0, import_react11.memo)(
|
|
6463
6404
|
({ layer }) => {
|
|
6464
6405
|
var _a;
|
|
6465
6406
|
const { layerData, opacity } = layer;
|
|
6466
|
-
const [forceUpdate, setForceUpdate] = (0,
|
|
6467
|
-
(0,
|
|
6407
|
+
const [forceUpdate, setForceUpdate] = (0, import_react11.useState)(0);
|
|
6408
|
+
(0, import_react11.useEffect)(() => {
|
|
6468
6409
|
setForceUpdate((prev) => prev + 1);
|
|
6469
6410
|
}, [layer.id]);
|
|
6470
|
-
const pointFeatures = (0,
|
|
6411
|
+
const pointFeatures = (0, import_react11.useMemo)(
|
|
6471
6412
|
() => {
|
|
6472
6413
|
var _a2;
|
|
6473
6414
|
return ((_a2 = layerData == null ? void 0 : layerData.features) == null ? void 0 : _a2.filter(
|
|
@@ -6476,7 +6417,7 @@ var MarkerClusterRenderer = (0, import_react12.memo)(
|
|
|
6476
6417
|
},
|
|
6477
6418
|
[layerData == null ? void 0 : layerData.features]
|
|
6478
6419
|
);
|
|
6479
|
-
const popupOptions = (0,
|
|
6420
|
+
const popupOptions = (0, import_react11.useMemo)(
|
|
6480
6421
|
() => {
|
|
6481
6422
|
var _a2;
|
|
6482
6423
|
return ((_a2 = layer.popupConfig) == null ? void 0 : _a2.popupOptions) || {
|
|
@@ -6541,7 +6482,7 @@ var MarkerClusterRenderer = (0, import_react12.memo)(
|
|
|
6541
6482
|
}
|
|
6542
6483
|
);
|
|
6543
6484
|
MarkerClusterRenderer.displayName = "MarkerClusterRenderer";
|
|
6544
|
-
var WMSRenderer = (0,
|
|
6485
|
+
var WMSRenderer = (0, import_react11.memo)(({ layer }) => {
|
|
6545
6486
|
const { url, layerName, opacity } = layer;
|
|
6546
6487
|
if (!url || !layerName) {
|
|
6547
6488
|
console.warn("WMS layer missing url or layerName:", layer.title);
|
|
@@ -6560,7 +6501,7 @@ var WMSRenderer = (0, import_react12.memo)(({ layer }) => {
|
|
|
6560
6501
|
);
|
|
6561
6502
|
});
|
|
6562
6503
|
WMSRenderer.displayName = "WMSRenderer";
|
|
6563
|
-
var TileRenderer = (0,
|
|
6504
|
+
var TileRenderer = (0, import_react11.memo)(({ layer }) => {
|
|
6564
6505
|
const { url, opacity } = layer;
|
|
6565
6506
|
if (!url) {
|
|
6566
6507
|
console.warn("Tile layer missing url:", layer.title);
|
|
@@ -6569,9 +6510,9 @@ var TileRenderer = (0, import_react12.memo)(({ layer }) => {
|
|
|
6569
6510
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_leaflet9.TileLayer, { url, opacity: opacity / 100 }, layer.id);
|
|
6570
6511
|
});
|
|
6571
6512
|
TileRenderer.displayName = "TileRenderer";
|
|
6572
|
-
var GoogleSheetsRenderer = (0,
|
|
6513
|
+
var GoogleSheetsRenderer = (0, import_react11.memo)(
|
|
6573
6514
|
({ layer }) => {
|
|
6574
|
-
const mapLayer = (0,
|
|
6515
|
+
const mapLayer = (0, import_react11.useMemo)(
|
|
6575
6516
|
() => {
|
|
6576
6517
|
var _a;
|
|
6577
6518
|
return __spreadProps(__spreadValues({}, layer), {
|
|
@@ -6587,9 +6528,9 @@ var GoogleSheetsRenderer = (0, import_react12.memo)(
|
|
|
6587
6528
|
}
|
|
6588
6529
|
);
|
|
6589
6530
|
GoogleSheetsRenderer.displayName = "GoogleSheetsRenderer";
|
|
6590
|
-
var CustomLayerRenderer = (0,
|
|
6531
|
+
var CustomLayerRenderer = (0, import_react11.memo)(
|
|
6591
6532
|
({ layer }) => {
|
|
6592
|
-
const renderers = (0,
|
|
6533
|
+
const renderers = (0, import_react11.useMemo)(
|
|
6593
6534
|
() => ({
|
|
6594
6535
|
geojson: GeoJSONRenderer,
|
|
6595
6536
|
GeoJson: GeoJSONRenderer,
|
|
@@ -6619,9 +6560,9 @@ var CustomLayerRenderer = (0, import_react12.memo)(
|
|
|
6619
6560
|
}
|
|
6620
6561
|
);
|
|
6621
6562
|
CustomLayerRenderer.displayName = "CustomLayerRenderer";
|
|
6622
|
-
var CustomLayerList = (0,
|
|
6563
|
+
var CustomLayerList = (0, import_react11.memo)(() => {
|
|
6623
6564
|
const { customLayers } = useCustomLayerStore();
|
|
6624
|
-
const sortedLayers = (0,
|
|
6565
|
+
const sortedLayers = (0, import_react11.useMemo)(() => {
|
|
6625
6566
|
return [...customLayers].sort((a, b) => {
|
|
6626
6567
|
var _a, _b, _c, _d;
|
|
6627
6568
|
const orderA = (_b = (_a = a.order) != null ? _a : a.index) != null ? _b : 0;
|
|
@@ -6638,10 +6579,10 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
|
6638
6579
|
var LayerStoreList = () => {
|
|
6639
6580
|
const layerStore = useMapLayerStore();
|
|
6640
6581
|
const mapStore = map_default();
|
|
6641
|
-
const { data: mapMenuItems, isLoading } = (0,
|
|
6582
|
+
const { data: mapMenuItems, isLoading } = (0, import_core7.useMapMenuItems)();
|
|
6642
6583
|
const parsedMenuItems = parseMapMenuItems(mapMenuItems);
|
|
6643
6584
|
const layerItems = parsedMenuItems == null ? void 0 : parsedMenuItems.map((menu) => menu.subMenus);
|
|
6644
|
-
(0,
|
|
6585
|
+
(0, import_react12.useEffect)(() => {
|
|
6645
6586
|
layerItems == null ? void 0 : layerItems.forEach((layers) => {
|
|
6646
6587
|
layers == null ? void 0 : layers.forEach((layer) => {
|
|
6647
6588
|
var _a;
|
|
@@ -6713,7 +6654,7 @@ var LayerStoreList = () => {
|
|
|
6713
6654
|
|
|
6714
6655
|
// src/Components/MapEvents.tsx
|
|
6715
6656
|
var import_react_leaflet10 = require("react-leaflet");
|
|
6716
|
-
var
|
|
6657
|
+
var import_react13 = require("react");
|
|
6717
6658
|
var MapEvents = () => {
|
|
6718
6659
|
const mapStore = map_default();
|
|
6719
6660
|
var map = (0, import_react_leaflet10.useMap)();
|
|
@@ -6728,7 +6669,7 @@ var MapEvents = () => {
|
|
|
6728
6669
|
mapStore.onMapMove(center4);
|
|
6729
6670
|
}
|
|
6730
6671
|
});
|
|
6731
|
-
(0,
|
|
6672
|
+
(0, import_react13.useEffect)(() => {
|
|
6732
6673
|
mapStore.setMapRef(map);
|
|
6733
6674
|
if (map) {
|
|
6734
6675
|
setTimeout(() => {
|
|
@@ -6781,11 +6722,11 @@ var LabelButtonView = ({}) => {
|
|
|
6781
6722
|
};
|
|
6782
6723
|
|
|
6783
6724
|
// src/Components/MapSidebar.tsx
|
|
6784
|
-
var
|
|
6725
|
+
var import_core8 = require("@geowiki/core");
|
|
6785
6726
|
|
|
6786
6727
|
// src/Components/MiniMapElement.tsx
|
|
6787
6728
|
var import_react_leaflet11 = require("react-leaflet");
|
|
6788
|
-
var
|
|
6729
|
+
var import_react14 = require("react");
|
|
6789
6730
|
var import_server4 = require("react-dom/server");
|
|
6790
6731
|
var import_solid2 = require("@heroicons/react/20/solid");
|
|
6791
6732
|
var L12 = __toESM(require("leaflet"));
|
|
@@ -6795,14 +6736,14 @@ function getIcon3(Icon3) {
|
|
|
6795
6736
|
}
|
|
6796
6737
|
var MiniMapElement = ({ layerName }) => {
|
|
6797
6738
|
const mapStore = map_default();
|
|
6798
|
-
const ref = (0,
|
|
6799
|
-
(0,
|
|
6739
|
+
const ref = (0, import_react14.useRef)(null);
|
|
6740
|
+
(0, import_react14.useEffect)(() => {
|
|
6800
6741
|
const map = ref.current;
|
|
6801
6742
|
if (map != null) {
|
|
6802
6743
|
map.setView(mapStore.center, mapStore.zoom, { animate: true });
|
|
6803
6744
|
}
|
|
6804
6745
|
}, [mapStore.center, mapStore.zoom]);
|
|
6805
|
-
const miniMap = (0,
|
|
6746
|
+
const miniMap = (0, import_react14.useMemo)(() => {
|
|
6806
6747
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
6807
6748
|
import_react_leaflet11.MapContainer,
|
|
6808
6749
|
{
|
|
@@ -6844,12 +6785,12 @@ var MiniMapElement = ({ layerName }) => {
|
|
|
6844
6785
|
}, [layerName, mapStore.center, mapStore.zoom]);
|
|
6845
6786
|
return miniMap;
|
|
6846
6787
|
};
|
|
6847
|
-
var MiniMapElement_default = (0,
|
|
6788
|
+
var MiniMapElement_default = (0, import_react14.memo)(MiniMapElement);
|
|
6848
6789
|
|
|
6849
6790
|
// src/Components/MapSidebar.tsx
|
|
6850
6791
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6851
6792
|
var MapSidebar = ({}) => {
|
|
6852
|
-
const { data: wmsLayerNames } = (0,
|
|
6793
|
+
const { data: wmsLayerNames } = (0, import_core8.useEvolandWmsLayers)();
|
|
6853
6794
|
const layerStore = useMapLayerStore();
|
|
6854
6795
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid gap-1 p-2 grid-cols-1 overflow-y-scroll 3xl:grid-cols-2 h-[92.5vh] driver-left-panel", children: wmsLayerNames == null ? void 0 : wmsLayerNames.layers.map((layer) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "px-2", children: [
|
|
6855
6796
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "w-60 lx:w-80 line-clamp-1", children: layer.layerDescription }),
|
|
@@ -6860,8 +6801,8 @@ var MapSidebar = ({}) => {
|
|
|
6860
6801
|
// src/Components/Evoland/RasterPreview.tsx
|
|
6861
6802
|
var import_evoland_api_proxy3 = require("@geowiki/evoland-api-proxy");
|
|
6862
6803
|
var import_navigation = require("next/navigation");
|
|
6863
|
-
var
|
|
6864
|
-
var
|
|
6804
|
+
var import_react15 = require("react");
|
|
6805
|
+
var import_core9 = require("@geowiki/core");
|
|
6865
6806
|
var import_ui10 = require("@geowiki/ui");
|
|
6866
6807
|
var import_react_hotkeys_hook = require("react-hotkeys-hook");
|
|
6867
6808
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -6871,22 +6812,22 @@ var RasterPreview = (_props) => {
|
|
|
6871
6812
|
const router = (0, import_navigation.useRouter)();
|
|
6872
6813
|
const searchParams = (0, import_navigation.useSearchParams)();
|
|
6873
6814
|
const layerStore = useMapLayerStore();
|
|
6874
|
-
const [noNextLocation, setNoNextLocation] = (0,
|
|
6875
|
-
const [status, setStatus] = (0,
|
|
6876
|
-
const [submitNotification, setSubmitNotification] = (0,
|
|
6877
|
-
const [goToNextTask, setGoToNextTask] = (0,
|
|
6878
|
-
const [submitNotificationMessage, setSubmitNotificationMessage] = (0,
|
|
6879
|
-
const [disableSubmit, setDisableSubmit] = (0,
|
|
6815
|
+
const [noNextLocation, setNoNextLocation] = (0, import_react15.useState)(false);
|
|
6816
|
+
const [status, setStatus] = (0, import_react15.useState)();
|
|
6817
|
+
const [submitNotification, setSubmitNotification] = (0, import_react15.useState)(false);
|
|
6818
|
+
const [goToNextTask, setGoToNextTask] = (0, import_react15.useState)(false);
|
|
6819
|
+
const [submitNotificationMessage, setSubmitNotificationMessage] = (0, import_react15.useState)("");
|
|
6820
|
+
const [disableSubmit, setDisableSubmit] = (0, import_react15.useState)(false);
|
|
6880
6821
|
var projectId = searchParams.get("projectId");
|
|
6881
6822
|
var locationId = searchParams.get("locationId");
|
|
6882
|
-
const { data: tasks } = (0,
|
|
6823
|
+
const { data: tasks } = (0, import_core9.useRandomTasksPerLocation)({
|
|
6883
6824
|
taskForReview: evolandStore.task_for_review,
|
|
6884
6825
|
pageIdx: 0,
|
|
6885
6826
|
pageSize: 1,
|
|
6886
6827
|
locationProjectId: parseInt(projectId),
|
|
6887
6828
|
groupName: !localStorage.getItem("searchGroup") ? null : localStorage.getItem("searchGroup"),
|
|
6888
6829
|
search: null,
|
|
6889
|
-
statusIn: !localStorage.getItem("searchStatus") ?
|
|
6830
|
+
statusIn: !localStorage.getItem("searchStatus") ? import_core9.TaskStatus.SUBMITTED : localStorage.getItem("searchStatus"),
|
|
6890
6831
|
dateGte: localStorage.getItem("fromDate") !== null ? localStorage.getItem("fromDate") : void 0,
|
|
6891
6832
|
dateLte: !localStorage.getItem("toDate") ? void 0 : localStorage.getItem("toDate"),
|
|
6892
6833
|
userUserAlias: !localStorage.getItem("searchUser") ? null : localStorage.getItem("searchUser"),
|
|
@@ -6906,29 +6847,28 @@ var RasterPreview = (_props) => {
|
|
|
6906
6847
|
},
|
|
6907
6848
|
{ scopes: ["evoland"] }
|
|
6908
6849
|
);
|
|
6909
|
-
const onSubmit = (taskStatus) => __async(
|
|
6850
|
+
const onSubmit = (taskStatus) => __async(null, null, function* () {
|
|
6910
6851
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2;
|
|
6911
|
-
if (disableSubmit)
|
|
6912
|
-
return;
|
|
6852
|
+
if (disableSubmit) return;
|
|
6913
6853
|
setDisableSubmit(true);
|
|
6914
6854
|
var bufferData = null;
|
|
6915
6855
|
var { data: savedAnnotationBuffer, indexArr: savedAnnotationIndexArr } = evolandStore.savedAnnotations && evolandStore.isAnnualAnnotation ? { data: evolandStore.savedAnnotations.buffer, indexArr: 0 } : evolandStore.savedAnnotations ? flatten(evolandStore.savedAnnotations.buffer) : { data: void 0, indexArr: 0 };
|
|
6916
6856
|
var { data: annotationBuffer, indexArr: annotationBufferIndexArr } = evolandStore.annotatedRasterAsset && evolandStore.isAnnualAnnotation ? { data: evolandStore.annotatedRasterAsset.buffer, indexArr: 0 } : evolandStore.annotatedRasterAsset ? flatten(evolandStore.annotatedRasterAsset.buffer) : { data: void 0, indexArr: 0 };
|
|
6917
6857
|
setStatus(taskStatus[0]);
|
|
6918
|
-
bufferData = taskStatus[1] ===
|
|
6919
|
-
var annotation_dates = evolandStore.isAnnualAnnotation ? void 0 : taskStatus[1] ===
|
|
6858
|
+
bufferData = taskStatus[1] === import_core9.AnnotationRequired.NOT_REQUIRED ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_b2 = (_a2 = evolandStore.annotationUndoRedo) == null ? void 0 : _a2.past) == null ? void 0 : _b2.length) == 0 && !evolandStore.savedAnnotations ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_d2 = (_c2 = evolandStore.annotationUndoRedo) == null ? void 0 : _c2.past) == null ? void 0 : _d2.length) == 0 && evolandStore.savedAnnotations ? Buffer.from(savedAnnotationBuffer == null ? void 0 : savedAnnotationBuffer.buffer).toString("base64") : Buffer.from(annotationBuffer == null ? void 0 : annotationBuffer.buffer).toString("base64");
|
|
6859
|
+
var annotation_dates = evolandStore.isAnnualAnnotation ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.NOT_REQUIRED ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_f2 = (_e2 = evolandStore.annotationUndoRedo) == null ? void 0 : _e2.past) == null ? void 0 : _f2.length) == 0 && !evolandStore.savedAnnotations ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_h2 = (_g2 = evolandStore.annotationUndoRedo) == null ? void 0 : _g2.past) == null ? void 0 : _h2.length) == 0 && evolandStore.savedAnnotations ? savedAnnotationIndexArr.map(
|
|
6920
6860
|
(item) => evolandStore.reference_dates[item]
|
|
6921
6861
|
) : annotationBufferIndexArr.map(
|
|
6922
6862
|
(item) => evolandStore.reference_dates[item]
|
|
6923
6863
|
);
|
|
6924
|
-
if (!evolandStore.isAnnualAnnotation && annotation_dates && annotation_dates.length < ((_i2 = evolandStore.projectDetail) == null ? void 0 : _i2.minimum_annotation) && taskStatus[1] ===
|
|
6864
|
+
if (!evolandStore.isAnnualAnnotation && annotation_dates && annotation_dates.length < ((_i2 = evolandStore.projectDetail) == null ? void 0 : _i2.minimum_annotation) && taskStatus[1] === import_core9.AnnotationRequired.REQUIRED) {
|
|
6925
6865
|
alert(
|
|
6926
6866
|
"Task should have minimum " + ((_j2 = evolandStore.projectDetail) == null ? void 0 : _j2.minimum_annotation) + " annotations"
|
|
6927
6867
|
);
|
|
6928
6868
|
return;
|
|
6929
6869
|
}
|
|
6930
6870
|
if (evolandStore.annotatedRasterAsset && evolandStore.currentTask) {
|
|
6931
|
-
if (taskStatus[1] ===
|
|
6871
|
+
if (taskStatus[1] === import_core9.AnnotationRequired.REQUIRED) {
|
|
6932
6872
|
if (evolandStore.isAnnualAnnotation && isBase64Zeros(bufferData)) {
|
|
6933
6873
|
alert("Please provide annotation");
|
|
6934
6874
|
return;
|
|
@@ -6940,16 +6880,16 @@ var RasterPreview = (_props) => {
|
|
|
6940
6880
|
task_type: ((_k2 = evolandStore.projectDetail) == null ? void 0 : _k2.meta_data.ANNOTATION) ? [import_evoland_api_proxy3.TaskType.ANNOTATION] : [],
|
|
6941
6881
|
target_status: taskStatus[0],
|
|
6942
6882
|
base64_array: bufferData,
|
|
6943
|
-
array_height: taskStatus[1] ===
|
|
6944
|
-
array_width: taskStatus[1] ===
|
|
6945
|
-
annotation_time: taskStatus[1] === (
|
|
6883
|
+
array_height: taskStatus[1] === import_core9.AnnotationRequired.NOT_REQUIRED ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_m2 = (_l2 = evolandStore.annotationUndoRedo) == null ? void 0 : _l2.past) == null ? void 0 : _m2.length) == 0 && !evolandStore.savedAnnotations ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_o2 = (_n2 = evolandStore.annotationUndoRedo) == null ? void 0 : _n2.past) == null ? void 0 : _o2.length) == 0 && evolandStore.savedAnnotations ? evolandStore.savedAnnotations.height : evolandStore.annotatedRasterAsset.height,
|
|
6884
|
+
array_width: taskStatus[1] === import_core9.AnnotationRequired.NOT_REQUIRED ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_q2 = (_p2 = evolandStore.annotationUndoRedo) == null ? void 0 : _p2.past) == null ? void 0 : _q2.length) == 0 && !evolandStore.savedAnnotations ? void 0 : taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_s2 = (_r2 = evolandStore.annotationUndoRedo) == null ? void 0 : _r2.past) == null ? void 0 : _s2.length) == 0 && evolandStore.savedAnnotations ? evolandStore.savedAnnotations.width : evolandStore.annotatedRasterAsset.width,
|
|
6885
|
+
annotation_time: taskStatus[1] === (import_core9.AnnotationRequired.NOT_REQUIRED || import_core9.AnnotationRequired.OPTIONAL) ? void 0 : evolandStore.annotationTime,
|
|
6946
6886
|
annotation_dates: !evolandStore.isAnnualAnnotation && (annotation_dates == null ? void 0 : annotation_dates.length) > 0 ? annotation_dates : null,
|
|
6947
6887
|
comment: evolandStore.comment === "" ? void 0 : evolandStore.comment
|
|
6948
6888
|
};
|
|
6949
6889
|
try {
|
|
6950
6890
|
var response = yield import_evoland_api_proxy3.TaskService.updateTaskUpdatetaskPost(submitReq);
|
|
6951
6891
|
if (response !== void 0) {
|
|
6952
|
-
response ? taskStatus[1] ==
|
|
6892
|
+
response ? taskStatus[1] == import_core9.AnnotationRequired.REQUIRED || taskStatus[1] === import_core9.AnnotationRequired.OPTIONAL && ((_u2 = (_t2 = evolandStore.annotationUndoRedo) == null ? void 0 : _t2.past) == null ? void 0 : _u2.pop()) !== void 0 ? setSubmitNotificationMessage(
|
|
6953
6893
|
"Annotation has been moved to " + taskStatus[0].toUpperCase() + " state successfully with a new annotation. Moving to next location, please wait."
|
|
6954
6894
|
) : setSubmitNotificationMessage(
|
|
6955
6895
|
"Annotation has been moved to " + taskStatus[0].toUpperCase() + " successfully. Moving to next location, please wait."
|
|
@@ -6966,8 +6906,7 @@ var RasterPreview = (_props) => {
|
|
|
6966
6906
|
if (_props.userRole === "admin") {
|
|
6967
6907
|
if (tasks == null ? void 0 : tasks.task)
|
|
6968
6908
|
window.location.href = `/map?projectId=${projectId}&locationId=${(_v2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _v2.location_id}&taskId=${(_w2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _w2.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
|
|
6969
|
-
else
|
|
6970
|
-
alert("No more tasks to review");
|
|
6909
|
+
else alert("No more tasks to review");
|
|
6971
6910
|
}
|
|
6972
6911
|
var res = yield evolandStore.getNextLocationDetails(
|
|
6973
6912
|
parseInt(projectId)
|
|
@@ -6991,8 +6930,7 @@ var RasterPreview = (_props) => {
|
|
|
6991
6930
|
}
|
|
6992
6931
|
});
|
|
6993
6932
|
const arrayEqual = (a, b) => {
|
|
6994
|
-
if (a.length !== b.length)
|
|
6995
|
-
return false;
|
|
6933
|
+
if (a.length !== b.length) return false;
|
|
6996
6934
|
return Buffer.compare(Buffer.from(a.buffer), Buffer.from(b.buffer)) === 0;
|
|
6997
6935
|
};
|
|
6998
6936
|
const flatten = (input, refArr) => {
|
|
@@ -7016,15 +6954,14 @@ var RasterPreview = (_props) => {
|
|
|
7016
6954
|
}
|
|
7017
6955
|
}
|
|
7018
6956
|
}
|
|
7019
|
-
if (indexArr.length == 0)
|
|
7020
|
-
result = emptyAnnotation;
|
|
6957
|
+
if (indexArr.length == 0) result = emptyAnnotation;
|
|
7021
6958
|
return { data: new Uint32Array(result), indexArr };
|
|
7022
6959
|
};
|
|
7023
6960
|
function isBase64Zeros(base64String) {
|
|
7024
6961
|
const trimmed = base64String.replace(/=+$/, "");
|
|
7025
6962
|
return /^A+$/.test(trimmed);
|
|
7026
6963
|
}
|
|
7027
|
-
const onSave = () => __async(
|
|
6964
|
+
const onSave = () => __async(null, null, function* () {
|
|
7028
6965
|
var _a2, _b2;
|
|
7029
6966
|
var bufferData = null;
|
|
7030
6967
|
const { data, indexArr } = evolandStore.isAnnualAnnotation ? { data: evolandStore.annotatedRasterAsset.buffer, indexArr: 0 } : flatten(
|
|
@@ -7072,8 +7009,7 @@ var RasterPreview = (_props) => {
|
|
|
7072
7009
|
setSubmitNotificationMessage(
|
|
7073
7010
|
"Annotation has been SAVED successfully"
|
|
7074
7011
|
);
|
|
7075
|
-
else
|
|
7076
|
-
setSubmitNotificationMessage("Please try again");
|
|
7012
|
+
else setSubmitNotificationMessage("Please try again");
|
|
7077
7013
|
setSubmitNotification(true);
|
|
7078
7014
|
}
|
|
7079
7015
|
} catch (err) {
|
|
@@ -7082,7 +7018,7 @@ var RasterPreview = (_props) => {
|
|
|
7082
7018
|
}
|
|
7083
7019
|
}
|
|
7084
7020
|
});
|
|
7085
|
-
const ClearPreview = () => __async(
|
|
7021
|
+
const ClearPreview = () => __async(null, null, function* () {
|
|
7086
7022
|
const { annotationRaster, pastValues } = yield ClearAnnotation(
|
|
7087
7023
|
evolandStore.annotatedRasterAsset,
|
|
7088
7024
|
evolandStore.isAnnualAnnotation,
|
|
@@ -7145,16 +7081,14 @@ var RasterPreview = (_props) => {
|
|
|
7145
7081
|
)] : newValue == null ? void 0 : newValue.buffer[0] : newValue == null ? void 0 : newValue.buffer
|
|
7146
7082
|
);
|
|
7147
7083
|
};
|
|
7148
|
-
if (layerStore.layerOpacity == 0)
|
|
7149
|
-
layerStore.setLayerOpacity(0.4);
|
|
7084
|
+
if (layerStore.layerOpacity == 0) layerStore.setLayerOpacity(0.4);
|
|
7150
7085
|
if (!goToNextTask && evolandStore.location !== null && evolandStore.location.locationId !== searchParams.get("locationId")) {
|
|
7151
|
-
if (status ==
|
|
7086
|
+
if (status == import_core9.TaskStatus.ACCEPTED || status == import_core9.TaskStatus.DISCARDED || status == import_core9.TaskStatus.TO_FIX) {
|
|
7152
7087
|
setGoToNextTask(true);
|
|
7153
7088
|
if (_props.userRole === "admin")
|
|
7154
7089
|
if (tasks == null ? void 0 : tasks.task)
|
|
7155
7090
|
window.location.href = `/map?projectId=${projectId}&locationId=${(_a = tasks == null ? void 0 : tasks.task) == null ? void 0 : _a.location_id}&taskId=${(_b = tasks == null ? void 0 : tasks.task) == null ? void 0 : _b.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
|
|
7156
|
-
else
|
|
7157
|
-
alert("No more tasks to review");
|
|
7091
|
+
else alert("No more tasks to review");
|
|
7158
7092
|
} else
|
|
7159
7093
|
window.location.href = `/map?projectId=${projectId}&locationId=${(_c = evolandStore.location) == null ? void 0 : _c.locationId}&taskId=${(_d = evolandStore.location) == null ? void 0 : _d.task[0].task_id}`;
|
|
7160
7094
|
}
|
|
@@ -7203,10 +7137,8 @@ var RasterPreview = (_props) => {
|
|
|
7203
7137
|
parseInt(projectId),
|
|
7204
7138
|
evolandStore.referenceDate
|
|
7205
7139
|
).then(({ location, currentTask, annotation_dates }) => {
|
|
7206
|
-
if (location)
|
|
7207
|
-
|
|
7208
|
-
if (currentTask)
|
|
7209
|
-
evolandStore.setCurrentTask(currentTask);
|
|
7140
|
+
if (location) evolandStore.setLocation(location);
|
|
7141
|
+
if (currentTask) evolandStore.setCurrentTask(currentTask);
|
|
7210
7142
|
evolandStore.setAnnotationDates(annotation_dates);
|
|
7211
7143
|
});
|
|
7212
7144
|
},
|
|
@@ -7214,7 +7146,7 @@ var RasterPreview = (_props) => {
|
|
|
7214
7146
|
}
|
|
7215
7147
|
) }),
|
|
7216
7148
|
evolandStore.currentTask !== null && ((_h = (_g = evolandStore.currentTask) == null ? void 0 : _g.transition_states) == null ? void 0 : _h.length) > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-center", children: [
|
|
7217
|
-
((_i = evolandStore.currentTask) == null ? void 0 : _i.status) !==
|
|
7149
|
+
((_i = evolandStore.currentTask) == null ? void 0 : _i.status) !== import_core9.TaskStatus.SUBMITTED && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7218
7150
|
import_ui10.Button,
|
|
7219
7151
|
{
|
|
7220
7152
|
className: "mb-2 mt-2 mr-2 text-xs -flex-col",
|
|
@@ -7242,8 +7174,7 @@ var RasterPreview = (_props) => {
|
|
|
7242
7174
|
evolandStore.setComment(
|
|
7243
7175
|
evolandStore.comment.replace(" #" + x, "")
|
|
7244
7176
|
);
|
|
7245
|
-
else
|
|
7246
|
-
evolandStore.setComment("#" + x + " ");
|
|
7177
|
+
else evolandStore.setComment("#" + x + " ");
|
|
7247
7178
|
},
|
|
7248
7179
|
children: [
|
|
7249
7180
|
"#",
|
|
@@ -7270,13 +7201,13 @@ var RasterPreview = (_props) => {
|
|
|
7270
7201
|
{
|
|
7271
7202
|
disabled: disableSubmit,
|
|
7272
7203
|
style: {
|
|
7273
|
-
backgroundColor:
|
|
7204
|
+
backgroundColor: import_core9.TaskStatusColor[x[0]]
|
|
7274
7205
|
},
|
|
7275
7206
|
className: "h-6 text-xs p-1 m-1 text-forground-black -px-4 -py-2 w-full",
|
|
7276
7207
|
onClick: () => {
|
|
7277
7208
|
onSubmit(x);
|
|
7278
7209
|
},
|
|
7279
|
-
children:
|
|
7210
|
+
children: import_core9.TaskState[x[0]]
|
|
7280
7211
|
}
|
|
7281
7212
|
) });
|
|
7282
7213
|
}
|
|
@@ -7405,7 +7336,7 @@ var RasterPreview = (_props) => {
|
|
|
7405
7336
|
);
|
|
7406
7337
|
},
|
|
7407
7338
|
alt: "annotation",
|
|
7408
|
-
className: (0,
|
|
7339
|
+
className: (0, import_core9.classNames)(
|
|
7409
7340
|
"text-xs w-48 border-y border-x border-gray-100 hover:border-gray-400",
|
|
7410
7341
|
((_q = evolandStore.selectedRasterAsset) == null ? void 0 : _q.id) === ((_r = evolandStore.annotatedRasterAsset) == null ? void 0 : _r.id) && " border-2 border-red-600 ",
|
|
7411
7342
|
evolandStore.selectedRasterAsset === null || ((_s = evolandStore.selectedRasterAsset) == null ? void 0 : _s.id) !== ((_t = evolandStore.annotatedRasterAsset) == null ? void 0 : _t.id) && " border-gray-50"
|
|
@@ -7467,7 +7398,7 @@ var RasterPreview = (_props) => {
|
|
|
7467
7398
|
|
|
7468
7399
|
// src/Components/Evoland/Annotation.tsx
|
|
7469
7400
|
var import_ui11 = require("@geowiki/ui");
|
|
7470
|
-
var
|
|
7401
|
+
var import_react16 = require("react");
|
|
7471
7402
|
var import_link = __toESM(require("next/link"));
|
|
7472
7403
|
var import_router2 = require("next/router");
|
|
7473
7404
|
var import_evoland_api_proxy4 = require("@geowiki/evoland-api-proxy");
|
|
@@ -7478,27 +7409,27 @@ var Annotation = (props) => {
|
|
|
7478
7409
|
const router = (0, import_router2.useRouter)();
|
|
7479
7410
|
var projectId = router.query.projectId;
|
|
7480
7411
|
var locationId = router.query.locationId;
|
|
7481
|
-
const [activeLearningLoading, setActiveLearningLoading] = (0,
|
|
7412
|
+
const [activeLearningLoading, setActiveLearningLoading] = (0, import_react16.useState)(false);
|
|
7482
7413
|
const labels = (_a = evolandStore.labels) == null ? void 0 : _a.filter(
|
|
7483
7414
|
(x) => !x.labelName.includes("/")
|
|
7484
7415
|
);
|
|
7485
|
-
const [primaryLabelItem, setPrimaryLabelItem] = (0,
|
|
7416
|
+
const [primaryLabelItem, setPrimaryLabelItem] = (0, import_react16.useState)({
|
|
7486
7417
|
labelColor: [],
|
|
7487
7418
|
labelName: "Primary",
|
|
7488
7419
|
labelId: 0
|
|
7489
7420
|
});
|
|
7490
|
-
const [secondaryLabelItem, setSecondaryLabelItem] = (0,
|
|
7421
|
+
const [secondaryLabelItem, setSecondaryLabelItem] = (0, import_react16.useState)({
|
|
7491
7422
|
labelColor: [],
|
|
7492
7423
|
labelName: "Secondary",
|
|
7493
7424
|
labelId: 0
|
|
7494
7425
|
});
|
|
7495
|
-
const [tertiaryLabelItem, setTertiaryLabelItem] = (0,
|
|
7426
|
+
const [tertiaryLabelItem, setTertiaryLabelItem] = (0, import_react16.useState)({
|
|
7496
7427
|
labelColor: [],
|
|
7497
7428
|
labelName: "Tertiary",
|
|
7498
7429
|
labelId: 0
|
|
7499
7430
|
});
|
|
7500
|
-
const [currentLabelItem, setCurrentLabelItem] = (0,
|
|
7501
|
-
const OnSubmitActiveLearning = () => __async(
|
|
7431
|
+
const [currentLabelItem, setCurrentLabelItem] = (0, import_react16.useState)();
|
|
7432
|
+
const OnSubmitActiveLearning = () => __async(null, null, function* () {
|
|
7502
7433
|
var _a2, _b2;
|
|
7503
7434
|
setActiveLearningLoading(true);
|
|
7504
7435
|
var bufferData = null;
|
|
@@ -8083,8 +8014,8 @@ var Annotation = (props) => {
|
|
|
8083
8014
|
|
|
8084
8015
|
// src/Components/Evoland/EvolandLeftSideBar.tsx
|
|
8085
8016
|
var import_router3 = require("next/router");
|
|
8086
|
-
var
|
|
8087
|
-
var
|
|
8017
|
+
var import_core14 = require("@geowiki/core");
|
|
8018
|
+
var import_react20 = require("react");
|
|
8088
8019
|
var import_ui15 = require("@geowiki/ui");
|
|
8089
8020
|
var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
|
|
8090
8021
|
var import_link2 = __toESM(require("next/link"));
|
|
@@ -8092,11 +8023,11 @@ var import_link2 = __toESM(require("next/link"));
|
|
|
8092
8023
|
// src/Components/Evoland/GeoWikiTools.tsx
|
|
8093
8024
|
var turf5 = __toESM(require("@turf/turf"));
|
|
8094
8025
|
var import_geojson_to_kml = __toESM(require("geojson-to-kml"));
|
|
8095
|
-
var
|
|
8026
|
+
var import_react17 = require("react");
|
|
8096
8027
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
8097
8028
|
var GeoWikiTools = () => {
|
|
8098
8029
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
8099
|
-
const [esriDate, setEsriDate] = (0,
|
|
8030
|
+
const [esriDate, setEsriDate] = (0, import_react17.useState)(void 0);
|
|
8100
8031
|
const scale = 16;
|
|
8101
8032
|
const evolandStore = evoland_default();
|
|
8102
8033
|
const centroid3 = getCentroid(
|
|
@@ -8520,11 +8451,11 @@ var AssetOpacity = (props) => {
|
|
|
8520
8451
|
};
|
|
8521
8452
|
|
|
8522
8453
|
// src/Components/ViewAssets.tsx
|
|
8523
|
-
var
|
|
8524
|
-
var
|
|
8454
|
+
var import_react18 = require("react");
|
|
8455
|
+
var import_core11 = require("@geowiki/core");
|
|
8525
8456
|
|
|
8526
8457
|
// src/Components/Evoland/RasterImage.tsx
|
|
8527
|
-
var
|
|
8458
|
+
var import_core10 = require("@geowiki/core");
|
|
8528
8459
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
8529
8460
|
var RasterImageWithColorMap = (props) => {
|
|
8530
8461
|
var _a, _b, _c, _d, _e;
|
|
@@ -8533,7 +8464,7 @@ var RasterImageWithColorMap = (props) => {
|
|
|
8533
8464
|
imgUri && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
8534
8465
|
"div",
|
|
8535
8466
|
{
|
|
8536
|
-
className: (0,
|
|
8467
|
+
className: (0, import_core10.classNames)(
|
|
8537
8468
|
"relative text-xs border-y border-x hover:border-gray-600",
|
|
8538
8469
|
((_a = props.selectedItem) == null ? void 0 : _a.id) === ((_b = props.rasterAssetItem) == null ? void 0 : _b.id) && " border-blue-600 bg-primary",
|
|
8539
8470
|
props.selectedItem === null || ((_c = props.selectedItem) == null ? void 0 : _c.id) !== ((_d = props.rasterAssetItem) == null ? void 0 : _d.id) && "border-gray-300"
|
|
@@ -8569,54 +8500,53 @@ var import_ui13 = require("@geowiki/ui");
|
|
|
8569
8500
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
8570
8501
|
var assetsByYear = (assets) => assets == null ? void 0 : assets.reduce((acc, item) => {
|
|
8571
8502
|
const year = new Date(item.reference_date).getFullYear();
|
|
8572
|
-
if (!acc[year])
|
|
8573
|
-
acc[year] = [];
|
|
8503
|
+
if (!acc[year]) acc[year] = [];
|
|
8574
8504
|
acc[year].push(item);
|
|
8575
8505
|
return acc;
|
|
8576
8506
|
}, {});
|
|
8577
8507
|
var ViewAssets = (props) => {
|
|
8578
8508
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
8579
8509
|
const evolandStore = evoland_default();
|
|
8580
|
-
const [submittedAnnotations, setSubmittedAnnotations] = (0,
|
|
8510
|
+
const [submittedAnnotations, setSubmittedAnnotations] = (0, import_react18.useState)(
|
|
8581
8511
|
evolandStore.submittedAnnotations !== null ? evolandStore.submittedAnnotations : []
|
|
8582
8512
|
);
|
|
8583
|
-
const [savedAnnotations, setSavedAnnotations] = (0,
|
|
8513
|
+
const [savedAnnotations, setSavedAnnotations] = (0, import_react18.useState)(
|
|
8584
8514
|
evolandStore.savedAnnotations !== null ? evolandStore.savedAnnotations : null
|
|
8585
8515
|
);
|
|
8586
|
-
const [maskTab, setMaskTab] = (0,
|
|
8516
|
+
const [maskTab, setMaskTab] = (0, import_react18.useState)(
|
|
8587
8517
|
props.defaultAssetView == "SEGMENTATION_MASK" /* SegmentationMask */ ? true : false
|
|
8588
8518
|
);
|
|
8589
|
-
const [changeMaskTab, setChangeMaskTab] = (0,
|
|
8519
|
+
const [changeMaskTab, setChangeMaskTab] = (0, import_react18.useState)(
|
|
8590
8520
|
props.defaultAssetView == "CHANGE_SEGMENTATION_MASK" /* ChangeSegmentationMask */ ? true : false
|
|
8591
8521
|
);
|
|
8592
|
-
const [annotationTab, setAnnotationTab] = (0,
|
|
8593
|
-
const [compositesTab, setCompositesTab] = (0,
|
|
8522
|
+
const [annotationTab, setAnnotationTab] = (0, import_react18.useState)(false);
|
|
8523
|
+
const [compositesTab, setCompositesTab] = (0, import_react18.useState)(
|
|
8594
8524
|
props.defaultAssetView == "COMPOSITE" /* Composite */ ? true : false
|
|
8595
8525
|
);
|
|
8596
|
-
const [masks, setMasks] = (0,
|
|
8526
|
+
const [masks, setMasks] = (0, import_react18.useState)(
|
|
8597
8527
|
evolandStore.maskAsset !== null ? evolandStore.maskAsset : []
|
|
8598
8528
|
);
|
|
8599
|
-
const [changeMasks, setChangeMasks] = (0,
|
|
8529
|
+
const [changeMasks, setChangeMasks] = (0, import_react18.useState)(
|
|
8600
8530
|
evolandStore.changeMaskAsset !== null ? evolandStore.changeMaskAsset : []
|
|
8601
8531
|
);
|
|
8602
|
-
const [annotations, setAnnotations] = (0,
|
|
8532
|
+
const [annotations, setAnnotations] = (0, import_react18.useState)(
|
|
8603
8533
|
evolandStore.annotatedRasterAsset !== null ? [evolandStore.annotatedRasterAsset] : []
|
|
8604
8534
|
);
|
|
8605
|
-
const [composites, setComposites] = (0,
|
|
8535
|
+
const [composites, setComposites] = (0, import_react18.useState)(
|
|
8606
8536
|
evolandStore.compositeAsset !== null ? assetsByYear(evolandStore.compositeAsset) : []
|
|
8607
8537
|
);
|
|
8608
|
-
const [fetchAnnotationRaster, setFetchAnnotationRaster] = (0,
|
|
8538
|
+
const [fetchAnnotationRaster, setFetchAnnotationRaster] = (0, import_react18.useState)(false);
|
|
8609
8539
|
const {
|
|
8610
8540
|
data: taskAnnotation,
|
|
8611
8541
|
isLoading: IsTaskAnnotationLoading,
|
|
8612
8542
|
error
|
|
8613
|
-
} = (0,
|
|
8543
|
+
} = (0, import_core11.useTaskMultipleAnnotations)(
|
|
8614
8544
|
props.taskId !== void 0 && props.taskId !== 0 && submittedAnnotations.length == 0 ? props.taskId : submittedAnnotations.length == 0 && evolandStore.currentTask != null && ((_a = evolandStore.currentTask) == null ? void 0 : _a.task_id) !== void 0 ? evolandStore.currentTask.task_id : null
|
|
8615
8545
|
);
|
|
8616
|
-
const { data: taskSavedAnnotation } = (0,
|
|
8546
|
+
const { data: taskSavedAnnotation } = (0, import_core11.useTaskSavedAnnotations)(
|
|
8617
8547
|
props.taskId !== void 0 && props.taskId !== 0 && savedAnnotations == null ? props.taskId : savedAnnotations == null && evolandStore.currentTask != null && ((_b = evolandStore.currentTask) == null ? void 0 : _b.task_id) !== void 0 && evolandStore.currentTask.saved_annotation !== null ? evolandStore.currentTask.task_id : null
|
|
8618
8548
|
);
|
|
8619
|
-
const { data: latestTaskOnLocation } = (0,
|
|
8549
|
+
const { data: latestTaskOnLocation } = (0, import_core11.useLatestTaskOnLocation)(
|
|
8620
8550
|
props.locationId,
|
|
8621
8551
|
props.projectId,
|
|
8622
8552
|
evolandStore.referenceDate
|
|
@@ -8687,14 +8617,10 @@ var ViewAssets = (props) => {
|
|
|
8687
8617
|
);
|
|
8688
8618
|
if (props.taskId !== void 0 && IsTaskAnnotationLoading)
|
|
8689
8619
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui13.LoaderFull, {});
|
|
8690
|
-
if (maskTab && (masks == null ? void 0 : masks.length) == 0)
|
|
8691
|
-
|
|
8692
|
-
if (
|
|
8693
|
-
|
|
8694
|
-
if (compositesTab && composites.length == 0)
|
|
8695
|
-
checkCompositesAndLoad();
|
|
8696
|
-
if (annotationTab)
|
|
8697
|
-
checkAnnotationsAndLoad();
|
|
8620
|
+
if (maskTab && (masks == null ? void 0 : masks.length) == 0) setMasks(evolandStore.maskAsset);
|
|
8621
|
+
if (changeMaskTab && (changeMasks == null ? void 0 : changeMasks.length) == 0) checkChangeMasksAndLoad();
|
|
8622
|
+
if (compositesTab && composites.length == 0) checkCompositesAndLoad();
|
|
8623
|
+
if (annotationTab) checkAnnotationsAndLoad();
|
|
8698
8624
|
function checkMasksAndLoad() {
|
|
8699
8625
|
if ((masks == null ? void 0 : masks.length) === 0 && !evolandStore.maskAsset) {
|
|
8700
8626
|
evolandStore.getLocationAssets(
|
|
@@ -8705,8 +8631,7 @@ var ViewAssets = (props) => {
|
|
|
8705
8631
|
).then((res) => {
|
|
8706
8632
|
setMasks(res);
|
|
8707
8633
|
});
|
|
8708
|
-
} else if (masks.length == 0)
|
|
8709
|
-
setMasks(evolandStore.maskAsset);
|
|
8634
|
+
} else if (masks.length == 0) setMasks(evolandStore.maskAsset);
|
|
8710
8635
|
}
|
|
8711
8636
|
function checkChangeMasksAndLoad() {
|
|
8712
8637
|
if ((changeMasks == null ? void 0 : changeMasks.length) === 0 && !evolandStore.changeMaskAsset) {
|
|
@@ -8752,8 +8677,7 @@ var ViewAssets = (props) => {
|
|
|
8752
8677
|
}
|
|
8753
8678
|
if (props.taskId !== void 0 && IsTaskAnnotationLoading)
|
|
8754
8679
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui13.LoaderFull, {});
|
|
8755
|
-
if (maskTab && ((masks == null ? void 0 : masks.length) == 0 || masks == null))
|
|
8756
|
-
setMaskTab(false);
|
|
8680
|
+
if (maskTab && ((masks == null ? void 0 : masks.length) == 0 || masks == null)) setMaskTab(false);
|
|
8757
8681
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
8758
8682
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
8759
8683
|
"div",
|
|
@@ -8763,7 +8687,7 @@ var ViewAssets = (props) => {
|
|
|
8763
8687
|
(masks == null ? void 0 : masks.length) > 0 && evolandStore.maskAsset && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8764
8688
|
"button",
|
|
8765
8689
|
{
|
|
8766
|
-
className: (0,
|
|
8690
|
+
className: (0, import_core11.classNames)(
|
|
8767
8691
|
"border-r border-t border-gray-300",
|
|
8768
8692
|
!maskTab && "bg-primary"
|
|
8769
8693
|
),
|
|
@@ -8780,7 +8704,7 @@ var ViewAssets = (props) => {
|
|
|
8780
8704
|
((_d = evolandStore.changeMaskAsset) == null ? void 0 : _d.length) > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8781
8705
|
"button",
|
|
8782
8706
|
{
|
|
8783
|
-
className: (0,
|
|
8707
|
+
className: (0, import_core11.classNames)(
|
|
8784
8708
|
"border-r border-t border-gray-300",
|
|
8785
8709
|
!changeMaskTab && "bg-primary"
|
|
8786
8710
|
),
|
|
@@ -8797,7 +8721,7 @@ var ViewAssets = (props) => {
|
|
|
8797
8721
|
showAnnotationTab && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8798
8722
|
"button",
|
|
8799
8723
|
{
|
|
8800
|
-
className: (0,
|
|
8724
|
+
className: (0, import_core11.classNames)(
|
|
8801
8725
|
"border-r border-t border-gray-300 px-1",
|
|
8802
8726
|
!annotationTab && "bg-primary"
|
|
8803
8727
|
),
|
|
@@ -8814,7 +8738,7 @@ var ViewAssets = (props) => {
|
|
|
8814
8738
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8815
8739
|
"button",
|
|
8816
8740
|
{
|
|
8817
|
-
className: (0,
|
|
8741
|
+
className: (0, import_core11.classNames)(
|
|
8818
8742
|
"border-r border-t border-gray-300 px-1",
|
|
8819
8743
|
!compositesTab && "bg-primary"
|
|
8820
8744
|
),
|
|
@@ -9115,40 +9039,40 @@ var ViewAssets = (props) => {
|
|
|
9115
9039
|
};
|
|
9116
9040
|
|
|
9117
9041
|
// src/Components/Evoland/SearchAnnotation.tsx
|
|
9118
|
-
var
|
|
9119
|
-
var
|
|
9042
|
+
var import_react19 = require("react");
|
|
9043
|
+
var import_core12 = require("@geowiki/core");
|
|
9120
9044
|
var import_ui14 = require("@geowiki/ui");
|
|
9121
9045
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
9122
9046
|
var SearchAnnotation = (props) => {
|
|
9123
|
-
const { data: users, isLoading: IsUsersLoading } = (0,
|
|
9047
|
+
const { data: users, isLoading: IsUsersLoading } = (0, import_core12.useProjectUsers)(
|
|
9124
9048
|
props.projectId
|
|
9125
9049
|
);
|
|
9126
|
-
const { data: taskStatusList, isLoading: IsTaskStatusLoading } = (0,
|
|
9127
|
-
const { data: groups, isLoading: IsGroupsLoading } = (0,
|
|
9050
|
+
const { data: taskStatusList, isLoading: IsTaskStatusLoading } = (0, import_core12.useTaskStatusList)();
|
|
9051
|
+
const { data: groups, isLoading: IsGroupsLoading } = (0, import_core12.useGroupsInProject)(
|
|
9128
9052
|
props.projectId
|
|
9129
9053
|
);
|
|
9130
|
-
const [searchUser, setSearchUser] = (0,
|
|
9054
|
+
const [searchUser, setSearchUser] = (0, import_react19.useState)(
|
|
9131
9055
|
!localStorage.getItem("searchUser") ? "" : localStorage.getItem("searchUser")
|
|
9132
9056
|
);
|
|
9133
|
-
const [searchGroup, setsearchGroup] = (0,
|
|
9057
|
+
const [searchGroup, setsearchGroup] = (0, import_react19.useState)(
|
|
9134
9058
|
!localStorage.getItem("searchGroup") ? "" : localStorage.getItem("searchGroup")
|
|
9135
9059
|
);
|
|
9136
|
-
const [searchStatus, setSearchStatus] = (0,
|
|
9137
|
-
!localStorage.getItem("searchStatus") ?
|
|
9060
|
+
const [searchStatus, setSearchStatus] = (0, import_react19.useState)(
|
|
9061
|
+
!localStorage.getItem("searchStatus") ? import_core12.TaskStatus.SUBMITTED : localStorage.getItem("searchStatus")
|
|
9138
9062
|
);
|
|
9139
|
-
const [fromDate, setFromDate] = (0,
|
|
9063
|
+
const [fromDate, setFromDate] = (0, import_react19.useState)(
|
|
9140
9064
|
localStorage.getItem("fromDate") !== null ? localStorage.getItem("fromDate") : ""
|
|
9141
9065
|
);
|
|
9142
|
-
const [toDate, setToDate] = (0,
|
|
9066
|
+
const [toDate, setToDate] = (0, import_react19.useState)(
|
|
9143
9067
|
!localStorage.getItem("toDate") ? "" : localStorage.getItem("toDate")
|
|
9144
9068
|
);
|
|
9145
|
-
const { data: tasks } = (0,
|
|
9069
|
+
const { data: tasks } = (0, import_core12.useRandomTasksPerLocation)({
|
|
9146
9070
|
taskForReview: props.taskForReview,
|
|
9147
9071
|
pageIdx: 0,
|
|
9148
9072
|
pageSize: searchUser == void 0 && searchGroup == void 0 ? 1 : 10,
|
|
9149
9073
|
locationProjectId: props.projectId,
|
|
9150
9074
|
groupName: searchGroup || null,
|
|
9151
|
-
statusIn: searchUser == void 0 && searchStatus == void 0 ?
|
|
9075
|
+
statusIn: searchUser == void 0 && searchStatus == void 0 ? import_core12.TaskStatus.SUBMITTED : searchStatus,
|
|
9152
9076
|
dateGte: fromDate,
|
|
9153
9077
|
dateLte: toDate,
|
|
9154
9078
|
userUserAlias: searchUser || null
|
|
@@ -9249,7 +9173,7 @@ var SearchAnnotation = (props) => {
|
|
|
9249
9173
|
"option",
|
|
9250
9174
|
{
|
|
9251
9175
|
value: x,
|
|
9252
|
-
selected: searchStatus === void 0 ? x ===
|
|
9176
|
+
selected: searchStatus === void 0 ? x === import_core12.TaskStatus.SUBMITTED : searchStatus == x,
|
|
9253
9177
|
children: x
|
|
9254
9178
|
},
|
|
9255
9179
|
index
|
|
@@ -9309,8 +9233,7 @@ var SearchAnnotation = (props) => {
|
|
|
9309
9233
|
localStorage.setItem("toDate", toDate);
|
|
9310
9234
|
if (tasks == null ? void 0 : tasks.exists)
|
|
9311
9235
|
window.location.href = `/map?projectId=${tasks == null ? void 0 : tasks.task.project_id}&locationId=${tasks == null ? void 0 : tasks.task.location_id}&taskId=${tasks == null ? void 0 : tasks.task.task_id}${props.taskForReview ? "&review=true" : ""}`;
|
|
9312
|
-
else
|
|
9313
|
-
alert("No data for search parameters");
|
|
9236
|
+
else alert("No data for search parameters");
|
|
9314
9237
|
},
|
|
9315
9238
|
children: [
|
|
9316
9239
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -9337,12 +9260,12 @@ var SearchAnnotation = (props) => {
|
|
|
9337
9260
|
onClick: () => {
|
|
9338
9261
|
setSearchUser("");
|
|
9339
9262
|
setsearchGroup("");
|
|
9340
|
-
setSearchStatus(
|
|
9263
|
+
setSearchStatus(import_core12.TaskStatus.SUBMITTED);
|
|
9341
9264
|
setFromDate("");
|
|
9342
9265
|
setToDate("");
|
|
9343
9266
|
localStorage.removeItem("searchUser");
|
|
9344
9267
|
localStorage.removeItem("searchGroup");
|
|
9345
|
-
localStorage.setItem("searchStatus",
|
|
9268
|
+
localStorage.setItem("searchStatus", import_core12.TaskStatus.SUBMITTED);
|
|
9346
9269
|
localStorage.removeItem("fromDate");
|
|
9347
9270
|
localStorage.removeItem("toDate");
|
|
9348
9271
|
},
|
|
@@ -9363,7 +9286,7 @@ var SearchAnnotation = (props) => {
|
|
|
9363
9286
|
};
|
|
9364
9287
|
|
|
9365
9288
|
// src/Components/Evoland/TaskEventLog.tsx
|
|
9366
|
-
var
|
|
9289
|
+
var import_core13 = require("@geowiki/core");
|
|
9367
9290
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
9368
9291
|
var TaskEventLog = (props) => {
|
|
9369
9292
|
return Object.entries(props.taskEventsGrouped).map(
|
|
@@ -9371,12 +9294,12 @@ var TaskEventLog = (props) => {
|
|
|
9371
9294
|
var _a, _b, _c, _d;
|
|
9372
9295
|
let tempAnnotationId = "";
|
|
9373
9296
|
let tempComment = "";
|
|
9374
|
-
if (x[1][0].event_type ==
|
|
9297
|
+
if (x[1][0].event_type == import_core13.TaskEventType.NEW_ANNOTATION)
|
|
9375
9298
|
tempAnnotationId = x[1][0].content;
|
|
9376
|
-
if (x[1][0].event_type ==
|
|
9299
|
+
if (x[1][0].event_type == import_core13.TaskEventType.COMMENT)
|
|
9377
9300
|
tempComment = x[1][0].content;
|
|
9378
9301
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
9379
|
-
x[1].length == 1 && (x[1][0].event_type ==
|
|
9302
|
+
x[1].length == 1 && (x[1][0].event_type == import_core13.TaskEventType.CREATED ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
9380
9303
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-primary leading-5", children: [
|
|
9381
9304
|
"System - ",
|
|
9382
9305
|
(_a = x[1][0]) == null ? void 0 : _a.event_time
|
|
@@ -9387,13 +9310,13 @@ var TaskEventLog = (props) => {
|
|
|
9387
9310
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("i", { children: (_b = x[1][0]) == null ? void 0 : _b.actor_alias })
|
|
9388
9311
|
] })
|
|
9389
9312
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-white", children: [
|
|
9390
|
-
x[1][0].event_type !==
|
|
9313
|
+
x[1][0].event_type !== import_core13.TaskEventType.NEW_ANNOTATION && x[1][0].event_type !== import_core13.TaskEventType.COMMENT && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-primary leading-5 mt-2", children: [
|
|
9391
9314
|
(_c = x[1][0]) == null ? void 0 : _c.actor_alias,
|
|
9392
9315
|
" - ",
|
|
9393
9316
|
(_d = x[1][0]) == null ? void 0 : _d.event_time
|
|
9394
9317
|
] }),
|
|
9395
|
-
x[1][0].event_type ==
|
|
9396
|
-
(x[1][0].event_type ==
|
|
9318
|
+
x[1][0].event_type == import_core13.TaskEventType.REVIEW && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-black text-xs leading-5", children: x[1][0].content }),
|
|
9319
|
+
(x[1][0].event_type == import_core13.TaskEventType.STATUS_UPDATED || x[1][0].event_type == import_core13.TaskEventType.COMMENT) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-black text-xs leading-5", children: [
|
|
9397
9320
|
tempAnnotationId !== "" && tempComment == "" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
9398
9321
|
" ",
|
|
9399
9322
|
"Status changed to : ",
|
|
@@ -9431,17 +9354,17 @@ var TaskEventLog = (props) => {
|
|
|
9431
9354
|
] })
|
|
9432
9355
|
] }, index)),
|
|
9433
9356
|
x[1].length > 1 && x[1].map((y, yIndex) => {
|
|
9434
|
-
if (y.event_type ==
|
|
9357
|
+
if (y.event_type == import_core13.TaskEventType.NEW_ANNOTATION)
|
|
9435
9358
|
tempAnnotationId = y.content;
|
|
9436
|
-
if (y.event_type ==
|
|
9359
|
+
if (y.event_type == import_core13.TaskEventType.COMMENT)
|
|
9437
9360
|
tempComment = y.content;
|
|
9438
9361
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-white", children: [
|
|
9439
|
-
y.event_type !==
|
|
9362
|
+
y.event_type !== import_core13.TaskEventType.NEW_ANNOTATION && y.event_type !== import_core13.TaskEventType.COMMENT && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-primary leading-5 mt-2", children: [
|
|
9440
9363
|
y == null ? void 0 : y.actor_alias,
|
|
9441
9364
|
" - ",
|
|
9442
9365
|
y == null ? void 0 : y.event_time
|
|
9443
9366
|
] }),
|
|
9444
|
-
(y.event_type ==
|
|
9367
|
+
(y.event_type == import_core13.TaskEventType.STATUS_UPDATED || y.event_type == import_core13.TaskEventType.COMMENT || y.event_type == import_core13.TaskEventType.QUESTIONNAIRE || y.event_type == import_core13.TaskEventType.REVIEW) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-black text-xs leading-5", children: [
|
|
9445
9368
|
tempAnnotationId !== "" && tempComment == "" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
9446
9369
|
" ",
|
|
9447
9370
|
"Status changed to : ",
|
|
@@ -9449,12 +9372,12 @@ var TaskEventLog = (props) => {
|
|
|
9449
9372
|
" with new Annotation :",
|
|
9450
9373
|
tempAnnotationId
|
|
9451
9374
|
] }),
|
|
9452
|
-
tempAnnotationId == "" && tempComment == "" && y.event_type !==
|
|
9375
|
+
tempAnnotationId == "" && tempComment == "" && y.event_type !== import_core13.TaskEventType.QUESTIONNAIRE && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
9453
9376
|
" ",
|
|
9454
9377
|
"Status changed to : ",
|
|
9455
9378
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("i", { children: y.content })
|
|
9456
9379
|
] }),
|
|
9457
|
-
tempAnnotationId == "" && tempComment == "" && y.event_type ==
|
|
9380
|
+
tempAnnotationId == "" && tempComment == "" && y.event_type == import_core13.TaskEventType.QUESTIONNAIRE && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: "Questionnaire filled" }),
|
|
9458
9381
|
tempComment !== "" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex", children: [
|
|
9459
9382
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9460
9383
|
"svg",
|
|
@@ -9493,7 +9416,7 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9493
9416
|
var locationId = router.query.locationId;
|
|
9494
9417
|
const projectId = parseInt(router.query.projectId);
|
|
9495
9418
|
const review = router.query.review;
|
|
9496
|
-
const [checkLocation, setCheckLocation] = (0,
|
|
9419
|
+
const [checkLocation, setCheckLocation] = (0, import_react20.useState)(false);
|
|
9497
9420
|
const evolandStore = evoland_default();
|
|
9498
9421
|
if (review && !evolandStore.task_for_review)
|
|
9499
9422
|
evolandStore.setTaskForReview(true);
|
|
@@ -9501,46 +9424,46 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9501
9424
|
setCheckLocation(true);
|
|
9502
9425
|
alert("Invalid location or project");
|
|
9503
9426
|
}
|
|
9504
|
-
const [masks, setMasks] = (0,
|
|
9505
|
-
const [changemasks, setChangeMasks] = (0,
|
|
9506
|
-
const [annotations, setAnnotations] = (0,
|
|
9507
|
-
const [fetchMasks, setFetchMasks] = (0,
|
|
9508
|
-
const [fetchChangeMasks, setFetchChangeMasks] = (0,
|
|
9509
|
-
const { data: latestTaskOnLocation } = (0,
|
|
9427
|
+
const [masks, setMasks] = (0, import_react20.useState)([]);
|
|
9428
|
+
const [changemasks, setChangeMasks] = (0, import_react20.useState)([]);
|
|
9429
|
+
const [annotations, setAnnotations] = (0, import_react20.useState)([]);
|
|
9430
|
+
const [fetchMasks, setFetchMasks] = (0, import_react20.useState)(false);
|
|
9431
|
+
const [fetchChangeMasks, setFetchChangeMasks] = (0, import_react20.useState)(false);
|
|
9432
|
+
const { data: latestTaskOnLocation } = (0, import_core14.useLatestTaskOnLocation)(
|
|
9510
9433
|
locationId,
|
|
9511
9434
|
projectId,
|
|
9512
9435
|
evolandStore.referenceDate
|
|
9513
9436
|
);
|
|
9514
|
-
const [savedAnnotations] = (0,
|
|
9437
|
+
const [savedAnnotations] = (0, import_react20.useState)(
|
|
9515
9438
|
evolandStore.savedAnnotations !== null ? evolandStore.savedAnnotations : null
|
|
9516
9439
|
);
|
|
9517
|
-
const [composites, setComposites] = (0,
|
|
9518
|
-
const [isFetchUserTask, setIsFetchUserTask] = (0,
|
|
9519
|
-
const [adminTasks, setAdminTasks] = (0,
|
|
9520
|
-
const [deleteTask, setDeleteTask] = (0,
|
|
9440
|
+
const [composites, setComposites] = (0, import_react20.useState)([]);
|
|
9441
|
+
const [isFetchUserTask, setIsFetchUserTask] = (0, import_react20.useState)(false);
|
|
9442
|
+
const [adminTasks, setAdminTasks] = (0, import_react20.useState)();
|
|
9443
|
+
const [deleteTask, setDeleteTask] = (0, import_react20.useState)(false);
|
|
9521
9444
|
var taskId = router.query.taskId == void 0 ? (_a = evolandStore.currentTask) == null ? void 0 : _a.task_id : router.query.taskId;
|
|
9522
|
-
const { data: taskSavedAnnotation } = (0,
|
|
9445
|
+
const { data: taskSavedAnnotation } = (0, import_core14.useTaskSavedAnnotations)(
|
|
9523
9446
|
taskId !== void 0 && parseInt(taskId) !== 0 && savedAnnotations == null ? parseInt(taskId) : savedAnnotations == null && evolandStore.currentTask != null && ((_b = evolandStore.currentTask) == null ? void 0 : _b.task_id) !== void 0 && evolandStore.currentTask.saved_annotation !== null ? evolandStore.currentTask.task_id : !evolandStore.currentTask && latestTaskOnLocation && latestTaskOnLocation.exists ? latestTaskOnLocation.task_id : null
|
|
9524
9447
|
);
|
|
9525
|
-
const { data: TaskDeleted, isLoading: IsTaskDeletedLoading } = (0,
|
|
9448
|
+
const { data: TaskDeleted, isLoading: IsTaskDeletedLoading } = (0, import_core14.useTaskDelete)(
|
|
9526
9449
|
taskId !== void 0 && parseInt(taskId) !== 0 ? parseInt(taskId) : (_c = evolandStore.currentTask) == null ? void 0 : _c.task_id,
|
|
9527
9450
|
projectId,
|
|
9528
9451
|
deleteTask
|
|
9529
9452
|
);
|
|
9530
|
-
const { data: tasks } = (0,
|
|
9453
|
+
const { data: tasks } = (0, import_core14.useRandomTasksPerLocation)({
|
|
9531
9454
|
taskForReview: evolandStore.task_for_review,
|
|
9532
9455
|
pageIdx: 0,
|
|
9533
9456
|
pageSize: 1,
|
|
9534
9457
|
locationProjectId: projectId,
|
|
9535
9458
|
groupName: !localStorage.getItem("searchGroup") ? null : localStorage.getItem("searchGroup"),
|
|
9536
9459
|
search: null,
|
|
9537
|
-
statusIn: !localStorage.getItem("searchStatus") ?
|
|
9460
|
+
statusIn: !localStorage.getItem("searchStatus") ? import_core14.TaskStatus.SUBMITTED : localStorage.getItem("searchStatus"),
|
|
9538
9461
|
dateGte: localStorage.getItem("fromDate") !== null ? localStorage.getItem("fromDate") : void 0,
|
|
9539
9462
|
dateLte: !localStorage.getItem("toDate") ? void 0 : localStorage.getItem("toDate"),
|
|
9540
9463
|
userUserAlias: !localStorage.getItem("searchUser") ? null : localStorage.getItem("searchUser"),
|
|
9541
9464
|
locationLocationId: null
|
|
9542
9465
|
});
|
|
9543
|
-
const [savedAnnotationTime, setSavedAnnotationTime] = (0,
|
|
9466
|
+
const [savedAnnotationTime, setSavedAnnotationTime] = (0, import_react20.useState)(
|
|
9544
9467
|
null
|
|
9545
9468
|
);
|
|
9546
9469
|
const showAnnotationTab = showAnnotation(
|
|
@@ -9624,14 +9547,11 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9624
9547
|
}
|
|
9625
9548
|
if (evolandStore.projectDetail) {
|
|
9626
9549
|
if (((_m = (_l = evolandStore.projectDetail) == null ? void 0 : _l.meta_data) == null ? void 0 : _m.default_asset_view) == "SEGMENTATION_MASK" /* SegmentationMask */) {
|
|
9627
|
-
if ((masks == null ? void 0 : masks.length) === 0)
|
|
9628
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
|
|
9550
|
+
if ((masks == null ? void 0 : masks.length) === 0) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
|
|
9629
9551
|
} else if (((_o = (_n = evolandStore.projectDetail) == null ? void 0 : _n.meta_data) == null ? void 0 : _o.default_asset_view) == "COMPOSITE" /* Composite */) {
|
|
9630
|
-
if ((composites == null ? void 0 : composites.length) === 0)
|
|
9631
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
|
|
9552
|
+
if ((composites == null ? void 0 : composites.length) === 0) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
|
|
9632
9553
|
}
|
|
9633
|
-
} else
|
|
9634
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
|
|
9554
|
+
} else return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
|
|
9635
9555
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9636
9556
|
"div",
|
|
9637
9557
|
{
|
|
@@ -9681,10 +9601,10 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9681
9601
|
"div",
|
|
9682
9602
|
{
|
|
9683
9603
|
style: {
|
|
9684
|
-
backgroundColor: ((_p = evolandStore.currentTask) == null ? void 0 : _p.status) !== null && ((_q = evolandStore.currentTask) == null ? void 0 : _q.status) !== void 0 ?
|
|
9604
|
+
backgroundColor: ((_p = evolandStore.currentTask) == null ? void 0 : _p.status) !== null && ((_q = evolandStore.currentTask) == null ? void 0 : _q.status) !== void 0 ? import_core14.TaskStatusColor[(_r = evolandStore.currentTask) == null ? void 0 : _r.status] : !evolandStore.currentTask && latestTaskOnLocation && latestTaskOnLocation.exists ? import_core14.TaskStatusColor[latestTaskOnLocation.task_status] : !evolandStore.currentTask && !(latestTaskOnLocation == null ? void 0 : latestTaskOnLocation.exists) ? "bg-primary text-primary-foreground" : "white"
|
|
9685
9605
|
},
|
|
9686
|
-
className: "pl-2 pr-2 flex rounded-lg text-center " + (((_s = evolandStore.currentTask) == null ? void 0 : _s.status) !== null && ((_t = evolandStore.currentTask) == null ? void 0 : _t.status) !== void 0 ? "bg-" +
|
|
9687
|
-
children: ((_v = evolandStore.currentTask) == null ? void 0 : _v.status) !== null && ((_w = evolandStore.currentTask) == null ? void 0 : _w.status) !== void 0 ?
|
|
9606
|
+
className: "pl-2 pr-2 flex rounded-lg text-center " + (((_s = evolandStore.currentTask) == null ? void 0 : _s.status) !== null && ((_t = evolandStore.currentTask) == null ? void 0 : _t.status) !== void 0 ? "bg-" + import_core14.TaskStatusColor[(_u = evolandStore.currentTask) == null ? void 0 : _u.status] + "-500" : !evolandStore.currentTask && latestTaskOnLocation && latestTaskOnLocation.exists ? "bg-" + import_core14.TaskStatusColor[latestTaskOnLocation.task_status] + "-500" : !evolandStore.currentTask && !(latestTaskOnLocation == null ? void 0 : latestTaskOnLocation.exists) ? "bg-primary text-primary-foreground" : "bg-white-500"),
|
|
9607
|
+
children: ((_v = evolandStore.currentTask) == null ? void 0 : _v.status) !== null && ((_w = evolandStore.currentTask) == null ? void 0 : _w.status) !== void 0 ? import_core14.TaskStatus[(_x = evolandStore.currentTask) == null ? void 0 : _x.status] : !evolandStore.currentTask && latestTaskOnLocation && latestTaskOnLocation.exists ? import_core14.TaskStatus[latestTaskOnLocation.task_status] : !evolandStore.currentTask && !(latestTaskOnLocation == null ? void 0 : latestTaskOnLocation.task_id) ? "Not started" : ""
|
|
9688
9608
|
}
|
|
9689
9609
|
) }),
|
|
9690
9610
|
locationId && projectId && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_ui15.Popover, { children: [
|
|
@@ -9798,8 +9718,7 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9798
9718
|
canDelete = confirm(
|
|
9799
9719
|
(review ? "This is a targeted review task. " : "") + "Are you sure you want to delete this task?"
|
|
9800
9720
|
);
|
|
9801
|
-
if (canDelete)
|
|
9802
|
-
setDeleteTask(true);
|
|
9721
|
+
if (canDelete) setDeleteTask(true);
|
|
9803
9722
|
},
|
|
9804
9723
|
children: [
|
|
9805
9724
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -9841,8 +9760,7 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9841
9760
|
evolandStore.setAnnotationDates(annotation_dates);
|
|
9842
9761
|
if (currentTask)
|
|
9843
9762
|
evolandStore.setCurrentTask(currentTask);
|
|
9844
|
-
if (location)
|
|
9845
|
-
evolandStore.setLocation(location);
|
|
9763
|
+
if (location) evolandStore.setLocation(location);
|
|
9846
9764
|
if (props.userRole === "admin")
|
|
9847
9765
|
window.location.href = "/map?projectId=" + projectId + "&locationId=" + (currentTask == null ? void 0 : currentTask.location_id) + "&taskId=" + (currentTask == null ? void 0 : currentTask.task_id) + (evolandStore.task_for_review ? "&review=true" : "");
|
|
9848
9766
|
}
|
|
@@ -9855,10 +9773,10 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9855
9773
|
"div",
|
|
9856
9774
|
{
|
|
9857
9775
|
style: {
|
|
9858
|
-
backgroundColor:
|
|
9776
|
+
backgroundColor: import_core14.TaskStatusColor[x.status]
|
|
9859
9777
|
},
|
|
9860
9778
|
className: "pl-2 pr-2 flex rounded-lg text-center",
|
|
9861
|
-
children:
|
|
9779
|
+
children: import_core14.TaskStatus[x.status]
|
|
9862
9780
|
}
|
|
9863
9781
|
)
|
|
9864
9782
|
] }, index)) })
|
|
@@ -9933,8 +9851,8 @@ var EvolandLeftSideBar = (props) => {
|
|
|
9933
9851
|
// src/Components/Evoland/Questions.tsx
|
|
9934
9852
|
var import_ui16 = require("@geowiki/ui");
|
|
9935
9853
|
var import_router4 = require("next/router");
|
|
9936
|
-
var
|
|
9937
|
-
var
|
|
9854
|
+
var import_core15 = require("@geowiki/core");
|
|
9855
|
+
var import_react21 = require("react");
|
|
9938
9856
|
var import_evoland_api_proxy5 = require("@geowiki/evoland-api-proxy");
|
|
9939
9857
|
var import_navigation2 = require("next/navigation");
|
|
9940
9858
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
@@ -9945,23 +9863,23 @@ var Questions = (props) => {
|
|
|
9945
9863
|
const searchParams = (0, import_navigation2.useSearchParams)();
|
|
9946
9864
|
const projectId = searchParams.get("projectId");
|
|
9947
9865
|
const taskId = searchParams.get("taskId");
|
|
9948
|
-
const { data: labels } = (0,
|
|
9949
|
-
const [taskChangeDetail, setTaskChangeDetail] = (0,
|
|
9950
|
-
var { data: questionnaire, isLoading: IsQuestionnaireLoading } = (0,
|
|
9951
|
-
const [context, setContext] = (0,
|
|
9952
|
-
const [singleChoice, setSingleChoice] = (0,
|
|
9953
|
-
const [status, setStatus] = (0,
|
|
9954
|
-
const [submitNotification, setSubmitNotification] = (0,
|
|
9955
|
-
const [noNextLocation, setNoNextLocation] = (0,
|
|
9956
|
-
const [goToNextTask, setGoToNextTask] = (0,
|
|
9957
|
-
const [submitNotificationMessage, setSubmitNotificationMessage] = (0,
|
|
9958
|
-
const [disableSubmit, setDisableSubmit] = (0,
|
|
9959
|
-
const [userAnswers, setUserAnswers] = (0,
|
|
9866
|
+
const { data: labels } = (0, import_core15.useEvolandLabels)(parseInt(projectId));
|
|
9867
|
+
const [taskChangeDetail, setTaskChangeDetail] = (0, import_react21.useState)(null);
|
|
9868
|
+
var { data: questionnaire, isLoading: IsQuestionnaireLoading } = (0, import_core15.useQuestionnaire)(parseInt(projectId));
|
|
9869
|
+
const [context, setContext] = (0, import_react21.useState)();
|
|
9870
|
+
const [singleChoice, setSingleChoice] = (0, import_react21.useState)();
|
|
9871
|
+
const [status, setStatus] = (0, import_react21.useState)();
|
|
9872
|
+
const [submitNotification, setSubmitNotification] = (0, import_react21.useState)(false);
|
|
9873
|
+
const [noNextLocation, setNoNextLocation] = (0, import_react21.useState)(false);
|
|
9874
|
+
const [goToNextTask, setGoToNextTask] = (0, import_react21.useState)(false);
|
|
9875
|
+
const [submitNotificationMessage, setSubmitNotificationMessage] = (0, import_react21.useState)("");
|
|
9876
|
+
const [disableSubmit, setDisableSubmit] = (0, import_react21.useState)(false);
|
|
9877
|
+
const [userAnswers, setUserAnswers] = (0, import_react21.useState)([]);
|
|
9960
9878
|
let requiredUserAnswers = 0;
|
|
9961
|
-
const { data: taskAnswers, isLoading: IsTaskAnswerLoading } = (0,
|
|
9879
|
+
const { data: taskAnswers, isLoading: IsTaskAnswerLoading } = (0, import_core15.useTaskAnswers)(
|
|
9962
9880
|
taskId ? parseInt(taskId) : ((_a = evolandStore.currentTask) == null ? void 0 : _a.task_id) ? (_b = evolandStore.currentTask) == null ? void 0 : _b.task_id : 0
|
|
9963
9881
|
);
|
|
9964
|
-
(0,
|
|
9882
|
+
(0, import_react21.useEffect)(() => {
|
|
9965
9883
|
var _a2, _b2;
|
|
9966
9884
|
if (evolandStore.currentTask) {
|
|
9967
9885
|
if (((_a2 = evolandStore.currentTask) == null ? void 0 : _a2.change_id) && !taskChangeDetail)
|
|
@@ -10012,23 +9930,22 @@ var Questions = (props) => {
|
|
|
10012
9930
|
});
|
|
10013
9931
|
}
|
|
10014
9932
|
};
|
|
10015
|
-
const { data: tasks } = (0,
|
|
9933
|
+
const { data: tasks } = (0, import_core15.useRandomTasksPerLocation)({
|
|
10016
9934
|
taskForReview: evolandStore.task_for_review,
|
|
10017
9935
|
pageIdx: 0,
|
|
10018
9936
|
pageSize: 1,
|
|
10019
9937
|
locationProjectId: parseInt(projectId),
|
|
10020
9938
|
groupName: !localStorage.getItem("searchGroup") ? null : localStorage.getItem("searchGroup"),
|
|
10021
9939
|
search: null,
|
|
10022
|
-
statusIn: !localStorage.getItem("searchStatus") ?
|
|
9940
|
+
statusIn: !localStorage.getItem("searchStatus") ? import_core15.TaskStatus.SUBMITTED : localStorage.getItem("searchStatus"),
|
|
10023
9941
|
dateGte: localStorage.getItem("fromDate") !== null ? localStorage.getItem("fromDate") : void 0,
|
|
10024
9942
|
dateLte: !localStorage.getItem("toDate") ? void 0 : localStorage.getItem("toDate"),
|
|
10025
9943
|
userUserAlias: !localStorage.getItem("searchUser") ? null : localStorage.getItem("searchUser"),
|
|
10026
9944
|
locationLocationId: null
|
|
10027
9945
|
});
|
|
10028
|
-
const onSubmit = (taskStatus) => __async(
|
|
9946
|
+
const onSubmit = (taskStatus) => __async(null, null, function* () {
|
|
10029
9947
|
var _a2, _b2, _c2, _d2, _e2;
|
|
10030
|
-
if (disableSubmit)
|
|
10031
|
-
return;
|
|
9948
|
+
if (disableSubmit) return;
|
|
10032
9949
|
setDisableSubmit(true);
|
|
10033
9950
|
setStatus(taskStatus[0]);
|
|
10034
9951
|
if (evolandStore.currentTask) {
|
|
@@ -10037,7 +9954,7 @@ var Questions = (props) => {
|
|
|
10037
9954
|
project_id: parseInt(projectId),
|
|
10038
9955
|
target_status: taskStatus[0],
|
|
10039
9956
|
task_type: ((_a2 = evolandStore.projectDetail) == null ? void 0 : _a2.meta_data.QUESTIONNAIRE) ? [import_evoland_api_proxy5.TaskType.QUESTIONNAIRE] : [],
|
|
10040
|
-
annotation_time: taskStatus[1] === (
|
|
9957
|
+
annotation_time: taskStatus[1] === (import_core15.AnnotationRequired.NOT_REQUIRED || import_core15.AnnotationRequired.OPTIONAL) ? void 0 : evolandStore.annotationTime,
|
|
10041
9958
|
questionnaire: userAnswers.map((item) => [
|
|
10042
9959
|
item.question_id,
|
|
10043
9960
|
item.answer_text
|
|
@@ -10047,7 +9964,7 @@ var Questions = (props) => {
|
|
|
10047
9964
|
try {
|
|
10048
9965
|
var response = yield import_evoland_api_proxy5.TaskService.updateTaskUpdatetaskPost(submitReq);
|
|
10049
9966
|
if (response !== void 0) {
|
|
10050
|
-
response ? taskStatus[1] ==
|
|
9967
|
+
response ? taskStatus[1] == import_core15.AnnotationRequired.REQUIRED || taskStatus[1] === import_core15.AnnotationRequired.OPTIONAL && ((_c2 = (_b2 = evolandStore.annotationUndoRedo) == null ? void 0 : _b2.past) == null ? void 0 : _c2.pop()) !== void 0 ? setSubmitNotificationMessage(
|
|
10051
9968
|
"Task has been moved to " + taskStatus[0].toUpperCase() + " state successfully with selected answers. Moving to next location, please wait."
|
|
10052
9969
|
) : setSubmitNotificationMessage(
|
|
10053
9970
|
"Task has been moved to " + taskStatus[0].toUpperCase() + " successfully. Moving to next location, please wait."
|
|
@@ -10060,8 +9977,7 @@ var Questions = (props) => {
|
|
|
10060
9977
|
if (props.userRole === "admin") {
|
|
10061
9978
|
if (tasks == null ? void 0 : tasks.task)
|
|
10062
9979
|
window.location.href = `/map?projectId=${projectId}&locationId=${(_d2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _d2.location_id}&taskId=${(_e2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _e2.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
|
|
10063
|
-
else
|
|
10064
|
-
alert("No more tasks to review");
|
|
9980
|
+
else alert("No more tasks to review");
|
|
10065
9981
|
}
|
|
10066
9982
|
var res = yield evolandStore.getNextLocationDetails(
|
|
10067
9983
|
parseInt(projectId)
|
|
@@ -10084,7 +10000,7 @@ var Questions = (props) => {
|
|
|
10084
10000
|
setSubmitNotificationMessage("");
|
|
10085
10001
|
}
|
|
10086
10002
|
});
|
|
10087
|
-
const onSave = () => __async(
|
|
10003
|
+
const onSave = () => __async(null, null, function* () {
|
|
10088
10004
|
if (evolandStore.currentTask) {
|
|
10089
10005
|
const saveQuestionnaireReq = {
|
|
10090
10006
|
task_id: evolandStore.currentTask.task_id,
|
|
@@ -10103,8 +10019,7 @@ var Questions = (props) => {
|
|
|
10103
10019
|
setSubmitNotificationMessage(
|
|
10104
10020
|
"Questionnaire has been SAVED successfully"
|
|
10105
10021
|
);
|
|
10106
|
-
else
|
|
10107
|
-
setSubmitNotificationMessage("Please try again");
|
|
10022
|
+
else setSubmitNotificationMessage("Please try again");
|
|
10108
10023
|
setSubmitNotification(true);
|
|
10109
10024
|
}
|
|
10110
10025
|
} catch (err) {
|
|
@@ -10119,11 +10034,11 @@ var Questions = (props) => {
|
|
|
10119
10034
|
});
|
|
10120
10035
|
if (questionnaire && !context)
|
|
10121
10036
|
setContext(
|
|
10122
|
-
questionnaire.filter((x) => x.type ==
|
|
10037
|
+
questionnaire.filter((x) => x.type == import_core15.QuestionnaireType.CONTEXT).sort((x, y) => x.order_id - y.order_id)
|
|
10123
10038
|
);
|
|
10124
10039
|
if (questionnaire && !singleChoice)
|
|
10125
10040
|
setSingleChoice(
|
|
10126
|
-
questionnaire.filter((x) => x.type ==
|
|
10041
|
+
questionnaire.filter((x) => x.type == import_core15.QuestionnaireType.SINGLE_CHOICE).sort((x, y) => x.order_id - y.order_id)
|
|
10127
10042
|
);
|
|
10128
10043
|
if (context && taskChangeDetail) {
|
|
10129
10044
|
context.filter((x) => x.has_dynamic_answers).map((y) => {
|
|
@@ -10137,8 +10052,7 @@ var Questions = (props) => {
|
|
|
10137
10052
|
"<" + key + ">",
|
|
10138
10053
|
"" + (label == null ? void 0 : label.labelName)
|
|
10139
10054
|
);
|
|
10140
|
-
} else
|
|
10141
|
-
y.text = y.text.replace("<" + key + ">", "" + value);
|
|
10055
|
+
} else y.text = y.text.replace("<" + key + ">", "" + value);
|
|
10142
10056
|
});
|
|
10143
10057
|
});
|
|
10144
10058
|
}
|
|
@@ -10179,13 +10093,12 @@ var Questions = (props) => {
|
|
|
10179
10093
|
});
|
|
10180
10094
|
}
|
|
10181
10095
|
if (!goToNextTask && evolandStore.location !== null && evolandStore.location.locationId !== searchParams.get("locationId")) {
|
|
10182
|
-
if (status ==
|
|
10096
|
+
if (status == import_core15.TaskStatus.ACCEPTED || status == import_core15.TaskStatus.DISCARDED || status == import_core15.TaskStatus.TO_FIX) {
|
|
10183
10097
|
setGoToNextTask(true);
|
|
10184
10098
|
if (props.userRole === "admin")
|
|
10185
10099
|
if (tasks == null ? void 0 : tasks.task)
|
|
10186
10100
|
window.location.href = `/map?projectId=${projectId}&locationId=${(_c = tasks == null ? void 0 : tasks.task) == null ? void 0 : _c.location_id}&taskId=${(_d = tasks == null ? void 0 : tasks.task) == null ? void 0 : _d.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
|
|
10187
|
-
else
|
|
10188
|
-
alert("No more tasks to review");
|
|
10101
|
+
else alert("No more tasks to review");
|
|
10189
10102
|
} else
|
|
10190
10103
|
window.location.href = `/map?projectId=${projectId}&locationId=${(_e = evolandStore.location) == null ? void 0 : _e.locationId}&taskId=${(_f = evolandStore.location) == null ? void 0 : _f.task[0].task_id}`;
|
|
10191
10104
|
}
|
|
@@ -10272,7 +10185,7 @@ var Questions = (props) => {
|
|
|
10272
10185
|
}
|
|
10273
10186
|
),
|
|
10274
10187
|
evolandStore.currentTask !== null && ((_k = (_j = evolandStore.currentTask) == null ? void 0 : _j.transition_states) == null ? void 0 : _k.length) > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-center", children: [
|
|
10275
|
-
((_l = evolandStore.currentTask) == null ? void 0 : _l.status) !==
|
|
10188
|
+
((_l = evolandStore.currentTask) == null ? void 0 : _l.status) !== import_core15.TaskStatus.SUBMITTED && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10276
10189
|
import_ui16.Button,
|
|
10277
10190
|
{
|
|
10278
10191
|
className: "mb-2 mt-2 mr-2 text-xs -flex-col",
|
|
@@ -10300,8 +10213,7 @@ var Questions = (props) => {
|
|
|
10300
10213
|
evolandStore.setComment(
|
|
10301
10214
|
evolandStore.comment.replace(" #" + x, "")
|
|
10302
10215
|
);
|
|
10303
|
-
else
|
|
10304
|
-
evolandStore.setComment("#" + x + " ");
|
|
10216
|
+
else evolandStore.setComment("#" + x + " ");
|
|
10305
10217
|
},
|
|
10306
10218
|
children: [
|
|
10307
10219
|
"#",
|
|
@@ -10328,16 +10240,15 @@ var Questions = (props) => {
|
|
|
10328
10240
|
{
|
|
10329
10241
|
disabled: disableSubmit,
|
|
10330
10242
|
style: {
|
|
10331
|
-
backgroundColor:
|
|
10243
|
+
backgroundColor: import_core15.TaskStatusColor[x[0]]
|
|
10332
10244
|
},
|
|
10333
10245
|
className: "h-6 text-xs p-1 m-1 text-forground-black -px-4 -py-2 w-full",
|
|
10334
10246
|
onClick: () => {
|
|
10335
|
-
if (
|
|
10247
|
+
if (import_core15.TaskState[x[0]] !== import_core15.TaskState.SKIPPED && import_core15.TaskState[x[0]] !== import_core15.TaskState.DISCARDED && import_core15.TaskState[x[0]] !== import_core15.TaskState.USER_DISCARDED && userAnswers.length !== requiredUserAnswers)
|
|
10336
10248
|
alert("Please provide all answers");
|
|
10337
|
-
else
|
|
10338
|
-
onSubmit(x);
|
|
10249
|
+
else onSubmit(x);
|
|
10339
10250
|
},
|
|
10340
|
-
children:
|
|
10251
|
+
children: import_core15.TaskState[x[0]]
|
|
10341
10252
|
}
|
|
10342
10253
|
) });
|
|
10343
10254
|
}
|
|
@@ -10364,14 +10275,14 @@ var Questions = (props) => {
|
|
|
10364
10275
|
};
|
|
10365
10276
|
|
|
10366
10277
|
// src/Components/TimeSeries.tsx
|
|
10367
|
-
var
|
|
10278
|
+
var import_react22 = require("react");
|
|
10368
10279
|
var turf6 = __toESM(require("@turf/turf"));
|
|
10369
10280
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
10370
10281
|
var TimeSeries = () => {
|
|
10371
10282
|
const evolandStore = useEvolandStore();
|
|
10372
|
-
const [detailedImgUrls, setDetailedImgUrls] = (0,
|
|
10373
|
-
const [taskChangeYears, setTaskChangeYears] = (0,
|
|
10374
|
-
const [currentTab, setCurrentTab] = (0,
|
|
10283
|
+
const [detailedImgUrls, setDetailedImgUrls] = (0, import_react22.useState)([]);
|
|
10284
|
+
const [taskChangeYears, setTaskChangeYears] = (0, import_react22.useState)([]);
|
|
10285
|
+
const [currentTab, setCurrentTab] = (0, import_react22.useState)(0);
|
|
10375
10286
|
const minDate = evolandStore.referenceDate + "-01-01";
|
|
10376
10287
|
const maxDate = evolandStore.referenceDate + "-12-31";
|
|
10377
10288
|
function fetchImages(layerName, changeYears = null) {
|
|
@@ -10381,7 +10292,7 @@ var TimeSeries = () => {
|
|
|
10381
10292
|
const bbox4 = [bounds[1], bounds[0], bounds[3], bounds[2]];
|
|
10382
10293
|
const years = changeYears != null ? changeYears : taskChangeYears;
|
|
10383
10294
|
if (years) {
|
|
10384
|
-
years.map((year) => __async(
|
|
10295
|
+
years.map((year) => __async(null, null, function* () {
|
|
10385
10296
|
yield getTimeseries(
|
|
10386
10297
|
year + "-01-01",
|
|
10387
10298
|
year + "-12-31",
|
|
@@ -10416,8 +10327,7 @@ var TimeSeries = () => {
|
|
|
10416
10327
|
})
|
|
10417
10328
|
}
|
|
10418
10329
|
);
|
|
10419
|
-
if (!appendImages)
|
|
10420
|
-
setDetailedImgUrls((yield response.json()).images);
|
|
10330
|
+
if (!appendImages) setDetailedImgUrls((yield response.json()).images);
|
|
10421
10331
|
else {
|
|
10422
10332
|
response.json().then((res) => {
|
|
10423
10333
|
setDetailedImgUrls((prevUrls) => [...prevUrls, ...res.images]);
|
|
@@ -10425,7 +10335,7 @@ var TimeSeries = () => {
|
|
|
10425
10335
|
}
|
|
10426
10336
|
});
|
|
10427
10337
|
}
|
|
10428
|
-
(0,
|
|
10338
|
+
(0, import_react22.useEffect)(() => {
|
|
10429
10339
|
var _a, _b, _c, _d;
|
|
10430
10340
|
setDetailedImgUrls([]);
|
|
10431
10341
|
if ((_a = evolandStore.currentTask) == null ? void 0 : _a.change_id)
|
|
@@ -10461,18 +10371,15 @@ var TimeSeries = () => {
|
|
|
10461
10371
|
return 1;
|
|
10462
10372
|
else if (x.substring(x.split("_")[0].length, x.length) < y.substring(y.split("_")[0].length, y.length))
|
|
10463
10373
|
return -1;
|
|
10464
|
-
else
|
|
10465
|
-
return 0;
|
|
10374
|
+
else return 0;
|
|
10466
10375
|
}).map((x, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10467
10376
|
"button",
|
|
10468
10377
|
{
|
|
10469
10378
|
className: currentTab === index ? "pl-1 pr-5 border-gray-300 text-white" : "pl-1 pr-5 border-gray-300 bg-gray-200",
|
|
10470
10379
|
onClick: () => {
|
|
10471
10380
|
setDetailedImgUrls([]);
|
|
10472
|
-
if (x.includes("RGB"))
|
|
10473
|
-
|
|
10474
|
-
else if (x.includes("FCC"))
|
|
10475
|
-
fetchImages("COLOR_INFRARED" /* FCC */);
|
|
10381
|
+
if (x.includes("RGB")) fetchImages("TRUE_COLOR" /* RGB */);
|
|
10382
|
+
else if (x.includes("FCC")) fetchImages("COLOR_INFRARED" /* FCC */);
|
|
10476
10383
|
setCurrentTab(index);
|
|
10477
10384
|
},
|
|
10478
10385
|
children: x.substring(x.split("_")[0].length + 1, x.length)
|
|
@@ -10615,13 +10522,13 @@ var TimeSeries = () => {
|
|
|
10615
10522
|
};
|
|
10616
10523
|
|
|
10617
10524
|
// src/Components/OverlayLayer.tsx
|
|
10618
|
-
var
|
|
10619
|
-
var
|
|
10525
|
+
var import_core16 = require("@geowiki/core");
|
|
10526
|
+
var import_react23 = require("react");
|
|
10620
10527
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
10621
10528
|
var OverlayLayer = () => {
|
|
10622
10529
|
const layerStore = useMapLayerStore();
|
|
10623
|
-
const { data: wmsLayerNames } = (0,
|
|
10624
|
-
const [showLayerOpacity, setShowLayerOpacity] = (0,
|
|
10530
|
+
const { data: wmsLayerNames } = (0, import_core16.useEvolandWmsLayers)();
|
|
10531
|
+
const [showLayerOpacity, setShowLayerOpacity] = (0, import_react23.useState)(false);
|
|
10625
10532
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "w-full items-center mt-2 justify-center text-xs", children: [
|
|
10626
10533
|
showLayerOpacity && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mt-2", children: [
|
|
10627
10534
|
"Overlay Layer's opacity",
|
|
@@ -10651,8 +10558,7 @@ var OverlayLayer = () => {
|
|
|
10651
10558
|
if (e.target.value !== "0") {
|
|
10652
10559
|
layerStore.setSelectedLayer(e.target.value);
|
|
10653
10560
|
setShowLayerOpacity(true);
|
|
10654
|
-
if (layerStore.layerOpacity == 0)
|
|
10655
|
-
layerStore.setLayerOpacity(0.4);
|
|
10561
|
+
if (layerStore.layerOpacity == 0) layerStore.setLayerOpacity(0.4);
|
|
10656
10562
|
} else {
|
|
10657
10563
|
setShowLayerOpacity(false);
|
|
10658
10564
|
layerStore.setSelectedLayer("");
|
|
@@ -10679,12 +10585,12 @@ var OverlayLayer = () => {
|
|
|
10679
10585
|
|
|
10680
10586
|
// src/Components/Map/BasicMap.tsx
|
|
10681
10587
|
var import_leaflet10 = require("leaflet/dist/leaflet.css");
|
|
10682
|
-
var
|
|
10588
|
+
var import_react36 = require("react");
|
|
10683
10589
|
var import_react_leaflet15 = require("react-leaflet");
|
|
10684
|
-
var
|
|
10590
|
+
var import_core22 = require("@geowiki/core");
|
|
10685
10591
|
|
|
10686
10592
|
// src/Components/Map/LayerList.tsx
|
|
10687
|
-
var
|
|
10593
|
+
var import_react24 = require("react");
|
|
10688
10594
|
|
|
10689
10595
|
// src/store/baseLayerStore.ts
|
|
10690
10596
|
var import_zustand5 = require("zustand");
|
|
@@ -10697,7 +10603,7 @@ var useBaseLayerStore = (0, import_zustand5.create)((set) => ({
|
|
|
10697
10603
|
var import_react_leaflet12 = require("react-leaflet");
|
|
10698
10604
|
|
|
10699
10605
|
// src/utils/BingLayer.ts
|
|
10700
|
-
var
|
|
10606
|
+
var import_core17 = require("@react-leaflet/core");
|
|
10701
10607
|
|
|
10702
10608
|
// src/utils/LeafletBing.ts
|
|
10703
10609
|
var L13 = __toESM(require("leaflet"));
|
|
@@ -10715,10 +10621,8 @@ var BingLayer = class extends L13.TileLayer {
|
|
|
10715
10621
|
for (let i = z4; i > 0; i--) {
|
|
10716
10622
|
let digit = 0;
|
|
10717
10623
|
const mask = 1 << i - 1;
|
|
10718
|
-
if ((x & mask) !== 0)
|
|
10719
|
-
|
|
10720
|
-
if ((y & mask) !== 0)
|
|
10721
|
-
digit += 2;
|
|
10624
|
+
if ((x & mask) !== 0) digit += 1;
|
|
10625
|
+
if ((y & mask) !== 0) digit += 2;
|
|
10722
10626
|
quad = quad + digit;
|
|
10723
10627
|
}
|
|
10724
10628
|
return quad;
|
|
@@ -10732,8 +10636,7 @@ var BingLayer = class extends L13.TileLayer {
|
|
|
10732
10636
|
}
|
|
10733
10637
|
loadMetadata() {
|
|
10734
10638
|
var _a;
|
|
10735
|
-
if (this.metaRequested)
|
|
10736
|
-
return;
|
|
10639
|
+
if (this.metaRequested) return;
|
|
10737
10640
|
this.metaRequested = true;
|
|
10738
10641
|
const _this = this;
|
|
10739
10642
|
const cbid = "_bing_metadata_" + L13.Util.stamp(this);
|
|
@@ -10741,8 +10644,7 @@ var BingLayer = class extends L13.TileLayer {
|
|
|
10741
10644
|
var _a2;
|
|
10742
10645
|
window[cbid] = void 0;
|
|
10743
10646
|
const e = document.getElementById(cbid);
|
|
10744
|
-
if (e)
|
|
10745
|
-
(_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
|
|
10647
|
+
if (e) (_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
|
|
10746
10648
|
if (meta.errorDetails) {
|
|
10747
10649
|
console.log(meta.errorDetails);
|
|
10748
10650
|
return;
|
|
@@ -10786,8 +10688,7 @@ var BingLayer = class extends L13.TileLayer {
|
|
|
10786
10688
|
this._update();
|
|
10787
10689
|
}
|
|
10788
10690
|
_update() {
|
|
10789
|
-
if (this._url === null || !this._map)
|
|
10790
|
-
return;
|
|
10691
|
+
if (this._url === null || !this._map) return;
|
|
10791
10692
|
this._update_attribution();
|
|
10792
10693
|
super._update();
|
|
10793
10694
|
}
|
|
@@ -10824,7 +10725,7 @@ var BingLayer = class extends L13.TileLayer {
|
|
|
10824
10725
|
};
|
|
10825
10726
|
|
|
10826
10727
|
// src/utils/BingLayer.ts
|
|
10827
|
-
var BingLeafletLayer = (0,
|
|
10728
|
+
var BingLeafletLayer = (0, import_core17.createLayerComponent)(function createBingLayer(_a, context) {
|
|
10828
10729
|
var _b = _a, { apiKey } = _b, options = __objRest(_b, ["apiKey"]);
|
|
10829
10730
|
const instance = new BingLayer(apiKey, options);
|
|
10830
10731
|
return {
|
|
@@ -10917,7 +10818,7 @@ var BaseLayer = ({ layerName }) => {
|
|
|
10917
10818
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
10918
10819
|
var LayerList = ({ selectedLayer }) => {
|
|
10919
10820
|
const storeSelectedLayer = useBaseLayerStore((state) => state.selectedLayer);
|
|
10920
|
-
(0,
|
|
10821
|
+
(0, import_react24.useEffect)(() => {
|
|
10921
10822
|
if (selectedLayer) {
|
|
10922
10823
|
useBaseLayerStore.setState({ selectedLayer });
|
|
10923
10824
|
}
|
|
@@ -10949,8 +10850,7 @@ var useMapControlStore = (0, import_zustand6.create)((set) => ({
|
|
|
10949
10850
|
})),
|
|
10950
10851
|
toggleControlOpen: (id) => set((state) => {
|
|
10951
10852
|
const targetControl = state.controls.find((c) => c.id === id);
|
|
10952
|
-
if (!targetControl)
|
|
10953
|
-
return state;
|
|
10853
|
+
if (!targetControl) return state;
|
|
10954
10854
|
const targetPosition = targetControl.position;
|
|
10955
10855
|
const shouldOpenTarget = !targetControl.isOpen;
|
|
10956
10856
|
const updatedControls = state.controls.map((control) => {
|
|
@@ -10979,10 +10879,10 @@ var useMapControlActions = () => useMapControlStore(
|
|
|
10979
10879
|
);
|
|
10980
10880
|
|
|
10981
10881
|
// src/Components/Map/BasicMapControlList.tsx
|
|
10982
|
-
var
|
|
10882
|
+
var import_react31 = require("react");
|
|
10983
10883
|
|
|
10984
10884
|
// src/Components/Controls/Legend.tsx
|
|
10985
|
-
var
|
|
10885
|
+
var import_react25 = require("react");
|
|
10986
10886
|
var import_ui18 = require("@geowiki/ui");
|
|
10987
10887
|
|
|
10988
10888
|
// src/Components/Basf/GeoServerLegend.tsx
|
|
@@ -11136,7 +11036,7 @@ var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
|
11136
11036
|
var constructLegendUrl = (baseUrl, layer, format, style) => {
|
|
11137
11037
|
return `${baseUrl}?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=${format}&LAYER=${layer}&STYLE=${style}&legend_options=dpi:150`;
|
|
11138
11038
|
};
|
|
11139
|
-
var fetchLegendData = (baseUrl, layerName, format, style) => __async(
|
|
11039
|
+
var fetchLegendData = (baseUrl, layerName, format, style) => __async(null, null, function* () {
|
|
11140
11040
|
const legendGraphicUrl = constructLegendUrl(
|
|
11141
11041
|
baseUrl,
|
|
11142
11042
|
layerName,
|
|
@@ -11315,7 +11215,7 @@ var CustomLegend = ({ layer }) => {
|
|
|
11315
11215
|
};
|
|
11316
11216
|
|
|
11317
11217
|
// src/Components/Controls/Legend.tsx
|
|
11318
|
-
var
|
|
11218
|
+
var import_core18 = require("@dnd-kit/core");
|
|
11319
11219
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
11320
11220
|
var import_utilities = require("@dnd-kit/utilities");
|
|
11321
11221
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
@@ -11324,7 +11224,7 @@ var import_ui20 = require("@geowiki/ui");
|
|
|
11324
11224
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11325
11225
|
var OpacityControl = ({ layer, onClose }) => {
|
|
11326
11226
|
const { updateOpacity } = mapLayers_default();
|
|
11327
|
-
const [opacity, setOpacity] = (0,
|
|
11227
|
+
const [opacity, setOpacity] = (0, import_react25.useState)(layer.opacity || 100);
|
|
11328
11228
|
const handleOpacityChange = (e) => {
|
|
11329
11229
|
const newOpacity = parseFloat(e.target.value);
|
|
11330
11230
|
setOpacity(newOpacity);
|
|
@@ -11427,7 +11327,7 @@ var SortableLayerItem = ({ layer, id, isOneLegend }) => {
|
|
|
11427
11327
|
disabled: isOneLegend || !(layer == null ? void 0 : layer.layerName)
|
|
11428
11328
|
});
|
|
11429
11329
|
const { remove } = mapLayers_default();
|
|
11430
|
-
const [popoverOpen, setPopoverOpen] = (0,
|
|
11330
|
+
const [popoverOpen, setPopoverOpen] = (0, import_react25.useState)(false);
|
|
11431
11331
|
const style = {
|
|
11432
11332
|
transform: import_utilities.CSS.Transform.toString(transform),
|
|
11433
11333
|
transition
|
|
@@ -11528,26 +11428,26 @@ var SortableLayerItem = ({ layer, id, isOneLegend }) => {
|
|
|
11528
11428
|
};
|
|
11529
11429
|
var Legend = () => {
|
|
11530
11430
|
const { layers, reorderLayers } = mapLayers_default();
|
|
11531
|
-
const [isLoading, setIsLoading] = (0,
|
|
11532
|
-
const [isOneLegend, setIsOneLegend] = (0,
|
|
11533
|
-
const sensors = (0,
|
|
11534
|
-
(0,
|
|
11535
|
-
(0,
|
|
11431
|
+
const [isLoading, setIsLoading] = (0, import_react25.useState)(true);
|
|
11432
|
+
const [isOneLegend, setIsOneLegend] = (0, import_react25.useState)(false);
|
|
11433
|
+
const sensors = (0, import_core18.useSensors)(
|
|
11434
|
+
(0, import_core18.useSensor)(import_core18.PointerSensor),
|
|
11435
|
+
(0, import_core18.useSensor)(import_core18.KeyboardSensor, {
|
|
11536
11436
|
coordinateGetter: import_sortable2.sortableKeyboardCoordinates
|
|
11537
11437
|
}),
|
|
11538
|
-
(0,
|
|
11438
|
+
(0, import_core18.useSensor)(import_core18.TouchSensor, {
|
|
11539
11439
|
activationConstraint: {
|
|
11540
11440
|
delay: 250,
|
|
11541
11441
|
tolerance: 10
|
|
11542
11442
|
}
|
|
11543
11443
|
})
|
|
11544
11444
|
);
|
|
11545
|
-
(0,
|
|
11445
|
+
(0, import_react25.useEffect)(() => {
|
|
11546
11446
|
if (Array.isArray(layers)) {
|
|
11547
11447
|
setIsLoading(false);
|
|
11548
11448
|
}
|
|
11549
11449
|
}, [layers]);
|
|
11550
|
-
(0,
|
|
11450
|
+
(0, import_react25.useEffect)(() => {
|
|
11551
11451
|
if (layers.length === 1) {
|
|
11552
11452
|
setIsOneLegend(true);
|
|
11553
11453
|
} else {
|
|
@@ -11576,10 +11476,10 @@ var Legend = () => {
|
|
|
11576
11476
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: " text-base font-medium leading-[120%] max-w-[280px]", children: "There are currently no active layers." });
|
|
11577
11477
|
}
|
|
11578
11478
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "max-h-[60vh] overflow-y-auto space-y-3", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
11579
|
-
|
|
11479
|
+
import_core18.DndContext,
|
|
11580
11480
|
{
|
|
11581
11481
|
sensors,
|
|
11582
|
-
collisionDetection:
|
|
11482
|
+
collisionDetection: import_core18.closestCenter,
|
|
11583
11483
|
onDragEnd: isOneLegend ? void 0 : handleDragEnd,
|
|
11584
11484
|
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
11585
11485
|
import_sortable2.SortableContext,
|
|
@@ -11602,9 +11502,9 @@ var Legend = () => {
|
|
|
11602
11502
|
};
|
|
11603
11503
|
|
|
11604
11504
|
// src/Components/Controls/CustomBaseLayerControl.tsx
|
|
11605
|
-
var
|
|
11505
|
+
var import_react26 = require("react");
|
|
11606
11506
|
var import_image3 = __toESM(require("next/image"));
|
|
11607
|
-
var
|
|
11507
|
+
var import_core19 = require("@geowiki/core");
|
|
11608
11508
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11609
11509
|
var BASE_LAYERS = [
|
|
11610
11510
|
{
|
|
@@ -11658,11 +11558,11 @@ var LayerButton = ({
|
|
|
11658
11558
|
);
|
|
11659
11559
|
var CustomBaseLayerControl = () => {
|
|
11660
11560
|
const { selectedLayer, setSelectedLayer } = useBaseLayerStore();
|
|
11661
|
-
const [showAll, setShowAll] = (0,
|
|
11561
|
+
const [showAll, setShowAll] = (0, import_react26.useState)(false);
|
|
11662
11562
|
const visibleLayers = showAll ? BASE_LAYERS : BASE_LAYERS.slice(0, 3);
|
|
11663
11563
|
const handleLayerChange = (layerName) => {
|
|
11664
11564
|
setSelectedLayer(layerName);
|
|
11665
|
-
|
|
11565
|
+
import_core19.trackMapEvent.baseLayerChange(layerName);
|
|
11666
11566
|
};
|
|
11667
11567
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
|
|
11668
11568
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "hidden lg:grid lg:grid-cols-4 lg:gap-x-1 lg:gap-y-2", children: [
|
|
@@ -11720,17 +11620,17 @@ var CustomBaseLayerControl = () => {
|
|
|
11720
11620
|
};
|
|
11721
11621
|
|
|
11722
11622
|
// src/Components/Controls/LayerSwitcher.tsx
|
|
11723
|
-
var
|
|
11724
|
-
var
|
|
11623
|
+
var import_react27 = require("react");
|
|
11624
|
+
var import_core20 = require("@geowiki/core");
|
|
11725
11625
|
var import_ui21 = require("@geowiki/ui");
|
|
11726
|
-
var
|
|
11727
|
-
var
|
|
11626
|
+
var import_react28 = require("@headlessui/react");
|
|
11627
|
+
var import_react29 = require("react");
|
|
11728
11628
|
var import_outline = require("@heroicons/react/24/outline");
|
|
11729
|
-
var
|
|
11629
|
+
var import_react30 = require("@headlessui/react");
|
|
11730
11630
|
var import_lucide_react3 = require("lucide-react");
|
|
11731
11631
|
var import_uuid2 = require("uuid");
|
|
11732
11632
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11733
|
-
var LayerInfoIcon = (0,
|
|
11633
|
+
var LayerInfoIcon = (0, import_react27.memo)(({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
11734
11634
|
"svg",
|
|
11735
11635
|
{
|
|
11736
11636
|
width: "20",
|
|
@@ -11755,7 +11655,7 @@ var LayerInfoIcon = (0, import_react28.memo)(({ onClick }) => /* @__PURE__ */ (0
|
|
|
11755
11655
|
}
|
|
11756
11656
|
));
|
|
11757
11657
|
LayerInfoIcon.displayName = "LayerInfoIcon";
|
|
11758
|
-
var LayerItemInfo = (0,
|
|
11658
|
+
var LayerItemInfo = (0, import_react27.memo)(({ layer, open, setOpen }) => {
|
|
11759
11659
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
11760
11660
|
const isCustomLayer = "isCustom" in layer && layer.isCustom;
|
|
11761
11661
|
const mapDetails = [
|
|
@@ -11794,11 +11694,11 @@ var LayerItemInfo = (0, import_react28.memo)(({ layer, open, setOpen }) => {
|
|
|
11794
11694
|
{ label: "Custom Layer", value: "Yes" }
|
|
11795
11695
|
] : []
|
|
11796
11696
|
];
|
|
11797
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react28.Transition.Root, { show: open, as: import_react29.Fragment, "data-component": "ResourceView", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react28.Dialog, { as: "div", className: "relative z-20", onClose: setOpen, children: [
|
|
11798
11698
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11799
|
-
|
|
11699
|
+
import_react28.Transition.Child,
|
|
11800
11700
|
{
|
|
11801
|
-
as:
|
|
11701
|
+
as: import_react29.Fragment,
|
|
11802
11702
|
enter: "ease-out duration-300",
|
|
11803
11703
|
enterFrom: "opacity-0",
|
|
11804
11704
|
enterTo: "opacity-100",
|
|
@@ -11809,16 +11709,16 @@ var LayerItemInfo = (0, import_react28.memo)(({ layer, open, setOpen }) => {
|
|
|
11809
11709
|
}
|
|
11810
11710
|
),
|
|
11811
11711
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "fixed z-10 inset-0 overflow-y-auto text-black", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex items-end sm:items-center justify-center min-h-full text-center lg:p-4", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11812
|
-
|
|
11712
|
+
import_react28.Transition.Child,
|
|
11813
11713
|
{
|
|
11814
|
-
as:
|
|
11714
|
+
as: import_react29.Fragment,
|
|
11815
11715
|
enter: "ease-out duration-300",
|
|
11816
11716
|
enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
11817
11717
|
enterTo: "opacity-100 translate-y-0 sm:scale-100",
|
|
11818
11718
|
leave: "ease-in duration-200",
|
|
11819
11719
|
leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
|
|
11820
11720
|
leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
11821
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
11721
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react28.Dialog.Panel, { className: "w-screen relative bg-white rounded-t-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all lg:rounded-lg sm:my-8 sm:w-[740px] sm:p-10", children: [
|
|
11822
11722
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "absolute top-0 right-0 pt-3 pr-3 lg:pt-10 lg:pr-10", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
11823
11723
|
"button",
|
|
11824
11724
|
{
|
|
@@ -11856,7 +11756,7 @@ var LayerItemInfo = (0, import_react28.memo)(({ layer, open, setOpen }) => {
|
|
|
11856
11756
|
] }) });
|
|
11857
11757
|
});
|
|
11858
11758
|
LayerItemInfo.displayName = "LayerItemInfo";
|
|
11859
|
-
var LayerItem = (0,
|
|
11759
|
+
var LayerItem = (0, import_react27.memo)(
|
|
11860
11760
|
({
|
|
11861
11761
|
layer,
|
|
11862
11762
|
isActive,
|
|
@@ -11865,7 +11765,7 @@ var LayerItem = (0, import_react28.memo)(
|
|
|
11865
11765
|
onInfoClick
|
|
11866
11766
|
}) => {
|
|
11867
11767
|
var _a;
|
|
11868
|
-
const [open, setOpen] = (0,
|
|
11768
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
11869
11769
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("li", { className: "bg-white rounded-xl p-4 lg:w-[310px] lg:p-0", children: [
|
|
11870
11770
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-row justify-between items-center", children: [
|
|
11871
11771
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-row justify-start items-center space-x-2", children: [
|
|
@@ -11915,28 +11815,26 @@ var LayerItem = (0, import_react28.memo)(
|
|
|
11915
11815
|
}
|
|
11916
11816
|
);
|
|
11917
11817
|
LayerItem.displayName = "LayerItem";
|
|
11918
|
-
var LayerSwitcher = (0,
|
|
11919
|
-
const { data: mapMenuItems, error, isLoading } = (0,
|
|
11818
|
+
var LayerSwitcher = (0, import_react27.memo)(() => {
|
|
11819
|
+
const { data: mapMenuItems, error, isLoading } = (0, import_core20.useMapMenuItems)();
|
|
11920
11820
|
const store = mapLayers_default();
|
|
11921
11821
|
const { customLayers } = useCustomLayerStore();
|
|
11922
11822
|
console.log("customLayers from layerSwitcher", customLayers);
|
|
11923
|
-
const [openHoverCardId, setOpenHoverCardId] = (0,
|
|
11924
|
-
const handleToggle = (0,
|
|
11823
|
+
const [openHoverCardId, setOpenHoverCardId] = (0, import_react27.useState)(null);
|
|
11824
|
+
const handleToggle = (0, import_react27.useCallback)(
|
|
11925
11825
|
(layer) => {
|
|
11926
11826
|
store.layers.findIndex((l) => l.id === layer.id) !== -1 ? store.remove(layer) : store.add(layer);
|
|
11927
11827
|
},
|
|
11928
11828
|
[store]
|
|
11929
11829
|
);
|
|
11930
|
-
const handleInfoClick = (0,
|
|
11830
|
+
const handleInfoClick = (0, import_react27.useCallback)(
|
|
11931
11831
|
(id) => {
|
|
11932
11832
|
setOpenHoverCardId(openHoverCardId === id ? null : id);
|
|
11933
11833
|
},
|
|
11934
11834
|
[openHoverCardId]
|
|
11935
11835
|
);
|
|
11936
|
-
if (error)
|
|
11937
|
-
|
|
11938
|
-
if (isLoading)
|
|
11939
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: "Loading layers..." });
|
|
11836
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: "Error loading map layers" });
|
|
11837
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: "Loading layers..." });
|
|
11940
11838
|
const mapMenus = parseMapMenuItems(mapMenuItems);
|
|
11941
11839
|
const hasRegularLayers = (mapMenus == null ? void 0 : mapMenus.length) > 0;
|
|
11942
11840
|
const hasCustomLayers = customLayers.length > 0;
|
|
@@ -11948,14 +11846,14 @@ var LayerSwitcher = (0, import_react28.memo)(() => {
|
|
|
11948
11846
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
|
|
11949
11847
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "hidden lg:block", children: [
|
|
11950
11848
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11951
|
-
|
|
11849
|
+
import_react30.Disclosure,
|
|
11952
11850
|
{
|
|
11953
11851
|
"data-component": menu.title,
|
|
11954
11852
|
defaultOpen: mapMenus.length === 1,
|
|
11955
11853
|
children: ({ open }) => {
|
|
11956
11854
|
var _a2;
|
|
11957
11855
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
11958
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
11856
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react30.Disclosure.Button, { className: "w-[310px] flex-row flex justify-between items-center gap-2 border-zinc-300 ", children: [
|
|
11959
11857
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-sm font-normal uppercase text-grey leading-[130%]", children: menu.title }),
|
|
11960
11858
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11961
11859
|
import_lucide_react3.ChevronDown,
|
|
@@ -11965,7 +11863,7 @@ var LayerSwitcher = (0, import_react28.memo)(() => {
|
|
|
11965
11863
|
}
|
|
11966
11864
|
)
|
|
11967
11865
|
] }),
|
|
11968
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11866
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react30.Disclosure.Panel, { className: "space-y-2", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("ul", { className: "pt-2 space-y-2", children: [
|
|
11969
11867
|
index === 0 && hasCustomLayers && customLayers.map((layer) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11970
11868
|
LayerItem,
|
|
11971
11869
|
{
|
|
@@ -12038,7 +11936,7 @@ var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
|
12038
11936
|
var BasicMapControlList = () => {
|
|
12039
11937
|
const setControls = useMapControlStore((state) => state.setControls);
|
|
12040
11938
|
const map = (0, import_react_leaflet14.useMap)();
|
|
12041
|
-
(0,
|
|
11939
|
+
(0, import_react31.useEffect)(() => {
|
|
12042
11940
|
setControls([
|
|
12043
11941
|
{
|
|
12044
11942
|
id: "basemap",
|
|
@@ -12093,13 +11991,13 @@ var BasicMapControlList = () => {
|
|
|
12093
11991
|
};
|
|
12094
11992
|
|
|
12095
11993
|
// src/Components/Controls/MapControlContainer.tsx
|
|
12096
|
-
var
|
|
11994
|
+
var import_react35 = __toESM(require("react"));
|
|
12097
11995
|
var Popover5 = __toESM(require("@radix-ui/react-popover"));
|
|
12098
11996
|
|
|
12099
11997
|
// src/Components/Controls/ControlComponents.tsx
|
|
12100
|
-
var
|
|
11998
|
+
var import_react32 = __toESM(require("react"));
|
|
12101
11999
|
var Popover4 = __toESM(require("@radix-ui/react-popover"));
|
|
12102
|
-
var
|
|
12000
|
+
var import_core21 = require("@geowiki/core");
|
|
12103
12001
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
12104
12002
|
var ControlPanel = ({
|
|
12105
12003
|
title,
|
|
@@ -12123,7 +12021,7 @@ var ControlPanel = ({
|
|
|
12123
12021
|
}
|
|
12124
12022
|
) });
|
|
12125
12023
|
};
|
|
12126
|
-
var SimpleControlButton =
|
|
12024
|
+
var SimpleControlButton = import_react32.default.forwardRef(
|
|
12127
12025
|
({
|
|
12128
12026
|
icon: Icon3,
|
|
12129
12027
|
isActive = false,
|
|
@@ -12131,7 +12029,7 @@ var SimpleControlButton = import_react33.default.forwardRef(
|
|
|
12131
12029
|
buttonName = "unknown_simple_button"
|
|
12132
12030
|
}, ref) => {
|
|
12133
12031
|
const handleClick = (event) => {
|
|
12134
|
-
|
|
12032
|
+
import_core21.trackUserEvent.mapControlClick(
|
|
12135
12033
|
buttonName,
|
|
12136
12034
|
isActive ? "active" : "inactive"
|
|
12137
12035
|
);
|
|
@@ -12153,8 +12051,8 @@ var SimpleControlButton = import_react33.default.forwardRef(
|
|
|
12153
12051
|
SimpleControlButton.displayName = "SimpleControlButton";
|
|
12154
12052
|
|
|
12155
12053
|
// src/Components/Controls/MobileControlPanel.tsx
|
|
12156
|
-
var
|
|
12157
|
-
var
|
|
12054
|
+
var import_react33 = require("react");
|
|
12055
|
+
var import_react34 = require("@headlessui/react");
|
|
12158
12056
|
var import_ui23 = require("@geowiki/ui");
|
|
12159
12057
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
12160
12058
|
var MobileControlPanel = ({
|
|
@@ -12165,16 +12063,16 @@ var MobileControlPanel = ({
|
|
|
12165
12063
|
isFilter
|
|
12166
12064
|
}) => {
|
|
12167
12065
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12168
|
-
|
|
12066
|
+
import_react34.Transition.Root,
|
|
12169
12067
|
{
|
|
12170
12068
|
show,
|
|
12171
|
-
as:
|
|
12069
|
+
as: import_react33.Fragment,
|
|
12172
12070
|
"data-component": "PreviewClusterNews",
|
|
12173
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react34.Dialog, { as: "div", className: "relative z-10", onClose, children: [
|
|
12174
12072
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12175
|
-
|
|
12073
|
+
import_react34.Transition.Child,
|
|
12176
12074
|
{
|
|
12177
|
-
as:
|
|
12075
|
+
as: import_react33.Fragment,
|
|
12178
12076
|
enter: "ease-out duration-300",
|
|
12179
12077
|
enterFrom: "opacity-0",
|
|
12180
12078
|
enterTo: "opacity-100",
|
|
@@ -12185,9 +12083,9 @@ var MobileControlPanel = ({
|
|
|
12185
12083
|
}
|
|
12186
12084
|
),
|
|
12187
12085
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "fixed z-10 inset-0 overflow-y-auto text-black", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex items-end sm:items-center justify-center min-h-full p-4 text-center sm:p-0", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12188
|
-
|
|
12086
|
+
import_react34.Transition.Child,
|
|
12189
12087
|
{
|
|
12190
|
-
as:
|
|
12088
|
+
as: import_react33.Fragment,
|
|
12191
12089
|
enter: "ease-out duration-300",
|
|
12192
12090
|
enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
12193
12091
|
enterTo: "opacity-100 translate-y-0 sm:scale-100",
|
|
@@ -12195,7 +12093,7 @@ var MobileControlPanel = ({
|
|
|
12195
12093
|
leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
|
|
12196
12094
|
leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
12197
12095
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12198
|
-
|
|
12096
|
+
import_react34.Dialog.Panel,
|
|
12199
12097
|
{
|
|
12200
12098
|
className: `lg:hidden w-screen absolute bottom-0 pt-5 pb-4 bg-white text-left overflow-hidden shadow-xl transform transition-all ${isFilter ? " bg-grey-lightest max-h-max" : "p-4 rounded-t-lg "} `,
|
|
12201
12099
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: " overflow-y-auto max-h-[calc(100dvh-2rem)]", children: [
|
|
@@ -12278,9 +12176,9 @@ var POSITION_CLASSES2 = {
|
|
|
12278
12176
|
topleft: "leaflet-top leaflet-left",
|
|
12279
12177
|
topright: "leaflet-top leaflet-right"
|
|
12280
12178
|
};
|
|
12281
|
-
var ControlItem = (0,
|
|
12179
|
+
var ControlItem = (0, import_react35.memo)(({ control, position }) => {
|
|
12282
12180
|
const { toggleControlOpen } = useMapControlActions();
|
|
12283
|
-
const handleToggleControl = (0,
|
|
12181
|
+
const handleToggleControl = (0, import_react35.useCallback)(() => {
|
|
12284
12182
|
toggleControlOpen(control.id);
|
|
12285
12183
|
}, [toggleControlOpen, control.id]);
|
|
12286
12184
|
if (control.isDisplayOnly) {
|
|
@@ -12385,7 +12283,7 @@ var ControlItem = (0, import_react36.memo)(({ control, position }) => {
|
|
|
12385
12283
|
] });
|
|
12386
12284
|
});
|
|
12387
12285
|
ControlItem.displayName = "ControlItem";
|
|
12388
|
-
var PositionGroup = (0,
|
|
12286
|
+
var PositionGroup = (0, import_react35.memo)(({ position, className, controls }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "leaflet-control m-4", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "flex flex-col space-y-2", children: controls.map((control) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { id: `${control.id}`, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
12389
12287
|
ControlItem,
|
|
12390
12288
|
{
|
|
12391
12289
|
control,
|
|
@@ -12393,9 +12291,9 @@ var PositionGroup = (0, import_react36.memo)(({ position, className, controls })
|
|
|
12393
12291
|
}
|
|
12394
12292
|
) }, control.id)) }) }) }));
|
|
12395
12293
|
PositionGroup.displayName = "PositionGroup";
|
|
12396
|
-
var MapControlContainer = (0,
|
|
12294
|
+
var MapControlContainer = (0, import_react35.memo)(() => {
|
|
12397
12295
|
const controls = useMapControls();
|
|
12398
|
-
const controlsByPosition =
|
|
12296
|
+
const controlsByPosition = import_react35.default.useMemo(() => {
|
|
12399
12297
|
const grouped = {};
|
|
12400
12298
|
controls.forEach((control) => {
|
|
12401
12299
|
if (!grouped[control.position]) {
|
|
@@ -12407,8 +12305,7 @@ var MapControlContainer = (0, import_react36.memo)(() => {
|
|
|
12407
12305
|
}, [controls]);
|
|
12408
12306
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_ui24.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx_runtime50.Fragment, { children: Object.entries(POSITION_CLASSES2).map(([position, className]) => {
|
|
12409
12307
|
const positionControls = controlsByPosition[position] || [];
|
|
12410
|
-
if (positionControls.length === 0)
|
|
12411
|
-
return null;
|
|
12308
|
+
if (positionControls.length === 0) return null;
|
|
12412
12309
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
12413
12310
|
PositionGroup,
|
|
12414
12311
|
{
|
|
@@ -12428,15 +12325,14 @@ var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
|
12428
12325
|
var BasicMap = () => {
|
|
12429
12326
|
var _a, _b, _c, _d, _e, _f;
|
|
12430
12327
|
const { data: mapSettings, isLoading: isSettingsLoading } = (0, import_useMapSettings.default)();
|
|
12431
|
-
const mapRef = (0,
|
|
12328
|
+
const mapRef = (0, import_react36.useRef)(null);
|
|
12432
12329
|
var zoom = ((_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) || 12;
|
|
12433
12330
|
var center4 = [
|
|
12434
12331
|
((_d = (_c = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _c.Latitude) == null ? void 0 : _d.Text) || 48.2082,
|
|
12435
12332
|
((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
|
|
12436
12333
|
];
|
|
12437
|
-
(0,
|
|
12438
|
-
if (isSettingsLoading)
|
|
12439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_ui25.LoaderFull, {});
|
|
12334
|
+
(0, import_core22.useRenderInfo)("BasicMap");
|
|
12335
|
+
if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_ui25.LoaderFull, {});
|
|
12440
12336
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
12441
12337
|
import_react_leaflet15.MapContainer,
|
|
12442
12338
|
{
|
|
@@ -12466,26 +12362,26 @@ var BasicMap = () => {
|
|
|
12466
12362
|
|
|
12467
12363
|
// src/Components/Map/BasfMap.tsx
|
|
12468
12364
|
var import_leaflet14 = require("leaflet/dist/leaflet.css");
|
|
12469
|
-
var
|
|
12365
|
+
var import_react46 = require("react");
|
|
12470
12366
|
var import_react_leaflet19 = require("react-leaflet");
|
|
12471
12367
|
var import_useMapSettings2 = __toESM(require("@geowiki/core/src/hooks/useMapSettings"));
|
|
12472
12368
|
var import_ui33 = require("@geowiki/ui");
|
|
12473
12369
|
|
|
12474
12370
|
// src/Components/Basf/BasfLayerList.tsx
|
|
12475
|
-
var
|
|
12371
|
+
var import_core24 = require("@geowiki/core");
|
|
12476
12372
|
|
|
12477
12373
|
// src/utils/WmsWithFilter.ts
|
|
12478
|
-
var
|
|
12479
|
-
var WMSWithFilterTileLayer = (0,
|
|
12374
|
+
var import_core23 = require("@react-leaflet/core");
|
|
12375
|
+
var WMSWithFilterTileLayer = (0, import_core23.createTileLayerComponent)(
|
|
12480
12376
|
function createWMSTileLayer2(_a, context) {
|
|
12481
12377
|
var _b = _a, { eventHandlers: _eh, params = {}, url } = _b, props = __objRest(_b, ["eventHandlers", "params", "url"]);
|
|
12482
12378
|
const layer = new BetterWMS(url, __spreadValues(__spreadProps(__spreadValues({}, params), {
|
|
12483
12379
|
url
|
|
12484
12380
|
}), props));
|
|
12485
|
-
return (0,
|
|
12381
|
+
return (0, import_core23.createElementObject)(layer, context);
|
|
12486
12382
|
},
|
|
12487
12383
|
function updateWMSTileLayer2(layer, props, prevProps) {
|
|
12488
|
-
(0,
|
|
12384
|
+
(0, import_core23.updateGridLayer)(layer, props, prevProps);
|
|
12489
12385
|
if (props.params && props.params !== prevProps.params) {
|
|
12490
12386
|
layer.setParams(props.params);
|
|
12491
12387
|
}
|
|
@@ -12493,7 +12389,7 @@ var WMSWithFilterTileLayer = (0, import_core22.createTileLayerComponent)(
|
|
|
12493
12389
|
);
|
|
12494
12390
|
|
|
12495
12391
|
// src/Components/Basf/BasfMapLayer.tsx
|
|
12496
|
-
var
|
|
12392
|
+
var import_react37 = require("react");
|
|
12497
12393
|
|
|
12498
12394
|
// src/store/selectedPixel.ts
|
|
12499
12395
|
var import_zustand7 = __toESM(require("zustand"));
|
|
@@ -12504,8 +12400,7 @@ var useSelectedPixelStore = (0, import_zustand7.default)((set) => ({
|
|
|
12504
12400
|
set((state) => {
|
|
12505
12401
|
var _a;
|
|
12506
12402
|
const feat = (_a = geoJson.features[0]) == null ? void 0 : _a.id;
|
|
12507
|
-
if (!feat)
|
|
12508
|
-
return state;
|
|
12403
|
+
if (!feat) return state;
|
|
12509
12404
|
const existing = state.data.some(
|
|
12510
12405
|
(item) => item.features[0].id === geoJson.features[0].id
|
|
12511
12406
|
);
|
|
@@ -12535,14 +12430,14 @@ var BasfMapLayer = (layerInfo) => {
|
|
|
12535
12430
|
var geoServerUrl = "https://geoserver.iiasa.ac.at/geoserver/basf/wms?tiled=true";
|
|
12536
12431
|
var layerName = "basf:BASFwithAreas";
|
|
12537
12432
|
var cqlFilter = `ITEM='${layerInfo.item}' AND PRODUCT='${layerInfo.product}' AND PRICE='${layerInfo.price}' AND SCENARIO='${layerInfo.scenario}' AND Type='${layerInfo.formType}'`;
|
|
12538
|
-
const allowedProperties = (0,
|
|
12433
|
+
const allowedProperties = (0, import_react37.useMemo)(() => {
|
|
12539
12434
|
const properties = [];
|
|
12540
12435
|
const selectedYear = "Year_" + layerInfo.year;
|
|
12541
12436
|
properties.push(selectedYear);
|
|
12542
12437
|
return properties;
|
|
12543
12438
|
}, [layerInfo.year]);
|
|
12544
12439
|
const setData = useSelectedPixelStore.getState().setData;
|
|
12545
|
-
const memoedMapLayer = (0,
|
|
12440
|
+
const memoedMapLayer = (0, import_react37.useMemo)(() => {
|
|
12546
12441
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12547
12442
|
WMSWithFilterTileLayer,
|
|
12548
12443
|
{
|
|
@@ -12580,22 +12475,22 @@ var BasfMapLayer = (layerInfo) => {
|
|
|
12580
12475
|
// src/Components/Basf/BasfLayerList.tsx
|
|
12581
12476
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
12582
12477
|
var BasfLayerList = () => {
|
|
12583
|
-
const basfStore = (0,
|
|
12478
|
+
const basfStore = (0, import_core24.useBasfStore)();
|
|
12584
12479
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { children: basfStore.selectedItems.map((mapItem) => {
|
|
12585
12480
|
return mapItem.enabled ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BasfMapLayer, __spreadValues({}, mapItem), mapItem.id) : null;
|
|
12586
12481
|
}) });
|
|
12587
12482
|
};
|
|
12588
12483
|
|
|
12589
12484
|
// src/Components/Basf/SelectedPixelsLayer.tsx
|
|
12590
|
-
var
|
|
12485
|
+
var import_react38 = require("react");
|
|
12591
12486
|
var import_react_leaflet16 = require("react-leaflet");
|
|
12592
12487
|
var import_leaflet11 = __toESM(require("leaflet"));
|
|
12593
12488
|
var SelectedPixelsLayer = () => {
|
|
12594
12489
|
const { data } = useSelectedPixelStore();
|
|
12595
|
-
const layerRef = (0,
|
|
12490
|
+
const layerRef = (0, import_react38.useRef)(null);
|
|
12596
12491
|
const map = (0, import_react_leaflet16.useMap)();
|
|
12597
|
-
const prevDataRef = (0,
|
|
12598
|
-
(0,
|
|
12492
|
+
const prevDataRef = (0, import_react38.useRef)(data);
|
|
12493
|
+
(0, import_react38.useEffect)(() => {
|
|
12599
12494
|
if (!layerRef.current) {
|
|
12600
12495
|
layerRef.current = import_leaflet11.default.layerGroup().addTo(map);
|
|
12601
12496
|
}
|
|
@@ -12622,14 +12517,14 @@ var SelectedPixelsLayer = () => {
|
|
|
12622
12517
|
// src/Components/Map/BasfControlList.tsx
|
|
12623
12518
|
var import_react_leaflet18 = require("react-leaflet");
|
|
12624
12519
|
var import_lucide_react4 = require("lucide-react");
|
|
12625
|
-
var
|
|
12520
|
+
var import_react45 = require("react");
|
|
12626
12521
|
|
|
12627
12522
|
// src/Components/Basf/BasfLegend.tsx
|
|
12628
|
-
var
|
|
12523
|
+
var import_core25 = require("@geowiki/core");
|
|
12629
12524
|
|
|
12630
12525
|
// src/Components/Basf/BasfItemCard.tsx
|
|
12631
12526
|
var import_ui26 = require("@geowiki/ui");
|
|
12632
|
-
var
|
|
12527
|
+
var import_react39 = require("react");
|
|
12633
12528
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
12634
12529
|
var BasfItemCard = ({
|
|
12635
12530
|
item,
|
|
@@ -12639,12 +12534,12 @@ var BasfItemCard = ({
|
|
|
12639
12534
|
formatDisplayValue: formatDisplayValue2
|
|
12640
12535
|
}) => {
|
|
12641
12536
|
const { data, latesData, clearData } = useSelectedPixelStore();
|
|
12642
|
-
const [sumValues, setSumValues] = (0,
|
|
12643
|
-
const [value, setValue] = (0,
|
|
12644
|
-
const [area, setArea] = (0,
|
|
12645
|
-
const [sumAreas, setSumAreas] = (0,
|
|
12537
|
+
const [sumValues, setSumValues] = (0, import_react39.useState)(0);
|
|
12538
|
+
const [value, setValue] = (0, import_react39.useState)(null);
|
|
12539
|
+
const [area, setArea] = (0, import_react39.useState)(null);
|
|
12540
|
+
const [sumAreas, setSumAreas] = (0, import_react39.useState)(0);
|
|
12646
12541
|
const coefficient = 1e3;
|
|
12647
|
-
(0,
|
|
12542
|
+
(0, import_react39.useEffect)(() => {
|
|
12648
12543
|
const total = data.reduce((acc, geoJson) => {
|
|
12649
12544
|
var _a;
|
|
12650
12545
|
const properties = (_a = geoJson.features[0]) == null ? void 0 : _a.properties;
|
|
@@ -12670,7 +12565,7 @@ var BasfItemCard = ({
|
|
|
12670
12565
|
}, 0);
|
|
12671
12566
|
setSumAreas(totalArea);
|
|
12672
12567
|
}, [data]);
|
|
12673
|
-
(0,
|
|
12568
|
+
(0, import_react39.useEffect)(() => {
|
|
12674
12569
|
var _a;
|
|
12675
12570
|
if (latesData) {
|
|
12676
12571
|
const properties = (_a = latesData.features[0]) == null ? void 0 : _a.properties;
|
|
@@ -12786,10 +12681,10 @@ var formatDisplayValue = (value) => value.replace(/[_-]/g, " ").replace(
|
|
|
12786
12681
|
(txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
|
12787
12682
|
);
|
|
12788
12683
|
var BasfLegend = () => {
|
|
12789
|
-
const removeItem = (0,
|
|
12790
|
-
const updateItemOpacity = (0,
|
|
12791
|
-
const updateItemEnabled = (0,
|
|
12792
|
-
const selectedItems = (0,
|
|
12684
|
+
const removeItem = (0, import_core25.useBasfStore)((state) => state.removeItem);
|
|
12685
|
+
const updateItemOpacity = (0, import_core25.useBasfStore)((state) => state.updateItemOpacity);
|
|
12686
|
+
const updateItemEnabled = (0, import_core25.useBasfStore)((state) => state.updateItemEnabled);
|
|
12687
|
+
const selectedItems = (0, import_core25.useBasfStore)((state) => state.selectedItems);
|
|
12793
12688
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
12794
12689
|
"div",
|
|
12795
12690
|
{
|
|
@@ -12812,27 +12707,27 @@ var BasfLegend = () => {
|
|
|
12812
12707
|
var BasfLegend_default = BasfLegend;
|
|
12813
12708
|
|
|
12814
12709
|
// src/Components/Basf/BasfSelect.tsx
|
|
12815
|
-
var
|
|
12710
|
+
var import_react43 = require("react");
|
|
12816
12711
|
var import_ui30 = require("@geowiki/ui");
|
|
12817
12712
|
var import_react_hook_form3 = require("react-hook-form");
|
|
12818
12713
|
var z = __toESM(require("zod"));
|
|
12819
12714
|
var import_uuid3 = require("uuid");
|
|
12820
12715
|
var import_zod = require("@hookform/resolvers/zod");
|
|
12821
|
-
var
|
|
12716
|
+
var import_core26 = require("@geowiki/core");
|
|
12822
12717
|
|
|
12823
12718
|
// src/Components/Basf/basf-form.tsx
|
|
12824
|
-
var
|
|
12719
|
+
var import_react42 = require("react");
|
|
12825
12720
|
var import_ui29 = require("@geowiki/ui");
|
|
12826
12721
|
var import_react_hook_form2 = require("react-hook-form");
|
|
12827
12722
|
|
|
12828
12723
|
// src/Components/Basf/form-select.tsx
|
|
12829
|
-
var
|
|
12724
|
+
var import_react40 = require("react");
|
|
12830
12725
|
var import_ui27 = require("@geowiki/ui");
|
|
12831
12726
|
var import_react_hook_form = require("react-hook-form");
|
|
12832
12727
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
12833
|
-
var ForwardedSelect = (0,
|
|
12728
|
+
var ForwardedSelect = (0, import_react40.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_ui27.Select, __spreadProps(__spreadValues({}, props), { ref })));
|
|
12834
12729
|
ForwardedSelect.displayName = "ForwardedSelect";
|
|
12835
|
-
var FormSelect = (0,
|
|
12730
|
+
var FormSelect = (0, import_react40.memo)(
|
|
12836
12731
|
({ name, control, label, options, placeholder, errors }) => {
|
|
12837
12732
|
var _a;
|
|
12838
12733
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "space-y-2", children: [
|
|
@@ -12864,14 +12759,14 @@ FormSelect.displayName = "FormSelect";
|
|
|
12864
12759
|
var form_select_default = FormSelect;
|
|
12865
12760
|
|
|
12866
12761
|
// src/Components/Basf/price-slider.tsx
|
|
12867
|
-
var
|
|
12762
|
+
var import_react41 = require("react");
|
|
12868
12763
|
var import_ui28 = require("@geowiki/ui");
|
|
12869
12764
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
12870
|
-
var PriceSlider = (0,
|
|
12765
|
+
var PriceSlider = (0, import_react41.memo)(({ value, onChange, errors }) => {
|
|
12871
12766
|
var _a;
|
|
12872
|
-
const steps = (0,
|
|
12767
|
+
const steps = (0, import_react41.useMemo)(() => [20, 50, 100], []);
|
|
12873
12768
|
const valueIndex = steps.indexOf(Number(value));
|
|
12874
|
-
const handleValueChange = (0,
|
|
12769
|
+
const handleValueChange = (0, import_react41.useCallback)(
|
|
12875
12770
|
(val) => {
|
|
12876
12771
|
const newValue = steps[val[0]].toString();
|
|
12877
12772
|
onChange(newValue);
|
|
@@ -12923,7 +12818,7 @@ var BIOMASS_ITEMS = [
|
|
|
12923
12818
|
{ value: "economic_potential", label: "Economic potential" },
|
|
12924
12819
|
{ value: "un-used_economic_potential", label: "Un-used economic potential" }
|
|
12925
12820
|
];
|
|
12926
|
-
var BasfForm = (0,
|
|
12821
|
+
var BasfForm = (0, import_react42.memo)(
|
|
12927
12822
|
({
|
|
12928
12823
|
onSubmit,
|
|
12929
12824
|
control,
|
|
@@ -13115,15 +13010,15 @@ var formSchema = z.object({
|
|
|
13115
13010
|
}
|
|
13116
13011
|
).default("2020")
|
|
13117
13012
|
});
|
|
13118
|
-
var ForwardedSelect2 = (0,
|
|
13013
|
+
var ForwardedSelect2 = (0, import_react43.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_ui30.Select, __spreadProps(__spreadValues({}, props), { ref })));
|
|
13119
13014
|
ForwardedSelect2.displayName = "ForwardedSelect";
|
|
13120
13015
|
var BasfSelect = () => {
|
|
13121
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
13016
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react43.useState)(false);
|
|
13122
13017
|
const { clearData } = useSelectedPixelStore();
|
|
13123
|
-
const [isReset, setIsReset] = (0,
|
|
13124
|
-
const addItem = (0,
|
|
13125
|
-
const selectedItems = (0,
|
|
13126
|
-
(0,
|
|
13018
|
+
const [isReset, setIsReset] = (0, import_react43.useState)(false);
|
|
13019
|
+
const addItem = (0, import_core26.useBasfStore)((0, import_react43.useCallback)((state) => state.addItem, []));
|
|
13020
|
+
const selectedItems = (0, import_core26.useBasfStore)(
|
|
13021
|
+
(0, import_react43.useCallback)((state) => state.selectedItems, [])
|
|
13127
13022
|
);
|
|
13128
13023
|
const {
|
|
13129
13024
|
control,
|
|
@@ -13156,7 +13051,7 @@ var BasfSelect = () => {
|
|
|
13156
13051
|
{ key: "selectedItem", value: item },
|
|
13157
13052
|
{ key: "selectedYear", value: year }
|
|
13158
13053
|
];
|
|
13159
|
-
const checkIfItemExists = (0,
|
|
13054
|
+
const checkIfItemExists = (0, import_react43.useCallback)(
|
|
13160
13055
|
(data) => {
|
|
13161
13056
|
return selectedItems.some(
|
|
13162
13057
|
(item2) => item2.formType === data.formType && item2.scenario === data.scenario && item2.price === data.price && item2.product === data.product && item2.item === data.item && item2.year === data.year
|
|
@@ -13164,8 +13059,8 @@ var BasfSelect = () => {
|
|
|
13164
13059
|
},
|
|
13165
13060
|
[selectedItems]
|
|
13166
13061
|
);
|
|
13167
|
-
const onSubmit = (0,
|
|
13168
|
-
(data) => __async(
|
|
13062
|
+
const onSubmit = (0, import_react43.useCallback)(
|
|
13063
|
+
(data) => __async(null, null, function* () {
|
|
13169
13064
|
setIsSubmitting(true);
|
|
13170
13065
|
try {
|
|
13171
13066
|
if (checkIfItemExists(data)) {
|
|
@@ -13188,7 +13083,7 @@ var BasfSelect = () => {
|
|
|
13188
13083
|
}),
|
|
13189
13084
|
[checkIfItemExists, addItem]
|
|
13190
13085
|
);
|
|
13191
|
-
(0,
|
|
13086
|
+
(0, import_react43.useEffect)(() => {
|
|
13192
13087
|
if (!isReset) {
|
|
13193
13088
|
if (formType === "CropProduction") {
|
|
13194
13089
|
reset({
|
|
@@ -13212,14 +13107,14 @@ var BasfSelect = () => {
|
|
|
13212
13107
|
}
|
|
13213
13108
|
setIsReset(false);
|
|
13214
13109
|
}, [formType]);
|
|
13215
|
-
(0,
|
|
13110
|
+
(0, import_react43.useEffect)(() => {
|
|
13216
13111
|
formDataKeys.forEach(({ key, value }) => {
|
|
13217
13112
|
if (value) {
|
|
13218
13113
|
localStorage.setItem(key, value);
|
|
13219
13114
|
}
|
|
13220
13115
|
});
|
|
13221
13116
|
}, [formType, product, scenario, price, item, year]);
|
|
13222
|
-
(0,
|
|
13117
|
+
(0, import_react43.useEffect)(() => {
|
|
13223
13118
|
const formData = formDataKeys.reduce(
|
|
13224
13119
|
(acc, { key }) => {
|
|
13225
13120
|
acc[key] = localStorage.getItem(key) === null ? void 0 : localStorage.getItem(key);
|
|
@@ -13257,26 +13152,25 @@ var BasfSelect = () => {
|
|
|
13257
13152
|
}
|
|
13258
13153
|
) });
|
|
13259
13154
|
};
|
|
13260
|
-
var BasfSelect_default = (0,
|
|
13155
|
+
var BasfSelect_default = (0, import_react43.memo)(BasfSelect);
|
|
13261
13156
|
|
|
13262
13157
|
// src/Components/Map/BasfControlList.tsx
|
|
13263
13158
|
var import_ui32 = require("@geowiki/ui");
|
|
13264
13159
|
|
|
13265
13160
|
// src/Components/Controls/MeasureControl.tsx
|
|
13266
|
-
var
|
|
13161
|
+
var import_react44 = require("react");
|
|
13267
13162
|
var import_react_leaflet17 = require("react-leaflet");
|
|
13268
13163
|
var import_leaflet12 = __toESM(require("leaflet"));
|
|
13269
13164
|
var import_leaflet13 = require("leaflet.polylinemeasure");
|
|
13270
13165
|
var import_ui31 = require("@geowiki/ui");
|
|
13271
|
-
var
|
|
13166
|
+
var import_core27 = require("@geowiki/core");
|
|
13272
13167
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
13273
13168
|
function PolylineMeasureControl() {
|
|
13274
13169
|
const map = (0, import_react_leaflet17.useMap)();
|
|
13275
|
-
const controlRef = (0,
|
|
13276
|
-
const [active, setActive] = (0,
|
|
13277
|
-
(0,
|
|
13278
|
-
if (!map)
|
|
13279
|
-
return;
|
|
13170
|
+
const controlRef = (0, import_react44.useRef)(null);
|
|
13171
|
+
const [active, setActive] = (0, import_react44.useState)(false);
|
|
13172
|
+
(0, import_react44.useEffect)(() => {
|
|
13173
|
+
if (!map) return;
|
|
13280
13174
|
controlRef.current = import_leaflet12.default.control.polylineMeasure({
|
|
13281
13175
|
position: "topright",
|
|
13282
13176
|
unit: "metres",
|
|
@@ -13297,8 +13191,7 @@ function PolylineMeasureControl() {
|
|
|
13297
13191
|
};
|
|
13298
13192
|
}, [map]);
|
|
13299
13193
|
const togglePolylineMeasure = () => {
|
|
13300
|
-
if (!controlRef.current)
|
|
13301
|
-
return;
|
|
13194
|
+
if (!controlRef.current) return;
|
|
13302
13195
|
if (!controlRef.current._measureControl) {
|
|
13303
13196
|
console.warn("Measurement control not properly initialized");
|
|
13304
13197
|
return;
|
|
@@ -13306,18 +13199,17 @@ function PolylineMeasureControl() {
|
|
|
13306
13199
|
if (active) {
|
|
13307
13200
|
controlRef.current._toggleMeasure();
|
|
13308
13201
|
setActive(false);
|
|
13309
|
-
|
|
13202
|
+
import_core27.trackMapEvent.measurementTool("stop");
|
|
13310
13203
|
} else {
|
|
13311
13204
|
controlRef.current._toggleMeasure();
|
|
13312
13205
|
setActive(true);
|
|
13313
|
-
|
|
13206
|
+
import_core27.trackMapEvent.measurementTool("start");
|
|
13314
13207
|
}
|
|
13315
13208
|
};
|
|
13316
13209
|
const clearMeasurements = () => {
|
|
13317
|
-
if (!controlRef.current)
|
|
13318
|
-
return;
|
|
13210
|
+
if (!controlRef.current) return;
|
|
13319
13211
|
controlRef.current._clearAllMeasurements();
|
|
13320
|
-
|
|
13212
|
+
import_core27.trackMapEvent.measurementTool("clear");
|
|
13321
13213
|
};
|
|
13322
13214
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex gap-2", children: [
|
|
13323
13215
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_ui31.Button, { onClick: togglePolylineMeasure, children: active ? "Stop" : "Start" }),
|
|
@@ -13344,7 +13236,7 @@ var BasfControlList = ({ steps }) => {
|
|
|
13344
13236
|
}
|
|
13345
13237
|
}
|
|
13346
13238
|
};
|
|
13347
|
-
(0,
|
|
13239
|
+
(0, import_react45.useEffect)(() => {
|
|
13348
13240
|
setControls([
|
|
13349
13241
|
{
|
|
13350
13242
|
id: "startTour",
|
|
@@ -13416,7 +13308,7 @@ var BasfMapComponent = (_a) => {
|
|
|
13416
13308
|
]);
|
|
13417
13309
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
13418
13310
|
const { data: mapSettings, isLoading: isSettingsLoading } = (0, import_useMapSettings2.default)();
|
|
13419
|
-
const mapRef = (0,
|
|
13311
|
+
const mapRef = (0, import_react46.useRef)(null);
|
|
13420
13312
|
const mapStore = map_default();
|
|
13421
13313
|
const zoom = (_c = (_b2 = (_a2 = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a2.Zoom) == null ? void 0 : _b2.Value) != null ? _c : 12;
|
|
13422
13314
|
const center4 = [
|
|
@@ -13424,8 +13316,7 @@ var BasfMapComponent = (_a) => {
|
|
|
13424
13316
|
Number((_i = (_h = (_g = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _g.Longitude) == null ? void 0 : _h.Text) != null ? _i : 16.3738)
|
|
13425
13317
|
];
|
|
13426
13318
|
const steps = (_k = (_j = mapSettings == null ? void 0 : mapSettings.MapSettings) == null ? void 0 : _j.TourSteps) == null ? void 0 : _k.Text;
|
|
13427
|
-
if (isSettingsLoading)
|
|
13428
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_ui33.LoaderFull, {});
|
|
13319
|
+
if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_ui33.LoaderFull, {});
|
|
13429
13320
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_jsx_runtime62.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13430
13321
|
import_react_leaflet19.MapContainer,
|
|
13431
13322
|
__spreadProps(__spreadValues({
|
|
@@ -13449,7 +13340,7 @@ var BasfMapComponent = (_a) => {
|
|
|
13449
13340
|
})
|
|
13450
13341
|
) });
|
|
13451
13342
|
};
|
|
13452
|
-
var BasfMap = (0,
|
|
13343
|
+
var BasfMap = (0, import_react46.memo)(BasfMapComponent);
|
|
13453
13344
|
BasfMap.displayName = "BasfMap";
|
|
13454
13345
|
|
|
13455
13346
|
// src/Components/Map/GeoTreesMap.tsx
|
|
@@ -13457,20 +13348,20 @@ var import_leaflet16 = require("leaflet/dist/leaflet.css");
|
|
|
13457
13348
|
var import_react_leaflet23 = require("react-leaflet");
|
|
13458
13349
|
|
|
13459
13350
|
// src/Components/Map/GeoTreesControlList.tsx
|
|
13460
|
-
var
|
|
13351
|
+
var import_react49 = require("react");
|
|
13461
13352
|
|
|
13462
13353
|
// src/Components/Controls/GeoTreesDownloadContent.tsx
|
|
13463
|
-
var
|
|
13354
|
+
var import_react47 = require("react");
|
|
13464
13355
|
var import_react_hook_form4 = require("react-hook-form");
|
|
13465
|
-
var
|
|
13466
|
-
var
|
|
13356
|
+
var import_core28 = require("@geowiki/core");
|
|
13357
|
+
var import_core29 = require("@geowiki/core");
|
|
13467
13358
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
13468
13359
|
var GeoTreesDownloadContent = () => {
|
|
13469
13360
|
var _a, _b;
|
|
13470
|
-
const [countries, setCountries] = (0,
|
|
13471
|
-
const [versions, setVersions] = (0,
|
|
13361
|
+
const [countries, setCountries] = (0, import_react47.useState)([]);
|
|
13362
|
+
const [versions, setVersions] = (0, import_react47.useState)([]);
|
|
13472
13363
|
const baseUrl = process.env.NEXT_PUBLIC_GEO_TREE_API_URL;
|
|
13473
|
-
const { data: session } = (0,
|
|
13364
|
+
const { data: session } = (0, import_core28.useSession)();
|
|
13474
13365
|
const {
|
|
13475
13366
|
register,
|
|
13476
13367
|
handleSubmit,
|
|
@@ -13488,14 +13379,14 @@ var GeoTreesDownloadContent = () => {
|
|
|
13488
13379
|
acknowledgment: false
|
|
13489
13380
|
}
|
|
13490
13381
|
});
|
|
13491
|
-
(0,
|
|
13382
|
+
(0, import_react47.useEffect)(() => {
|
|
13492
13383
|
if (session == null ? void 0 : session.user) {
|
|
13493
13384
|
setValue("name", session.user.name || "");
|
|
13494
13385
|
setValue("email", session.user.email || "");
|
|
13495
13386
|
}
|
|
13496
13387
|
}, [session, setValue]);
|
|
13497
|
-
(0,
|
|
13498
|
-
const fetchCountries = () => __async(
|
|
13388
|
+
(0, import_react47.useEffect)(() => {
|
|
13389
|
+
const fetchCountries = () => __async(null, null, function* () {
|
|
13499
13390
|
try {
|
|
13500
13391
|
const response = yield fetch(
|
|
13501
13392
|
`${baseUrl}/api/plots/get-available-countries`,
|
|
@@ -13511,7 +13402,7 @@ var GeoTreesDownloadContent = () => {
|
|
|
13511
13402
|
console.error("Error fetching countries:", error);
|
|
13512
13403
|
}
|
|
13513
13404
|
});
|
|
13514
|
-
const fetchVersions = () => __async(
|
|
13405
|
+
const fetchVersions = () => __async(null, null, function* () {
|
|
13515
13406
|
try {
|
|
13516
13407
|
const response = yield fetch(
|
|
13517
13408
|
`${baseUrl}/api/plots/available-versions`,
|
|
@@ -13552,7 +13443,7 @@ var GeoTreesDownloadContent = () => {
|
|
|
13552
13443
|
}, [baseUrl, session == null ? void 0 : session.accessToken]);
|
|
13553
13444
|
const onSubmit = (data) => {
|
|
13554
13445
|
const { format, purpose, email, name, country, version } = data;
|
|
13555
|
-
|
|
13446
|
+
import_core29.trackDownloadEvent.attempt(
|
|
13556
13447
|
format,
|
|
13557
13448
|
country,
|
|
13558
13449
|
version,
|
|
@@ -13597,10 +13488,10 @@ var GeoTreesDownloadContent = () => {
|
|
|
13597
13488
|
link.click();
|
|
13598
13489
|
document.body.removeChild(link);
|
|
13599
13490
|
window.URL.revokeObjectURL(url);
|
|
13600
|
-
|
|
13491
|
+
import_core29.trackDownloadEvent.success(filename, purpose, session || void 0);
|
|
13601
13492
|
}).catch((error) => {
|
|
13602
13493
|
console.error("Error downloading file:", error);
|
|
13603
|
-
|
|
13494
|
+
import_core29.trackDownloadEvent.failure(
|
|
13604
13495
|
error.message,
|
|
13605
13496
|
purpose,
|
|
13606
13497
|
session || void 0
|
|
@@ -13614,8 +13505,8 @@ var GeoTreesDownloadContent = () => {
|
|
|
13614
13505
|
"button",
|
|
13615
13506
|
{
|
|
13616
13507
|
onClick: () => {
|
|
13617
|
-
|
|
13618
|
-
(0,
|
|
13508
|
+
import_core29.trackDownloadEvent.loginAttempt(session || void 0);
|
|
13509
|
+
(0, import_core28.signIn)();
|
|
13619
13510
|
},
|
|
13620
13511
|
className: "w-full py-2 px-4 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors",
|
|
13621
13512
|
children: "Login"
|
|
@@ -13755,18 +13646,17 @@ var GeoTreesDownloadContent = () => {
|
|
|
13755
13646
|
var import_react_leaflet21 = require("react-leaflet");
|
|
13756
13647
|
|
|
13757
13648
|
// src/Components/Controls/ScaleControl.tsx
|
|
13758
|
-
var
|
|
13649
|
+
var import_react48 = require("react");
|
|
13759
13650
|
var import_react_leaflet20 = require("react-leaflet");
|
|
13760
13651
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
13761
13652
|
var ScaleControl3 = ({
|
|
13762
13653
|
className = ""
|
|
13763
13654
|
}) => {
|
|
13764
13655
|
const map = (0, import_react_leaflet20.useMap)();
|
|
13765
|
-
const [scale, setScale] = (0,
|
|
13766
|
-
(0,
|
|
13656
|
+
const [scale, setScale] = (0, import_react48.useState)("");
|
|
13657
|
+
(0, import_react48.useEffect)(() => {
|
|
13767
13658
|
const updateScale = () => {
|
|
13768
|
-
if (!map)
|
|
13769
|
-
return;
|
|
13659
|
+
if (!map) return;
|
|
13770
13660
|
const center4 = map.getCenter();
|
|
13771
13661
|
const zoom = map.getZoom();
|
|
13772
13662
|
const metersPerPixel = 156543.03392 * Math.cos(center4.lat * Math.PI / 180) / Math.pow(2, zoom);
|
|
@@ -13782,8 +13672,7 @@ var ScaleControl3 = ({
|
|
|
13782
13672
|
map.off("moveend", updateScale);
|
|
13783
13673
|
};
|
|
13784
13674
|
}, [map]);
|
|
13785
|
-
if (!scale)
|
|
13786
|
-
return null;
|
|
13675
|
+
if (!scale) return null;
|
|
13787
13676
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
13788
13677
|
"div",
|
|
13789
13678
|
{
|
|
@@ -13799,7 +13688,7 @@ var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
|
13799
13688
|
var GeoTreesControlList = () => {
|
|
13800
13689
|
const setControls = useMapControlStore((state) => state.setControls);
|
|
13801
13690
|
const map = (0, import_react_leaflet21.useMap)();
|
|
13802
|
-
(0,
|
|
13691
|
+
(0, import_react49.useEffect)(() => {
|
|
13803
13692
|
setControls([
|
|
13804
13693
|
{
|
|
13805
13694
|
id: "basemap",
|
|
@@ -13871,10 +13760,10 @@ var GeoTreesControlList = () => {
|
|
|
13871
13760
|
// src/Components/Map/GeoTreesMap.tsx
|
|
13872
13761
|
var import_useMapSettings3 = __toESM(require("@geowiki/core/src/hooks/useMapSettings"));
|
|
13873
13762
|
var import_ui35 = require("@geowiki/ui");
|
|
13874
|
-
var
|
|
13763
|
+
var import_react52 = require("react");
|
|
13875
13764
|
|
|
13876
13765
|
// src/Components/Ifbn/GeoTreesCustomLayer.tsx
|
|
13877
|
-
var
|
|
13766
|
+
var import_react50 = require("react");
|
|
13878
13767
|
var import_react_leaflet22 = require("react-leaflet");
|
|
13879
13768
|
var import_leaflet15 = __toESM(require("leaflet"));
|
|
13880
13769
|
var import_MapPinIcon3 = __toESM(require("@heroicons/react/24/solid/MapPinIcon"));
|
|
@@ -14040,8 +13929,8 @@ var GeoTreesCustomLayerComponent = () => {
|
|
|
14040
13929
|
const map = (0, import_react_leaflet22.useMap)();
|
|
14041
13930
|
const layerStore = mapLayers_default();
|
|
14042
13931
|
const { createLayerFromTemplate } = useCustomLayerStore();
|
|
14043
|
-
const [layerCreated, setLayerCreated] = (0,
|
|
14044
|
-
const [selectedMarker, setSelectedMarker] = (0,
|
|
13932
|
+
const [layerCreated, setLayerCreated] = (0, import_react50.useState)(false);
|
|
13933
|
+
const [selectedMarker, setSelectedMarker] = (0, import_react50.useState)(null);
|
|
14045
13934
|
const currentZoom = map.getZoom();
|
|
14046
13935
|
const isGeoTreesLayerActive = layerStore.layers.some(
|
|
14047
13936
|
(layer) => layer.title === "GEO-TREES ALS Data"
|
|
@@ -14049,7 +13938,7 @@ var GeoTreesCustomLayerComponent = () => {
|
|
|
14049
13938
|
const existingCustomLayer = layerStore.layers.find(
|
|
14050
13939
|
(layer) => layer.title === "GEO-TREES ALS Data"
|
|
14051
13940
|
);
|
|
14052
|
-
(0,
|
|
13941
|
+
(0, import_react50.useEffect)(() => {
|
|
14053
13942
|
if (isGeoTreesLayerActive && !existingCustomLayer && !layerCreated && TREE_POSITIONS.length > 0) {
|
|
14054
13943
|
const geoJsonData = {
|
|
14055
13944
|
type: "FeatureCollection",
|
|
@@ -14189,11 +14078,11 @@ var GeoTreesCustomLayerComponent = () => {
|
|
|
14189
14078
|
)
|
|
14190
14079
|
] });
|
|
14191
14080
|
};
|
|
14192
|
-
var GeoTreesCustomLayer = (0,
|
|
14081
|
+
var GeoTreesCustomLayer = (0, import_react50.memo)(GeoTreesCustomLayerComponent);
|
|
14193
14082
|
|
|
14194
14083
|
// src/Components/Ifbn/GeoTreesExternalLayer.tsx
|
|
14195
14084
|
var import_react_query5 = require("@tanstack/react-query");
|
|
14196
|
-
var
|
|
14085
|
+
var import_react51 = require("react");
|
|
14197
14086
|
|
|
14198
14087
|
// src/utils/layerUtils.ts
|
|
14199
14088
|
var createMarkerClusterLayer = (title, data, options = {}) => ({
|
|
@@ -14351,7 +14240,7 @@ var EmptyStateDisplay = () => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("di
|
|
|
14351
14240
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h4", { className: "font-semibold", children: "No GEO-TREES BRM data available" }),
|
|
14352
14241
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-sm", children: "Unable to load Biomass Reference Measurement sites data." })
|
|
14353
14242
|
] });
|
|
14354
|
-
var GeoTreesExternalLayer = (0,
|
|
14243
|
+
var GeoTreesExternalLayer = (0, import_react51.forwardRef)(
|
|
14355
14244
|
({
|
|
14356
14245
|
statusFilter = { completed: true, ongoing: true, planned: true },
|
|
14357
14246
|
autoAdd = false
|
|
@@ -14364,8 +14253,8 @@ var GeoTreesExternalLayer = (0, import_react53.forwardRef)(
|
|
|
14364
14253
|
syncTrackingWithMapLayers
|
|
14365
14254
|
} = useCustomLayerStore();
|
|
14366
14255
|
const { layers } = mapLayers_default();
|
|
14367
|
-
const hasAddedLayer = (0,
|
|
14368
|
-
(0,
|
|
14256
|
+
const hasAddedLayer = (0, import_react51.useRef)(false);
|
|
14257
|
+
(0, import_react51.useEffect)(() => {
|
|
14369
14258
|
initializeExistingLayers();
|
|
14370
14259
|
syncTrackingWithMapLayers();
|
|
14371
14260
|
}, [initializeExistingLayers, syncTrackingWithMapLayers]);
|
|
@@ -14373,7 +14262,7 @@ var GeoTreesExternalLayer = (0, import_react53.forwardRef)(
|
|
|
14373
14262
|
const externalUrl = `${API_URL}/api/external/google-sheet-geojson`;
|
|
14374
14263
|
const { isLoading, error, data } = (0, import_react_query5.useQuery)({
|
|
14375
14264
|
queryKey: ["geoTreesExternal", externalUrl],
|
|
14376
|
-
queryFn: () => __async(
|
|
14265
|
+
queryFn: () => __async(null, null, function* () {
|
|
14377
14266
|
if (!API_URL) {
|
|
14378
14267
|
throw new Error("NEXT_PUBLIC_GEO_TREE_API_URL is not configured");
|
|
14379
14268
|
}
|
|
@@ -14403,10 +14292,9 @@ var GeoTreesExternalLayer = (0, import_react53.forwardRef)(
|
|
|
14403
14292
|
return layer.id === "geotrees-external-layer" || layer.title === "GEO-TREES External" || layer.title === "GEO-TREES Sites" || layer.title === "GEO-TREES BRM Sites" || layer.title === "GeoTrees External" || layer.title === "GeoTrees Sites" || layer.title === "GeoTrees BRM Sites" || ((_a2 = layer.id) == null ? void 0 : _a2.includes("GEO-TREES-external")) || ((_b = layer.id) == null ? void 0 : _b.includes("GEO-TREES-sites")) || ((_c = layer.id) == null ? void 0 : _c.includes("GEO-TREES-brm-sites")) || ((_d = layer.id) == null ? void 0 : _d.includes("geotrees-external")) || ((_e = layer.id) == null ? void 0 : _e.includes("geotrees-sites")) || ((_f = layer.id) == null ? void 0 : _f.includes("geotrees-brm-sites")) || ((_g = layer.layerInfo) == null ? void 0 : _g.source) === "GeoTrees API";
|
|
14404
14293
|
}
|
|
14405
14294
|
);
|
|
14406
|
-
const addGeoTreesLayer = (0,
|
|
14295
|
+
const addGeoTreesLayer = (0, import_react51.useCallback)(() => {
|
|
14407
14296
|
var _a2;
|
|
14408
|
-
if (!data)
|
|
14409
|
-
return;
|
|
14297
|
+
if (!data) return;
|
|
14410
14298
|
const layerId = "geotrees-external-layer";
|
|
14411
14299
|
if (hasLayerBeenAdded(layerId) || existingLayer || hasAddedLayer.current) {
|
|
14412
14300
|
console.warn("GEO-TREES BRM layer already exists, skipping addition", {
|
|
@@ -14419,8 +14307,7 @@ var GeoTreesExternalLayer = (0, import_react53.forwardRef)(
|
|
|
14419
14307
|
const filteredFeatures = ((_a2 = data.features) == null ? void 0 : _a2.filter((feature) => {
|
|
14420
14308
|
var _a3;
|
|
14421
14309
|
const status = (_a3 = feature.properties) == null ? void 0 : _a3.Status;
|
|
14422
|
-
if (!status)
|
|
14423
|
-
return true;
|
|
14310
|
+
if (!status) return true;
|
|
14424
14311
|
const statusKey = getStatusFromRaw(status);
|
|
14425
14312
|
return statusKey ? statusFilter[statusKey] : true;
|
|
14426
14313
|
})) || [];
|
|
@@ -14475,25 +14362,22 @@ var GeoTreesExternalLayer = (0, import_react53.forwardRef)(
|
|
|
14475
14362
|
addCustomLayer(layerWithInfo);
|
|
14476
14363
|
hasAddedLayer.current = true;
|
|
14477
14364
|
}, [data, statusFilter, addCustomLayer, existingLayer, hasLayerBeenAdded]);
|
|
14478
|
-
(0,
|
|
14365
|
+
(0, import_react51.useImperativeHandle)(
|
|
14479
14366
|
ref,
|
|
14480
14367
|
() => ({
|
|
14481
14368
|
addLayer: addGeoTreesLayer
|
|
14482
14369
|
}),
|
|
14483
14370
|
[addGeoTreesLayer]
|
|
14484
14371
|
);
|
|
14485
|
-
(0,
|
|
14372
|
+
(0, import_react51.useEffect)(() => {
|
|
14486
14373
|
const layerId = "geotrees-external-layer";
|
|
14487
14374
|
if (autoAdd && data && !hasLayerBeenAdded(layerId) && !hasAddedLayer.current && !existingLayer) {
|
|
14488
14375
|
addGeoTreesLayer();
|
|
14489
14376
|
}
|
|
14490
14377
|
}, [data, autoAdd, existingLayer, addGeoTreesLayer, hasLayerBeenAdded]);
|
|
14491
|
-
if (error)
|
|
14492
|
-
|
|
14493
|
-
if (
|
|
14494
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(LoadingDisplay, {});
|
|
14495
|
-
if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length))
|
|
14496
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(EmptyStateDisplay, {});
|
|
14378
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ErrorDisplay, { error });
|
|
14379
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(LoadingDisplay, {});
|
|
14380
|
+
if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length)) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(EmptyStateDisplay, {});
|
|
14497
14381
|
return null;
|
|
14498
14382
|
}
|
|
14499
14383
|
);
|
|
@@ -14505,7 +14389,7 @@ var MAX_BOUNDS = [
|
|
|
14505
14389
|
[-90, -180],
|
|
14506
14390
|
[90, 180]
|
|
14507
14391
|
];
|
|
14508
|
-
var MapContent = (0,
|
|
14392
|
+
var MapContent = (0, import_react52.memo)(({ center: center4, zoom }) => {
|
|
14509
14393
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
14510
14394
|
import_react_leaflet23.MapContainer,
|
|
14511
14395
|
{
|
|
@@ -14544,8 +14428,7 @@ var GeoTreesMap = () => {
|
|
|
14544
14428
|
"Error loading map settings: ",
|
|
14545
14429
|
error.message
|
|
14546
14430
|
] }) });
|
|
14547
|
-
if (isSettingsLoading)
|
|
14548
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_ui35.LoaderFull, { showInCenter: false });
|
|
14431
|
+
if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_ui35.LoaderFull, { showInCenter: false });
|
|
14549
14432
|
const zoom = (_c = (_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) != null ? _c : 12;
|
|
14550
14433
|
const center4 = [
|
|
14551
14434
|
(_f = (_e = (_d = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _d.Latitude) == null ? void 0 : _e.Text) != null ? _f : 48.2082,
|
|
@@ -14556,19 +14439,19 @@ var GeoTreesMap = () => {
|
|
|
14556
14439
|
|
|
14557
14440
|
// src/Components/Canopy/CanopyMap.tsx
|
|
14558
14441
|
var import_leaflet21 = require("leaflet/dist/leaflet.css");
|
|
14559
|
-
var
|
|
14442
|
+
var import_react58 = require("react");
|
|
14560
14443
|
var import_react_leaflet27 = require("react-leaflet");
|
|
14561
|
-
var
|
|
14444
|
+
var import_core30 = require("@geowiki/core");
|
|
14562
14445
|
var import_useMapSettings4 = __toESM(require("@geowiki/core/src/hooks/useMapSettings"));
|
|
14563
14446
|
var import_ui41 = require("@geowiki/ui");
|
|
14564
14447
|
|
|
14565
14448
|
// src/Components/Canopy/CanopyMapControlList.tsx
|
|
14566
|
-
var
|
|
14449
|
+
var import_react57 = require("react");
|
|
14567
14450
|
var import_lucide_react8 = require("lucide-react");
|
|
14568
14451
|
var import_react_leaflet26 = require("react-leaflet");
|
|
14569
14452
|
|
|
14570
14453
|
// src/Components/Map/GenericAreaSelect.tsx
|
|
14571
|
-
var
|
|
14454
|
+
var import_react53 = require("react");
|
|
14572
14455
|
var import_react_leaflet24 = require("react-leaflet");
|
|
14573
14456
|
var import_leaflet17 = require("leaflet");
|
|
14574
14457
|
|
|
@@ -14602,11 +14485,10 @@ var useAreaSelect = ({
|
|
|
14602
14485
|
setIsSelectionActive,
|
|
14603
14486
|
setBbox
|
|
14604
14487
|
} = useAreaSelectStore();
|
|
14605
|
-
const rectangleRef = (0,
|
|
14606
|
-
(0,
|
|
14488
|
+
const rectangleRef = (0, import_react53.useRef)(null);
|
|
14489
|
+
(0, import_react53.useEffect)(() => {
|
|
14607
14490
|
var _a;
|
|
14608
|
-
if (!map.selectArea)
|
|
14609
|
-
return;
|
|
14491
|
+
if (!map.selectArea) return;
|
|
14610
14492
|
(_a = map.selectArea) == null ? void 0 : _a.setControlKey(false);
|
|
14611
14493
|
if (!rectangleRef.current) {
|
|
14612
14494
|
rectangleRef.current = new import_leaflet17.Rectangle(
|
|
@@ -14619,8 +14501,7 @@ var useAreaSelect = ({
|
|
|
14619
14501
|
}
|
|
14620
14502
|
const handleAreaSelected = (e) => {
|
|
14621
14503
|
var _a2, _b, _c;
|
|
14622
|
-
if (!e.bounds)
|
|
14623
|
-
return;
|
|
14504
|
+
if (!e.bounds) return;
|
|
14624
14505
|
const boundsString = e.bounds.toBBoxString();
|
|
14625
14506
|
if (onAreaSelected) {
|
|
14626
14507
|
onAreaSelected(boundsString);
|
|
@@ -14685,17 +14566,16 @@ var useAreaSelect = ({
|
|
|
14685
14566
|
};
|
|
14686
14567
|
|
|
14687
14568
|
// src/Components/Canopy/CanopyAtlasDownload.tsx
|
|
14688
|
-
var
|
|
14569
|
+
var import_react54 = require("react");
|
|
14689
14570
|
var import_lucide_react5 = require("lucide-react");
|
|
14690
14571
|
var import_ui36 = require("@geowiki/ui");
|
|
14691
14572
|
var import_leaflet18 = __toESM(require("leaflet"));
|
|
14692
14573
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
14693
14574
|
var CanopyAtlasDownload = () => {
|
|
14694
|
-
const [format, setFormat] = (0,
|
|
14575
|
+
const [format, setFormat] = (0, import_react54.useState)("shape-zip");
|
|
14695
14576
|
const { bbox: bbox4 } = useAreaSelectStore();
|
|
14696
|
-
const handleDownload = () => __async(
|
|
14697
|
-
if (!bbox4)
|
|
14698
|
-
return;
|
|
14577
|
+
const handleDownload = () => __async(null, null, function* () {
|
|
14578
|
+
if (!bbox4) return;
|
|
14699
14579
|
const params = {
|
|
14700
14580
|
request: "GetFeature",
|
|
14701
14581
|
service: "WFS",
|
|
@@ -14710,8 +14590,7 @@ var CanopyAtlasDownload = () => {
|
|
|
14710
14590
|
const wfsUrl = baseUrl + import_leaflet18.default.Util.getParamString(params, baseUrl, true);
|
|
14711
14591
|
try {
|
|
14712
14592
|
const response = yield fetch(wfsUrl);
|
|
14713
|
-
if (!response.ok)
|
|
14714
|
-
throw new Error("Download failed");
|
|
14593
|
+
if (!response.ok) throw new Error("Download failed");
|
|
14715
14594
|
const blob = yield response.blob();
|
|
14716
14595
|
const url = window.URL.createObjectURL(blob);
|
|
14717
14596
|
const a = document.createElement("a");
|
|
@@ -14758,7 +14637,7 @@ var CanopyAtlasDownload = () => {
|
|
|
14758
14637
|
};
|
|
14759
14638
|
|
|
14760
14639
|
// src/Components/Canopy/CanopyFilter.tsx
|
|
14761
|
-
var
|
|
14640
|
+
var import_react55 = require("react");
|
|
14762
14641
|
var import_ui37 = require("@geowiki/ui");
|
|
14763
14642
|
var import_lucide_react6 = require("lucide-react");
|
|
14764
14643
|
var import_leaflet19 = __toESM(require("leaflet"));
|
|
@@ -14835,8 +14714,8 @@ var ACCESS_OPTIONS = [
|
|
|
14835
14714
|
];
|
|
14836
14715
|
var YEAR_MIN = 2005;
|
|
14837
14716
|
var YEAR_MAX = 2025;
|
|
14838
|
-
var CanopyFilter = (0,
|
|
14839
|
-
const [format, setFormat] = (0,
|
|
14717
|
+
var CanopyFilter = (0, import_react55.memo)(({ onFilterChange }) => {
|
|
14718
|
+
const [format, setFormat] = (0, import_react55.useState)("shape-zip");
|
|
14840
14719
|
const { control, reset, watch } = (0, import_react_hook_form5.useForm)({
|
|
14841
14720
|
defaultValues: {
|
|
14842
14721
|
biome: "",
|
|
@@ -14849,7 +14728,7 @@ var CanopyFilter = (0, import_react57.memo)(({ onFilterChange }) => {
|
|
|
14849
14728
|
}
|
|
14850
14729
|
});
|
|
14851
14730
|
const filters = watch();
|
|
14852
|
-
(0,
|
|
14731
|
+
(0, import_react55.useEffect)(() => {
|
|
14853
14732
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
14854
14733
|
if (stored) {
|
|
14855
14734
|
const parsed = JSON.parse(stored);
|
|
@@ -14885,20 +14764,15 @@ var CanopyFilter = (0, import_react57.memo)(({ onFilterChange }) => {
|
|
|
14885
14764
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(updatedFilters));
|
|
14886
14765
|
onFilterChange(updatedFilters);
|
|
14887
14766
|
};
|
|
14888
|
-
const handleDownload = () => __async(
|
|
14767
|
+
const handleDownload = () => __async(null, null, function* () {
|
|
14889
14768
|
const cqlFilters = [];
|
|
14890
|
-
if (filters.biome)
|
|
14891
|
-
|
|
14892
|
-
if (filters.
|
|
14893
|
-
cqlFilters.push(`realm='${filters.realm}'`);
|
|
14894
|
-
if (filters.access)
|
|
14895
|
-
cqlFilters.push(`access='${filters.access}'`);
|
|
14769
|
+
if (filters.biome) cqlFilters.push(`biome='${filters.biome}'`);
|
|
14770
|
+
if (filters.realm) cqlFilters.push(`realm='${filters.realm}'`);
|
|
14771
|
+
if (filters.access) cqlFilters.push(`access='${filters.access}'`);
|
|
14896
14772
|
if (filters.idunique)
|
|
14897
14773
|
cqlFilters.push(`IDunique LIKE '%${filters.idunique}%'`);
|
|
14898
|
-
if (filters.minyear)
|
|
14899
|
-
|
|
14900
|
-
if (filters.maxyear)
|
|
14901
|
-
cqlFilters.push(`minyear<=${filters.maxyear}`);
|
|
14774
|
+
if (filters.minyear) cqlFilters.push(`minyear>=${filters.minyear}`);
|
|
14775
|
+
if (filters.maxyear) cqlFilters.push(`minyear<=${filters.maxyear}`);
|
|
14902
14776
|
const params = __spreadValues({
|
|
14903
14777
|
request: "GetFeature",
|
|
14904
14778
|
service: "WFS",
|
|
@@ -14912,8 +14786,7 @@ var CanopyFilter = (0, import_react57.memo)(({ onFilterChange }) => {
|
|
|
14912
14786
|
const wfsUrl = baseUrl + import_leaflet19.default.Util.getParamString(params, baseUrl, true);
|
|
14913
14787
|
try {
|
|
14914
14788
|
const response = yield fetch(wfsUrl);
|
|
14915
|
-
if (!response.ok)
|
|
14916
|
-
throw new Error("Download failed");
|
|
14789
|
+
if (!response.ok) throw new Error("Download failed");
|
|
14917
14790
|
const blob = yield response.blob();
|
|
14918
14791
|
const url = window.URL.createObjectURL(blob);
|
|
14919
14792
|
const a = document.createElement("a");
|
|
@@ -15134,7 +15007,7 @@ var CanopyFilter = (0, import_react57.memo)(({ onFilterChange }) => {
|
|
|
15134
15007
|
CanopyFilter.displayName = "CanopyFilter";
|
|
15135
15008
|
|
|
15136
15009
|
// src/Components/Layers/WfsLayer.tsx
|
|
15137
|
-
var
|
|
15010
|
+
var import_react56 = require("react");
|
|
15138
15011
|
var import_react_leaflet25 = require("react-leaflet");
|
|
15139
15012
|
var import_react_query6 = require("@tanstack/react-query");
|
|
15140
15013
|
var turf7 = __toESM(require("@turf/turf"));
|
|
@@ -15147,10 +15020,8 @@ var constructCqlFilter = (filterParams) => {
|
|
|
15147
15020
|
return "";
|
|
15148
15021
|
}
|
|
15149
15022
|
let _a = filterParams || {}, { minyear, maxyear } = _a, rest = __objRest(_a, ["minyear", "maxyear"]);
|
|
15150
|
-
if (Array.isArray(minyear))
|
|
15151
|
-
|
|
15152
|
-
if (Array.isArray(maxyear))
|
|
15153
|
-
maxyear = maxyear[0];
|
|
15023
|
+
if (Array.isArray(minyear)) minyear = minyear[0];
|
|
15024
|
+
if (Array.isArray(maxyear)) maxyear = maxyear[0];
|
|
15154
15025
|
const cqlExpressions = [];
|
|
15155
15026
|
if (minyear && maxyear) {
|
|
15156
15027
|
cqlExpressions.push(
|
|
@@ -15257,16 +15128,14 @@ var formatPropertyValue = (value, propertyName) => {
|
|
|
15257
15128
|
return value.toString();
|
|
15258
15129
|
};
|
|
15259
15130
|
var createDefaultPopupContent = (feature, propertyNames) => {
|
|
15260
|
-
if (!feature.properties)
|
|
15261
|
-
return "";
|
|
15131
|
+
if (!feature.properties) return "";
|
|
15262
15132
|
const propertiesToShow = (propertyNames == null ? void 0 : propertyNames.length) ? propertyNames : DEFAULT_POPUP_PROPERTIES;
|
|
15263
15133
|
const properties = Object.entries(feature.properties).filter(([key]) => propertiesToShow.includes(key)).sort((a, b) => {
|
|
15264
15134
|
const indexA = propertiesToShow.indexOf(a[0]);
|
|
15265
15135
|
const indexB = propertiesToShow.indexOf(b[0]);
|
|
15266
15136
|
return indexA - indexB;
|
|
15267
15137
|
});
|
|
15268
|
-
if (properties.length === 0)
|
|
15269
|
-
return "";
|
|
15138
|
+
if (properties.length === 0) return "";
|
|
15270
15139
|
return `
|
|
15271
15140
|
<div class="leaflet-popup-content-wrapper" style="background-color: #fff; padding: 0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);">
|
|
15272
15141
|
<div style="width: 100%; overflow-y: auto;">
|
|
@@ -15337,7 +15206,7 @@ var openDatabase = () => {
|
|
|
15337
15206
|
};
|
|
15338
15207
|
});
|
|
15339
15208
|
};
|
|
15340
|
-
var storeInIndexedDB = (key, data) => __async(
|
|
15209
|
+
var storeInIndexedDB = (key, data) => __async(null, null, function* () {
|
|
15341
15210
|
try {
|
|
15342
15211
|
const db = yield openDatabase();
|
|
15343
15212
|
const transaction = db.transaction(STORE_NAME, "readwrite");
|
|
@@ -15356,7 +15225,7 @@ var storeInIndexedDB = (key, data) => __async(void 0, null, function* () {
|
|
|
15356
15225
|
console.warn("Failed to store data in IndexedDB:", e);
|
|
15357
15226
|
}
|
|
15358
15227
|
});
|
|
15359
|
-
var getFromIndexedDB = (key) => __async(
|
|
15228
|
+
var getFromIndexedDB = (key) => __async(null, null, function* () {
|
|
15360
15229
|
try {
|
|
15361
15230
|
const db = yield openDatabase();
|
|
15362
15231
|
const transaction = db.transaction(STORE_NAME, "readonly");
|
|
@@ -15378,7 +15247,7 @@ var getFromIndexedDB = (key) => __async(void 0, null, function* () {
|
|
|
15378
15247
|
return null;
|
|
15379
15248
|
}
|
|
15380
15249
|
});
|
|
15381
|
-
var cleanupIndexedDB = () => __async(
|
|
15250
|
+
var cleanupIndexedDB = () => __async(null, null, function* () {
|
|
15382
15251
|
try {
|
|
15383
15252
|
const db = yield openDatabase();
|
|
15384
15253
|
const transaction = db.transaction(STORE_NAME, "readwrite");
|
|
@@ -15416,7 +15285,7 @@ var WfsLayer = ({
|
|
|
15416
15285
|
var _a;
|
|
15417
15286
|
const hideMarkersAboveZoom = (_a = markerOptions.hideMarkersAboveZoom) != null ? _a : 15;
|
|
15418
15287
|
const mapStore = map_default();
|
|
15419
|
-
const [shouldRenderMarkers, setShouldRenderMarkers] = (0,
|
|
15288
|
+
const [shouldRenderMarkers, setShouldRenderMarkers] = (0, import_react56.useState)(true);
|
|
15420
15289
|
const map = (0, import_react_leaflet25.useMapEvents)({
|
|
15421
15290
|
zoomend: () => {
|
|
15422
15291
|
const newZoom = map.getZoom();
|
|
@@ -15427,19 +15296,18 @@ var WfsLayer = ({
|
|
|
15427
15296
|
setShouldRenderMarkers(newZoom <= hideMarkersAboveZoom);
|
|
15428
15297
|
}
|
|
15429
15298
|
});
|
|
15430
|
-
const stableFilterParams = (0,
|
|
15431
|
-
if (!filterParams)
|
|
15432
|
-
return null;
|
|
15299
|
+
const stableFilterParams = (0, import_react56.useMemo)(() => {
|
|
15300
|
+
if (!filterParams) return null;
|
|
15433
15301
|
return JSON.stringify(filterParams);
|
|
15434
15302
|
}, [filterParams]);
|
|
15435
|
-
const queryKey = (0,
|
|
15303
|
+
const queryKey = (0, import_react56.useMemo)(() => {
|
|
15436
15304
|
const key = ["wfsLayer", url, layerName];
|
|
15437
15305
|
if (useServerFiltering && filterParams && Object.keys(filterParams).length > 0) {
|
|
15438
15306
|
key.push(stableFilterParams);
|
|
15439
15307
|
}
|
|
15440
15308
|
return key;
|
|
15441
15309
|
}, [url, layerName, useServerFiltering, filterParams, stableFilterParams]);
|
|
15442
|
-
const constructWfsUrl = (0,
|
|
15310
|
+
const constructWfsUrl = (0, import_react56.useCallback)(() => {
|
|
15443
15311
|
let wfsUrl = `${url}?service=WFS&version=1.0.0&request=GetFeature&typeName=${layerName}&outputFormat=application/json&maxFeatures=5000`;
|
|
15444
15312
|
if (useServerFiltering && filterParams && Object.keys(filterParams).length > 0) {
|
|
15445
15313
|
const cqlFilter = constructCqlFilter(filterParams);
|
|
@@ -15451,7 +15319,7 @@ var WfsLayer = ({
|
|
|
15451
15319
|
}, [url, layerName, filterParams, useServerFiltering]);
|
|
15452
15320
|
const { data: geoJsonData, error } = (0, import_react_query6.useQuery)({
|
|
15453
15321
|
queryKey,
|
|
15454
|
-
queryFn: () => __async(
|
|
15322
|
+
queryFn: () => __async(null, null, function* () {
|
|
15455
15323
|
mapStore.setIsLoading(true);
|
|
15456
15324
|
const wfsUrl = constructWfsUrl();
|
|
15457
15325
|
const storageKey = `wfs-data-${queryKey.join("-")}`;
|
|
@@ -15497,10 +15365,10 @@ var WfsLayer = ({
|
|
|
15497
15365
|
return failureCount < 3;
|
|
15498
15366
|
}
|
|
15499
15367
|
});
|
|
15500
|
-
const [selectedFeatureId, setSelectedFeatureId] = (0,
|
|
15368
|
+
const [selectedFeatureId, setSelectedFeatureId] = (0, import_react56.useState)(
|
|
15501
15369
|
null
|
|
15502
15370
|
);
|
|
15503
|
-
const layerRef = (0,
|
|
15371
|
+
const layerRef = (0, import_react56.useRef)({});
|
|
15504
15372
|
const defaultStyle = {
|
|
15505
15373
|
color: "#3388ff",
|
|
15506
15374
|
weight: 2,
|
|
@@ -15513,23 +15381,21 @@ var WfsLayer = ({
|
|
|
15513
15381
|
opacity: 1,
|
|
15514
15382
|
fillOpacity: 0.4
|
|
15515
15383
|
};
|
|
15516
|
-
const getFeatureStyle = (0,
|
|
15384
|
+
const getFeatureStyle = (0, import_react56.useCallback)(
|
|
15517
15385
|
(feature) => {
|
|
15518
15386
|
var _a2;
|
|
15519
|
-
if (!feature)
|
|
15520
|
-
return defaultStyle;
|
|
15387
|
+
if (!feature) return defaultStyle;
|
|
15521
15388
|
const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
|
|
15522
15389
|
return featureId === selectedFeatureId ? highlightStyle : defaultStyle;
|
|
15523
15390
|
},
|
|
15524
15391
|
[selectedFeatureId]
|
|
15525
15392
|
);
|
|
15526
|
-
const onEachFeature = (0,
|
|
15393
|
+
const onEachFeature = (0, import_react56.useCallback)(
|
|
15527
15394
|
(feature, layer) => {
|
|
15528
15395
|
var _a2;
|
|
15529
15396
|
const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
|
|
15530
15397
|
layerRef.current[featureId] = layer;
|
|
15531
|
-
if (!popupOptions || !feature.properties)
|
|
15532
|
-
return;
|
|
15398
|
+
if (!popupOptions || !feature.properties) return;
|
|
15533
15399
|
let popupContent;
|
|
15534
15400
|
if (popupOptions.renderContent) {
|
|
15535
15401
|
popupContent = popupOptions.renderContent(feature);
|
|
@@ -15558,7 +15424,7 @@ var WfsLayer = ({
|
|
|
15558
15424
|
},
|
|
15559
15425
|
[popupOptions]
|
|
15560
15426
|
);
|
|
15561
|
-
const isPropertyValueMatch = (0,
|
|
15427
|
+
const isPropertyValueMatch = (0, import_react56.useCallback)(
|
|
15562
15428
|
(propertyValue, filterValue) => {
|
|
15563
15429
|
if (propertyValue === null || propertyValue === void 0) {
|
|
15564
15430
|
return false;
|
|
@@ -15573,9 +15439,8 @@ var WfsLayer = ({
|
|
|
15573
15439
|
},
|
|
15574
15440
|
[]
|
|
15575
15441
|
);
|
|
15576
|
-
const filteredGeoJson = (0,
|
|
15577
|
-
if (!geoJsonData)
|
|
15578
|
-
return null;
|
|
15442
|
+
const filteredGeoJson = (0, import_react56.useMemo)(() => {
|
|
15443
|
+
if (!geoJsonData) return null;
|
|
15579
15444
|
if (useServerFiltering || !filterParams || Object.keys(filterParams).length === 0) {
|
|
15580
15445
|
return geoJsonData;
|
|
15581
15446
|
}
|
|
@@ -15670,13 +15535,13 @@ var CanopyMapControlList = () => {
|
|
|
15670
15535
|
const setControls = useMapControlStore((state) => state.setControls);
|
|
15671
15536
|
const currentControls = useMapControlStore((state) => state.controls);
|
|
15672
15537
|
const map = (0, import_react_leaflet26.useMap)();
|
|
15673
|
-
const [filterParams, setFilterParams] = (0,
|
|
15674
|
-
const prevSelectionStateRef = (0,
|
|
15538
|
+
const [filterParams, setFilterParams] = (0, import_react57.useState)({});
|
|
15539
|
+
const prevSelectionStateRef = (0, import_react57.useRef)(false);
|
|
15675
15540
|
const { enableSelection, disableSelection, isSelectionActive } = useAreaSelect({});
|
|
15676
|
-
const handleFilterChange = (0,
|
|
15541
|
+
const handleFilterChange = (0, import_react57.useCallback)((filters) => {
|
|
15677
15542
|
setFilterParams(filters);
|
|
15678
15543
|
}, []);
|
|
15679
|
-
const baseControls = (0,
|
|
15544
|
+
const baseControls = (0, import_react57.useMemo)(() => {
|
|
15680
15545
|
var _a, _b, _c, _d, _e, _f;
|
|
15681
15546
|
const openStates = currentControls.reduce(
|
|
15682
15547
|
(acc, control) => {
|
|
@@ -15752,7 +15617,7 @@ var CanopyMapControlList = () => {
|
|
|
15752
15617
|
disableSelection,
|
|
15753
15618
|
currentControls
|
|
15754
15619
|
]);
|
|
15755
|
-
(0,
|
|
15620
|
+
(0, import_react57.useEffect)(() => {
|
|
15756
15621
|
if (prevSelectionStateRef.current !== isSelectionActive) {
|
|
15757
15622
|
const updatedControls = [
|
|
15758
15623
|
...baseControls,
|
|
@@ -15781,7 +15646,7 @@ var CanopyMapControlList = () => {
|
|
|
15781
15646
|
prevSelectionStateRef.current = isSelectionActive;
|
|
15782
15647
|
}
|
|
15783
15648
|
}, [baseControls, isSelectionActive, setControls, disableSelection]);
|
|
15784
|
-
(0,
|
|
15649
|
+
(0, import_react57.useEffect)(() => {
|
|
15785
15650
|
if (currentControls.length === 0) {
|
|
15786
15651
|
setControls(baseControls);
|
|
15787
15652
|
}
|
|
@@ -15812,15 +15677,14 @@ var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
|
15812
15677
|
var CanopyMap = () => {
|
|
15813
15678
|
var _a, _b, _c, _d, _e, _f;
|
|
15814
15679
|
const { data: mapSettings, isLoading: isSettingsLoading } = (0, import_useMapSettings4.default)();
|
|
15815
|
-
const mapRef = (0,
|
|
15680
|
+
const mapRef = (0, import_react58.useRef)();
|
|
15816
15681
|
const zoom = ((_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) || 5;
|
|
15817
15682
|
const center4 = [
|
|
15818
15683
|
((_d = (_c = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _c.Latitude) == null ? void 0 : _d.Text) || 48.2082,
|
|
15819
15684
|
((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
|
|
15820
15685
|
];
|
|
15821
|
-
(0,
|
|
15822
|
-
if (isSettingsLoading)
|
|
15823
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_ui41.LoaderFull, { showInCenter: false });
|
|
15686
|
+
(0, import_core30.useRenderInfo)("BasicMap");
|
|
15687
|
+
if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_ui41.LoaderFull, { showInCenter: false });
|
|
15824
15688
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_jsx_runtime74.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
15825
15689
|
import_react_leaflet27.MapContainer,
|
|
15826
15690
|
{
|
|
@@ -15849,13 +15713,13 @@ var CanopyMap = () => {
|
|
|
15849
15713
|
};
|
|
15850
15714
|
|
|
15851
15715
|
// src/Components/Basf/basf-left-panel.tsx
|
|
15852
|
-
var
|
|
15716
|
+
var import_react59 = require("react");
|
|
15853
15717
|
var import_ui42 = require("@geowiki/ui");
|
|
15854
15718
|
var import_react_hook_form6 = require("react-hook-form");
|
|
15855
15719
|
var z3 = __toESM(require("zod"));
|
|
15856
15720
|
var import_uuid4 = require("uuid");
|
|
15857
15721
|
var import_zod2 = require("@hookform/resolvers/zod");
|
|
15858
|
-
var
|
|
15722
|
+
var import_core31 = require("@geowiki/core");
|
|
15859
15723
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
15860
15724
|
var formSchema2 = z3.object({
|
|
15861
15725
|
formType: z3.enum(["Biomass", "CropProduction"], {
|
|
@@ -15907,20 +15771,20 @@ var formSchema2 = z3.object({
|
|
|
15907
15771
|
}
|
|
15908
15772
|
).default("2020")
|
|
15909
15773
|
});
|
|
15910
|
-
var ForwardedSelect3 = (0,
|
|
15774
|
+
var ForwardedSelect3 = (0, import_react59.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_ui42.Select, __spreadProps(__spreadValues({}, props), { ref })));
|
|
15911
15775
|
ForwardedSelect3.displayName = "ForwardedSelect";
|
|
15912
15776
|
var BasfLeftPanel = () => {
|
|
15913
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
15777
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react59.useState)(false);
|
|
15914
15778
|
const { clearData } = useSelectedPixelStore();
|
|
15915
|
-
const isLeftOverlayOpen = (0,
|
|
15916
|
-
(0,
|
|
15779
|
+
const isLeftOverlayOpen = (0, import_core31.useBasfStore)(
|
|
15780
|
+
(0, import_react59.useCallback)((state) => state.leftPanelOpen, [])
|
|
15917
15781
|
);
|
|
15918
|
-
const setIsLeftOverlayOpen = (0,
|
|
15919
|
-
(0,
|
|
15782
|
+
const setIsLeftOverlayOpen = (0, import_core31.useBasfStore)(
|
|
15783
|
+
(0, import_react59.useCallback)((state) => state.updateLeftPanelOpen, [])
|
|
15920
15784
|
);
|
|
15921
|
-
const addItem = (0,
|
|
15922
|
-
const selectedItems = (0,
|
|
15923
|
-
(0,
|
|
15785
|
+
const addItem = (0, import_core31.useBasfStore)((0, import_react59.useCallback)((state) => state.addItem, []));
|
|
15786
|
+
const selectedItems = (0, import_core31.useBasfStore)(
|
|
15787
|
+
(0, import_react59.useCallback)((state) => state.selectedItems, [])
|
|
15924
15788
|
);
|
|
15925
15789
|
const {
|
|
15926
15790
|
control,
|
|
@@ -15935,7 +15799,7 @@ var BasfLeftPanel = () => {
|
|
|
15935
15799
|
const scenario = watch("scenario");
|
|
15936
15800
|
const price = watch("price");
|
|
15937
15801
|
const year = watch("year");
|
|
15938
|
-
const checkIfItemExists = (0,
|
|
15802
|
+
const checkIfItemExists = (0, import_react59.useCallback)(
|
|
15939
15803
|
(data) => {
|
|
15940
15804
|
return selectedItems.some(
|
|
15941
15805
|
(item) => item.formType === data.formType && item.scenario === data.scenario && item.price === data.price && item.product === data.product && item.item === data.item && item.year === data.year
|
|
@@ -15943,8 +15807,8 @@ var BasfLeftPanel = () => {
|
|
|
15943
15807
|
},
|
|
15944
15808
|
[selectedItems]
|
|
15945
15809
|
);
|
|
15946
|
-
const onSubmit = (0,
|
|
15947
|
-
(data) => __async(
|
|
15810
|
+
const onSubmit = (0, import_react59.useCallback)(
|
|
15811
|
+
(data) => __async(null, null, function* () {
|
|
15948
15812
|
setIsSubmitting(true);
|
|
15949
15813
|
try {
|
|
15950
15814
|
if (checkIfItemExists(data)) {
|
|
@@ -15967,7 +15831,7 @@ var BasfLeftPanel = () => {
|
|
|
15967
15831
|
}),
|
|
15968
15832
|
[checkIfItemExists, addItem]
|
|
15969
15833
|
);
|
|
15970
|
-
(0,
|
|
15834
|
+
(0, import_react59.useEffect)(() => {
|
|
15971
15835
|
if (formType === "CropProduction") {
|
|
15972
15836
|
reset({
|
|
15973
15837
|
formType: "CropProduction",
|
|
@@ -15988,7 +15852,7 @@ var BasfLeftPanel = () => {
|
|
|
15988
15852
|
});
|
|
15989
15853
|
}
|
|
15990
15854
|
}, [formType, reset]);
|
|
15991
|
-
const handleTogglePanel = (0,
|
|
15855
|
+
const handleTogglePanel = (0, import_react59.useCallback)(() => {
|
|
15992
15856
|
setIsLeftOverlayOpen(!isLeftOverlayOpen);
|
|
15993
15857
|
}, [isLeftOverlayOpen, setIsLeftOverlayOpen]);
|
|
15994
15858
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
@@ -16019,22 +15883,22 @@ var BasfLeftPanel = () => {
|
|
|
16019
15883
|
}
|
|
16020
15884
|
);
|
|
16021
15885
|
};
|
|
16022
|
-
var basf_left_panel_default = (0,
|
|
15886
|
+
var basf_left_panel_default = (0, import_react59.memo)(BasfLeftPanel);
|
|
16023
15887
|
|
|
16024
15888
|
// src/Components/Basf/basf-right-panel.tsx
|
|
16025
|
-
var
|
|
15889
|
+
var import_core32 = require("@geowiki/core");
|
|
16026
15890
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
16027
15891
|
|
|
16028
15892
|
// src/Components/Map/GeoWikiMap.tsx
|
|
16029
|
-
var
|
|
15893
|
+
var import_react60 = require("react");
|
|
16030
15894
|
var import_react_leaflet28 = require("react-leaflet");
|
|
16031
15895
|
var import_leaflet23 = require("leaflet/dist/leaflet.css");
|
|
16032
15896
|
var import_dist = require("@bopen/leaflet-area-selection/dist/index.css");
|
|
16033
|
-
var
|
|
15897
|
+
var import_core34 = require("@geowiki/core");
|
|
16034
15898
|
var import_ui43 = require("@geowiki/ui");
|
|
16035
15899
|
|
|
16036
15900
|
// ../../apps/geowiki/components/Map/CustomWMS.tsx
|
|
16037
|
-
var
|
|
15901
|
+
var import_core33 = require("@react-leaflet/core");
|
|
16038
15902
|
|
|
16039
15903
|
// ../../apps/geowiki/lib/utils/BetterWMS.ts
|
|
16040
15904
|
var import_leaflet22 = __toESM(require("leaflet"));
|
|
@@ -16153,8 +16017,7 @@ var BetterWMS2 = class extends import_leaflet22.default.TileLayer.WMS {
|
|
|
16153
16017
|
if (url) {
|
|
16154
16018
|
fetch(url).then((res) => res.json()).then((data) => {
|
|
16155
16019
|
this.showGetFeatureInfo(event.latlng, data);
|
|
16156
|
-
if (this.onInfoReceived)
|
|
16157
|
-
this.onInfoReceived(data);
|
|
16020
|
+
if (this.onInfoReceived) this.onInfoReceived(data);
|
|
16158
16021
|
}).catch((err) => {
|
|
16159
16022
|
console.log(err);
|
|
16160
16023
|
});
|
|
@@ -16163,19 +16026,19 @@ var BetterWMS2 = class extends import_leaflet22.default.TileLayer.WMS {
|
|
|
16163
16026
|
};
|
|
16164
16027
|
|
|
16165
16028
|
// ../../apps/geowiki/components/Map/CustomWMS.tsx
|
|
16166
|
-
var CustomWMSTileLayer2 = (0,
|
|
16029
|
+
var CustomWMSTileLayer2 = (0, import_core33.createTileLayerComponent)(
|
|
16167
16030
|
function createWMSTileLayer3(_a, context) {
|
|
16168
16031
|
var _b = _a, { params = {}, url } = _b, options = __objRest(_b, ["params", "url"]);
|
|
16169
16032
|
var instance = new BetterWMS2(url, __spreadValues(__spreadProps(__spreadValues({}, params), {
|
|
16170
16033
|
url
|
|
16171
|
-
}), (0,
|
|
16034
|
+
}), (0, import_core33.withPane)(options, context)));
|
|
16172
16035
|
return {
|
|
16173
16036
|
instance,
|
|
16174
16037
|
context
|
|
16175
16038
|
};
|
|
16176
16039
|
},
|
|
16177
16040
|
function updateWMSTileLayer3(layer, props, prevProps) {
|
|
16178
|
-
(0,
|
|
16041
|
+
(0, import_core33.updateGridLayer)(layer, props, prevProps);
|
|
16179
16042
|
if (props.params != null && props.params !== prevProps.params) {
|
|
16180
16043
|
layer.setParams(props.params);
|
|
16181
16044
|
}
|
|
@@ -16188,7 +16051,7 @@ var import_react_hotkeys_hook3 = require("react-hotkeys-hook");
|
|
|
16188
16051
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
16189
16052
|
var GeoWikiMapComponent = ({ mapSettings, session }) => {
|
|
16190
16053
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
16191
|
-
const mapRef = (0,
|
|
16054
|
+
const mapRef = (0, import_react60.useRef)();
|
|
16192
16055
|
const router = (0, import_router5.useRouter)();
|
|
16193
16056
|
var projectId = router.query.projectId;
|
|
16194
16057
|
var locationId = router.query.locationId;
|
|
@@ -16196,23 +16059,23 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
|
|
|
16196
16059
|
const layerStore = useMapLayerStore();
|
|
16197
16060
|
const mapStore = useMapStore();
|
|
16198
16061
|
const evolandStore = useEvolandStore();
|
|
16199
|
-
const panelStore = (0,
|
|
16200
|
-
const evolandFeature = (0,
|
|
16201
|
-
var userRole = (0,
|
|
16202
|
-
var userId = (0,
|
|
16203
|
-
const { data: wmsLayerNames } = (0,
|
|
16204
|
-
const { data: geoWikiSettings } = (0,
|
|
16205
|
-
const { data: introTourSteps } = (0,
|
|
16206
|
-
const [showAsset, setShowAsset] = (0,
|
|
16207
|
-
const [fetchLocationMetaData, setFetchLocationMetaData] = (0,
|
|
16208
|
-
const [defaultActivityView, setDefaultActivityView] = (0,
|
|
16062
|
+
const panelStore = (0, import_core34.usePanelStore)();
|
|
16063
|
+
const evolandFeature = (0, import_core34.useFeature)("GeoWiki.EvoLand");
|
|
16064
|
+
var userRole = (0, import_core34.tokenData)((_a = session.data) == null ? void 0 : _a.accessToken, "role");
|
|
16065
|
+
var userId = (0, import_core34.tokenData)((_b = session.data) == null ? void 0 : _b.accessToken, "sub");
|
|
16066
|
+
const { data: wmsLayerNames } = (0, import_core34.useEvolandWmsLayers)();
|
|
16067
|
+
const { data: geoWikiSettings } = (0, import_core34.useGeoWikiSettings)();
|
|
16068
|
+
const { data: introTourSteps } = (0, import_core34.useIntroTourSettings)();
|
|
16069
|
+
const [showAsset, setShowAsset] = (0, import_react60.useState)(false);
|
|
16070
|
+
const [fetchLocationMetaData, setFetchLocationMetaData] = (0, import_react60.useState)(false);
|
|
16071
|
+
const [defaultActivityView, setDefaultActivityView] = (0, import_react60.useState)("");
|
|
16209
16072
|
let accordionData = [];
|
|
16210
16073
|
var zoom = ((_d = (_c = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _c.Zoom) == null ? void 0 : _d.Value) || 12;
|
|
16211
16074
|
var center4 = [
|
|
16212
16075
|
((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Latitude) == null ? void 0 : _f.Text) || 48.2082,
|
|
16213
16076
|
((_h = (_g = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _g.Longitude) == null ? void 0 : _h.Text) || 16.3738
|
|
16214
16077
|
];
|
|
16215
|
-
(0,
|
|
16078
|
+
(0, import_core34.useRenderInfo)("GeoWikiMap");
|
|
16216
16079
|
if (!fetchLocationMetaData && (evolandStore.referenceDate || evolandStore.reference_dates)) {
|
|
16217
16080
|
evolandStore.getLocationMetaData(locationId, parseInt(projectId), taskId);
|
|
16218
16081
|
setFetchLocationMetaData(true);
|
|
@@ -16266,9 +16129,9 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
|
|
|
16266
16129
|
return JSON.parse(introTourSteps.LiquidPart.Liquid.toString()).mainPanel;
|
|
16267
16130
|
}
|
|
16268
16131
|
};
|
|
16269
|
-
(0,
|
|
16132
|
+
(0, import_react60.useEffect)(() => {
|
|
16270
16133
|
var _a2;
|
|
16271
|
-
if ((0,
|
|
16134
|
+
if ((0, import_core34.IsTokenExpired)((_a2 = session.data) == null ? void 0 : _a2.expires)) {
|
|
16272
16135
|
evolandStore.setSessionTimeOut(true);
|
|
16273
16136
|
}
|
|
16274
16137
|
}, [evolandStore.sessionTimeOut, (_l = session.data) == null ? void 0 : _l.expires]);
|
|
@@ -16291,7 +16154,7 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
|
|
|
16291
16154
|
{
|
|
16292
16155
|
variant: "outline",
|
|
16293
16156
|
className: "flex ml-20",
|
|
16294
|
-
onClick: () => (0,
|
|
16157
|
+
onClick: () => (0, import_core34.showIntroTour)(selectIntroTourSteps()),
|
|
16295
16158
|
children: "Guide"
|
|
16296
16159
|
}
|
|
16297
16160
|
) }),
|
|
@@ -16570,21 +16433,21 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
|
|
|
16570
16433
|
] }) })
|
|
16571
16434
|
] });
|
|
16572
16435
|
};
|
|
16573
|
-
var GeoWikiMap = (0,
|
|
16436
|
+
var GeoWikiMap = (0, import_react60.memo)(GeoWikiMapComponent);
|
|
16574
16437
|
|
|
16575
16438
|
// src/Components/Map/WaybackTimelineMap.tsx
|
|
16576
|
-
var
|
|
16439
|
+
var import_react61 = require("react");
|
|
16577
16440
|
var import_react_leaflet29 = require("react-leaflet");
|
|
16578
|
-
var
|
|
16441
|
+
var import_core35 = require("@geowiki/core");
|
|
16579
16442
|
var import_navigation3 = require("next/navigation");
|
|
16580
16443
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
16581
16444
|
var WaybackTimelineMap = (props) => {
|
|
16582
16445
|
var _a;
|
|
16583
|
-
const mapRef = (0,
|
|
16446
|
+
const mapRef = (0, import_react61.useRef)(null);
|
|
16584
16447
|
const searchParams = (0, import_navigation3.useSearchParams)();
|
|
16585
16448
|
var center4 = [48.2082, 16.3738];
|
|
16586
|
-
(0,
|
|
16587
|
-
const [WAYBACK_SNAPSHOTS, setWAYBACK_SNAPSHOTS] = (0,
|
|
16449
|
+
(0, import_core35.useRenderInfo)("WaybackTimelineMap");
|
|
16450
|
+
const [WAYBACK_SNAPSHOTS, setWAYBACK_SNAPSHOTS] = (0, import_react61.useState)(null);
|
|
16588
16451
|
function MapZoomEvents() {
|
|
16589
16452
|
const mapEvents = (0, import_react_leaflet29.useMapEvents)({
|
|
16590
16453
|
zoomend: () => {
|
|
@@ -16593,9 +16456,8 @@ var WaybackTimelineMap = (props) => {
|
|
|
16593
16456
|
});
|
|
16594
16457
|
return null;
|
|
16595
16458
|
}
|
|
16596
|
-
(0,
|
|
16597
|
-
if (props.mapping)
|
|
16598
|
-
setWAYBACK_SNAPSHOTS(props.mapping);
|
|
16459
|
+
(0, import_react61.useEffect)(() => {
|
|
16460
|
+
if (props.mapping) setWAYBACK_SNAPSHOTS(props.mapping);
|
|
16599
16461
|
}, [props.mapping]);
|
|
16600
16462
|
const west = parseFloat(searchParams.get("xmin"));
|
|
16601
16463
|
const south = parseFloat(searchParams.get("ymin"));
|