Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,16 @@ export function ProcessingMenu({
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuLabel className="text-xs text-muted-foreground">
{t("toolbar.item.subGroupH3")}
{t("toolbar.item.subGroupDggs")}
</DropdownMenuLabel>
<DropdownMenuItem onSelect={() => setVectorToolOpen("h3-grid")}>
{t("toolbar.vectorTool.h3Grid")}
<DropdownMenuItem onSelect={() => setVectorToolOpen("dggs-grid")}>
{t("toolbar.vectorTool.dggsGenerator")}
</DropdownMenuItem>
<DropdownMenuItem onSelect={() => setVectorToolOpen("h3-bin-points")}>
{t("toolbar.vectorTool.h3BinPoints")}
<DropdownMenuItem onSelect={() => setVectorToolOpen("dggs-bin")}>
{t("toolbar.vectorTool.dggsBinning")}
</DropdownMenuItem>
<DropdownMenuItem onSelect={() => setVectorToolOpen("dggs-compact")}>
{t("toolbar.vectorTool.dggsCompact")}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuLabel className="text-xs text-muted-foreground">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ export const VECTOR_TOOL_COMMANDS: Array<{
{ kind: "smooth", titleKey: "toolbar.vectorTool.smooth" },
{ kind: "grid", titleKey: "toolbar.vectorTool.grid" },
{ kind: "voronoi", titleKey: "toolbar.vectorTool.voronoi" },
{ kind: "h3-grid", titleKey: "toolbar.vectorTool.h3Grid" },
{ kind: "h3-bin-points", titleKey: "toolbar.vectorTool.h3BinPoints" },
{ kind: "dggs-grid", titleKey: "toolbar.vectorTool.dggsGenerator" },
{ kind: "dggs-bin", titleKey: "toolbar.vectorTool.dggsBinning" },
{ kind: "dggs-compact", titleKey: "toolbar.vectorTool.dggsCompact" },
];

export const RASTER_TOOL_COMMANDS: Array<{
Expand Down
25 changes: 15 additions & 10 deletions apps/geolibre-desktop/src/components/processing/ParameterField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,21 @@ export function ParameterField({

if (param.type === "boolean") {
return (
<label className="flex items-center gap-2 text-sm" htmlFor={param.id}>
<input
id={param.id}
type="checkbox"
checked={Boolean(value)}
onChange={(e) => onChange(e.target.checked)}
className="h-4 w-4 rounded border-input"
/>
{param.label}
</label>
<div className="flex flex-col gap-1">
<label className="flex items-center gap-2 text-sm" htmlFor={param.id}>
<input
id={param.id}
type="checkbox"
checked={Boolean(value)}
onChange={(e) => onChange(e.target.checked)}
className="h-4 w-4 rounded border-input"
/>
{param.label}
</label>
{param.description ? (
<p className="text-xs text-muted-foreground ps-6">{param.description}</p>
) : null}
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
type StatisticsToolKind,
type VectorToolKind,
} from "@geolibre/core";
import { resolveVectorRerun } from "@geolibre/processing";
import { allAlgorithms } from "../../lib/scripting/scriptingApi";
import {
Button,
Expand Down Expand Up @@ -127,16 +128,22 @@ export function ProcessingHistoryDialog(): ReactElement {
// the reopened dialog is visible.
const openForRun = useCallback(
(run: ProcessingRun, autoRun: boolean) => {
// Pre-DGGS history may still store h3-grid / h3-bin-points — map those
// onto dggs-* before queuing the re-run and opening the dialog.
const vectorResolved =
run.kind === "vector" ? resolveVectorRerun(run.toolId, run.parameters) : null;
const toolId = vectorResolved?.toolId ?? run.toolId;
const parameters = vectorResolved?.parameters ?? run.parameters;
setProcessingRerun({
kind: run.kind,
toolId: run.toolId,
parameters: run.parameters,
toolId,
parameters,
engine: run.engine,
autoRun,
});
switch (run.kind) {
case "vector":
setVectorToolOpen(run.toolId as VectorToolKind);
setVectorToolOpen(toolId as VectorToolKind);
break;
case "statistics":
setStatisticsToolOpen(run.toolId as StatisticsToolKind);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { detectGeometryProfile, type MapController } from "@geolibre/map";
import {
VECTOR_TOOLS,
getVectorTool,
resolveVectorRerun,
runVectorTool,
fetchVectorStatus,
maxResolutionForDggs,
type AlgorithmParameter,
type GeometryFamily,
type ProcessingAlgorithm,
Expand Down Expand Up @@ -109,33 +111,39 @@ export function VectorToolsDialog({ mapControllerRef }: VectorToolsDialogProps):
// win over the defaults when both effects fire in the same commit.
useEffect(() => {
if (!open || !rerun || rerun.kind !== "vector") return;
// A saved-project history entry can reference a tool that was renamed or
// removed since; drop the request instead of leaving it pending forever.
if (!getVectorTool(rerun.toolId)) {
// History may still carry pre-DGGS H3 tool ids — map them before lookup so
// we do not clear the request as "unavailable" and leave it pending.
const resolved = resolveVectorRerun(rerun.toolId, rerun.parameters);
if (!getVectorTool(resolved.toolId)) {
setLog((prev) => [
...prev,
`Error: ${t("processing.history.toolUnavailable", { toolId: rerun.toolId })}`,
]);
setProcessingRerun(null);
return;
}
if (rerun.toolId !== tool.id) return;
setParams({ ...rerun.parameters });
if (resolved.toolId !== tool.id) {
// Alias mapped to a different tool than the one currently selected
// (e.g. History opened with a stale VectorToolKind). Switch over.
if (selectedId !== resolved.toolId) setSelectedId(resolved.toolId);
return;
}
setParams({ ...resolved.parameters });
if (rerun.engine === "client" || rerun.engine === "sidecar" || rerun.engine === "pyodide") {
// A history entry recorded on a sidecar run re-runs on Pyodide in the
// Mac App Store build, where the sidecar engine does not exist.
setEngine(rerun.engine === "sidecar" && IS_MAS_BUILD ? "pyodide" : rerun.engine);
}
setProcessingRerun(null);
if (rerun.autoRun) setAutoRunPending(true);
}, [open, rerun, tool, setProcessingRerun, t]);
}, [open, rerun, tool, selectedId, setProcessingRerun, t]);

// Prefill the H3 grid's manual bounding-box fields from the current map
// Prefill the DGGS Generator's manual bounding-box fields from the current map
// viewport when the user first switches to that source, so they can tweak the
// box rather than type it from scratch. Only fills empty fields, so it never
// clobbers manual edits. Keyed on the source value, not every keystroke.
useEffect(() => {
if (selectedId !== "h3-grid" || params.source !== "bbox") return;
if (selectedId !== "dggs-grid" || params.source !== "bbox") return;
if (
params.west !== undefined ||
params.south !== undefined ||
Expand Down Expand Up @@ -475,16 +483,43 @@ export function VectorToolsDialog({ mapControllerRef }: VectorToolsDialogProps):
<p className="text-sm text-muted-foreground">{tool.description}</p>

<div className="flex flex-col gap-3">
{tool.parameters.filter(isParamVisible).map((param) => (
<ParameterField
key={param.id}
param={param}
value={params[param.id]}
layerOptions={layerOptions(param.geometryFilter)}
fieldOptions={param.type === "field" ? fieldOptions(param) : undefined}
onChange={(value) => handleParamChange(param.id, value)}
/>
))}
{tool.parameters.filter(isParamVisible).map((param) => {
// Narrow the resolution spinner to the selected DGGS type's range.
const fieldParam =
(tool.id === "dggs-grid" ||
tool.id === "dggs-bin" ||
tool.id === "dggs-compact") &&
param.id === "resolution"
? (() => {
const dggsType =
params.dggsType === "s2" ||
params.dggsType === "a5" ||
params.dggsType === "dggrid" ||
params.dggsType === "dggal"
? params.dggsType
: "h3";
const rawSubtype =
dggsType === "dggal" ? params.dggalType : params.dggridType;
const subtype = typeof rawSubtype === "string" ? rawSubtype : undefined;
const max = maxResolutionForDggs(dggsType, subtype);
return {
...param,
max,
label: t("processing.vectorTools.resolutionRange", { max }),
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
})()
: param;
return (
<ParameterField
key={param.id}
param={fieldParam}
value={params[param.id]}
layerOptions={layerOptions(param.geometryFilter)}
fieldOptions={param.type === "field" ? fieldOptions(param) : undefined}
onChange={(value) => handleParamChange(param.id, value)}
/>
);
})}
</div>

{tool.supportsSidecar || tool.requiresSidecar ? (
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2398,8 +2398,6 @@
"grid": "شبكة منتظمة",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "تغطية المواقع الخلوية",
"h3Grid": "إنشاء شبكة H3",
"h3BinPoints": "تجميع النقاط في خلايا H3",
"trajectorySpeed": "سرعة مسار الحركة",
"detectStops": "اكتشاف التوقفات",
"spaceTimeProximity": "التقارب الزماني المكاني",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Regelmäßiges Raster",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Mobilfunkzellen-Abdeckung",
"h3Grid": "H3-Raster erstellen",
"h3BinPoints": "Punkte zu H3 binnen",
"trajectorySpeed": "Trajektoriengeschwindigkeit",
"detectStops": "Stopps erkennen",
"spaceTimeProximity": "Raum-Zeit-Nähe",
Expand Down
23 changes: 13 additions & 10 deletions apps/geolibre-desktop/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2232,8 +2232,9 @@
"grid": "Regular grid",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cell-site coverage",
"h3Grid": "Create H3 grid",
"h3BinPoints": "Bin points to H3",
"dggsGenerator": "DGGS Generator",
"dggsBinning": "DGGS Binning",
"dggsCompact": "DGGS Compact",
"trajectorySpeed": "Trajectory speed",
"detectStops": "Detect stops",
"spaceTimeProximity": "Space-time proximity",
Expand Down Expand Up @@ -2418,7 +2419,8 @@
"subGroupOverlay": "Overlay",
"subGroupJoin": "Join",
"subGroupSelect": "Select",
"subGroupH3": "H3",
"subGroupDggs": "DGGS",
"subGroupH3": "DGGS",
"subGroupMovement": "Movement & time",
"subGroupDataQuality": "Data quality",
"subGroupTerrain": "Terrain",
Expand Down Expand Up @@ -2999,9 +3001,9 @@
"title": "OLC",
"controlTitle": "OLC settings",
"autoResolution": "Automatic resolution",
"resolution": "Code length",
"resolution": "Resolution",
"cellCount": "{{count}} cells in view",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the code length.",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the resolution.",
"fillColor": "Fill color",
"fillOpacity": "Fill opacity",
"lineColor": "Outline color",
Expand All @@ -3026,9 +3028,9 @@
"title": "Geohash",
"controlTitle": "Geohash settings",
"autoResolution": "Automatic resolution",
"resolution": "Precision",
"resolution": "Resolution",
"cellCount": "{{count}} cells in view",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the precision.",
"tooManyCells": "This view exceeds the {{limit}} cell limit. Zoom in or lower the resolution.",
"fillColor": "Fill color",
"fillOpacity": "Fill opacity",
"lineColor": "Outline color",
Expand All @@ -3053,9 +3055,9 @@
"title": "Tilecode",
"controlTitle": "Tilecode settings",
"autoResolution": "Automatic resolution",
"resolution": "Zoom level",
"resolution": "Resolution",
"cellCount": "{{count}} tiles in view",
"tooManyCells": "This view exceeds the {{limit}} tile limit. Zoom in or lower the zoom level.",
"tooManyCells": "This view exceeds the {{limit}} tile limit. Zoom in or lower the resolution.",
"fillColor": "Fill color",
"fillOpacity": "Fill opacity",
"lineColor": "Outline color",
Expand Down Expand Up @@ -3990,7 +3992,8 @@
"sidecarUnavailablePyodide": "The GeoPandas sidecar is not available. Start the sidecar with the vector extra, or switch to Python (Pyodide).",
"pyodideNote": "Runs GeoPandas in your browser. The first run downloads the Python runtime (one-time, needs an internet connection).",
"run": "Run",
"outputPlaceholder": "Output will appear here."
"outputPlaceholder": "Output will appear here.",
"resolutionRange": "Resolution (0-{{max}})"
}
},
"segmentation": {
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Cuadrícula regular",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cobertura de sitios celulares",
"h3Grid": "Crear cuadrícula H3",
"h3BinPoints": "Agrupar puntos en H3",
"trajectorySpeed": "Velocidad de trayectoria",
"detectStops": "Detectar paradas",
"spaceTimeProximity": "Proximidad espacio-temporal",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Grille régulière",
"voronoi": "Voronoï / Delaunay",
"cellSectors": "Couverture de site cellulaire",
"h3Grid": "Créer une grille H3",
"h3BinPoints": "Regrouper les points en H3",
"trajectorySpeed": "Vitesse de trajectoire",
"detectStops": "Détecter les arrêts",
"spaceTimeProximity": "Proximité spatio-temporelle",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "नियमित ग्रिड",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "सेल-साइट कवरेज",
"h3Grid": "H3 ग्रिड बनाएं",
"h3BinPoints": "बिंदुओं को H3 में बिन करें",
"trajectorySpeed": "प्रक्षेपवक्र गति",
"detectStops": "रुकावटें पहचानें",
"spaceTimeProximity": "स्थान-समय निकटता",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,6 @@
"grid": "Grid teratur",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cakupan sel BTS",
"h3Grid": "Buat grid H3",
"h3BinPoints": "Bin titik ke H3",
"trajectorySpeed": "Kecepatan lintasan",
"detectStops": "Deteksi pemberhentian",
"spaceTimeProximity": "Kedekatan ruang-waktu",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Griglia regolare",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Copertura delle celle radio",
"h3Grid": "Crea griglia H3",
"h3BinPoints": "Assegna punti a celle H3",
"trajectorySpeed": "Velocità di traiettoria",
"detectStops": "Rileva soste",
"spaceTimeProximity": "Prossimità spazio-temporale",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,6 @@
"grid": "正方格子",
"voronoi": "ボロノイ / ドロネー",
"cellSectors": "セルサイトのカバレッジ",
"h3Grid": "H3グリッドを作成",
"h3BinPoints": "ポイントをH3にビン化",
"trajectorySpeed": "軌跡速度",
"detectStops": "停止を検出",
"spaceTimeProximity": "時空間近接",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ka.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "რეგულარული ბადე",
"voronoi": "ვორონოი / დელონე",
"cellSectors": "ფიჭური საიტის დაფარვა",
"h3Grid": "H3 ბადის შექმნა",
"h3BinPoints": "წერტილების დაჯგუფება H3-ში",
"trajectorySpeed": "ტრაექტორიის სიჩქარე",
"detectStops": "გაჩერებების ამოცნობა",
"spaceTimeProximity": "სივრცე-დროითი სიახლოვე",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,6 @@
"grid": "정규 격자",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "기지국 커버리지",
"h3Grid": "H3 격자 생성",
"h3BinPoints": "포인트를 H3 셀로 구간화",
"trajectorySpeed": "궤적 속도",
"detectStops": "정지 지점 감지",
"spaceTimeProximity": "시공간 근접성",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Regelmatig raster",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Dekkingsgebied zendmast",
"h3Grid": "H3-raster maken",
"h3BinPoints": "Punten binnen in H3",
"trajectorySpeed": "Trajectsnelheid",
"detectStops": "Stops detecteren",
"spaceTimeProximity": "Ruimte-tijdnabijheid",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,6 @@
"grid": "Grade regular",
"voronoi": "Voronoi / Delaunay",
"cellSectors": "Cobertura de estações de célula",
"h3Grid": "Criar grade H3",
"h3BinPoints": "Agrupar pontos em H3",
"trajectorySpeed": "Velocidade da trajetória",
"detectStops": "Detectar paradas",
"spaceTimeProximity": "Proximidade espaço-temporal",
Expand Down
2 changes: 0 additions & 2 deletions apps/geolibre-desktop/src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -2315,8 +2315,6 @@
"grid": "Регулярная сетка",
"voronoi": "Вороного / Делоне",
"cellSectors": "Зоны покрытия базовых станций",
"h3Grid": "Создать сетку H3",
"h3BinPoints": "Группировать точки в H3",
"trajectorySpeed": "Скорость траектории",
"detectStops": "Определить остановки",
"spaceTimeProximity": "Пространственно-временная близость",
Expand Down
Loading
Loading