@mytec: iter3.2.2 ready for test
This commit is contained in:
@@ -47,6 +47,7 @@ from app.services.materials_service import materials_service
|
||||
from app.services.dominant_path_service import (
|
||||
dominant_path_service, find_dominant_paths_vectorized,
|
||||
get_lod_level, LODLevel, SIMPLIFIED_MAX_BUILDINGS,
|
||||
_filter_buildings_by_distance,
|
||||
)
|
||||
from app.services.street_canyon_service import street_canyon_service, Street
|
||||
from app.services.reflection_service import reflection_service
|
||||
@@ -853,6 +854,16 @@ class CoverageService:
|
||||
if spatial_idx else buildings
|
||||
)
|
||||
|
||||
# Cap building count for the intersection loop — query_line can
|
||||
# return hundreds of buildings; sort by proximity so the first
|
||||
# intersecting building is found faster (loop breaks early).
|
||||
if len(nearby_buildings) > 50:
|
||||
nearby_buildings = _filter_buildings_by_distance(
|
||||
nearby_buildings,
|
||||
(site.lat, site.lon), (lat, lon),
|
||||
max_count=50, max_distance=500,
|
||||
)
|
||||
|
||||
if settings.use_buildings and nearby_buildings:
|
||||
site_total_h = site.height + site_elevation
|
||||
point_total_h = 1.5 + point_elevation
|
||||
@@ -897,22 +908,22 @@ class CoverageService:
|
||||
try:
|
||||
# LOD_SIMPLIFIED: limit buildings for mid-range points (1.5-3km)
|
||||
dp_buildings = nearby_buildings
|
||||
dp_spatial = spatial_idx
|
||||
if lod == LODLevel.SIMPLIFIED:
|
||||
timing.setdefault("lod_simplified", 0)
|
||||
timing["lod_simplified"] += 1
|
||||
if len(nearby_buildings) > SIMPLIFIED_MAX_BUILDINGS:
|
||||
dp_buildings = nearby_buildings[:SIMPLIFIED_MAX_BUILDINGS]
|
||||
dp_spatial = None # Skip spatial queries, use filtered list only
|
||||
else:
|
||||
timing.setdefault("lod_full", 0)
|
||||
timing["lod_full"] += 1
|
||||
|
||||
# nearby_buildings already filtered via spatial index —
|
||||
# don't pass spatial_idx to avoid redundant query_line()
|
||||
# and query_point() inside the vectorized function.
|
||||
dominant = find_dominant_paths_vectorized(
|
||||
site.lat, site.lon, site.height,
|
||||
lat, lon, 1.5,
|
||||
site.frequency, dp_buildings,
|
||||
spatial_idx=dp_spatial,
|
||||
)
|
||||
if dominant['path_type'] == 'direct':
|
||||
has_los = True
|
||||
|
||||
Reference in New Issue
Block a user