added linear slider

This commit is contained in:
2026-06-15 08:40:27 +03:00
parent ab2a3bb035
commit 2f303134c1
20 changed files with 481 additions and 196 deletions
+9 -4
View File
@@ -371,6 +371,7 @@ def _offset_m(lat: float, lon: float, north_m: float, east_m: float) -> tuple[fl
_MAX_GRID_POINTS = 2500
_MAX_GRID_POINTS_FINE = 12000
def _auto_step_m(radius_m: float) -> float:
@@ -401,11 +402,15 @@ def _sample_circular_grid(
return cells
def _resolve_grid_step(lat: float, lon: float, radius_m: float, step_m: float) -> float:
def _resolve_grid_step(
lat: float, lon: float, radius_m: float, step_m: float
) -> float:
if step_m <= 0:
step_m = _auto_step_m(radius_m)
step_m = max(5.0, min(float(step_m), 100.0))
while len(_sample_circular_grid(lat, lon, radius_m, step_m)) > _MAX_GRID_POINTS:
min_step = 1.0 if radius_m <= 100.0 else 5.0
step_m = max(min_step, min(float(step_m), 100.0))
max_points = _MAX_GRID_POINTS_FINE if radius_m <= 100.0 and step_m <= 1.0 else _MAX_GRID_POINTS
while len(_sample_circular_grid(lat, lon, radius_m, step_m)) > max_points:
step_m = math.ceil(step_m * 1.25)
if step_m >= radius_m:
break
@@ -427,7 +432,7 @@ def build_elevation_grid(
"elevation_url": ELEVATION_API_URL,
}
radius_m = max(100.0, min(float(radius_m), 500.0))
radius_m = max(50.0, min(float(radius_m), 500.0))
step_m = _resolve_grid_step(lat, lon, radius_m, step_m)
center_elev = fetch_elevation_m(lat, lon)