refactor(db)!: finalize pooled WNDB v2 migration

This commit is contained in:
2026-08-27 17:26:22 +08:00
parent fa188af0b1
commit b74799a39d
105 changed files with 4988 additions and 5565 deletions
+6 -41
View File
@@ -32,14 +32,11 @@ from app.native.wndb.commands.api import (
)
from app.native.wndb.core.database import ChangeSet, read_all
from app.native.wndb.core.projects import (
close_project,
copy_project,
create_project,
delete_project,
have_project,
is_project_open,
list_project,
open_project,
)
from app.native.wndb.gis.backdrop import (
get_backdrop,
@@ -54,6 +51,12 @@ from app.native.wndb.gis.labels import (
get_label_schema,
set_label,
)
from app.native.wndb.gis.network_views import (
get_major_node_coords,
get_major_pipe_nodes,
get_network_link_nodes,
get_network_node_coords,
)
from app.native.wndb.gis.region_geometry import get_nodes_in_region
from app.native.wndb.gis.regions import (
add_region,
@@ -89,16 +92,11 @@ from app.native.wndb.model.elements import (
get_curves,
get_element_type,
get_element_type_value,
get_link_nodes,
get_link_type,
get_links,
get_links_id_and_type,
get_major_nodes,
get_major_pipes,
get_node_links,
get_node_type,
get_nodes,
get_nodes_id_and_type,
get_patterns,
get_regions,
is_curve,
@@ -280,39 +278,6 @@ def get_element_properties(name: str, element_id: str) -> dict[str, Any]:
return get_scada_info(name, element_id)
def get_network_node_coords(name: str) -> dict[str, dict[str, Any]]:
nodes = get_nodes_id_and_type(name)
return {
node_id: {**get_node_coord(name, node_id), "type": node_type}
for node_id, node_type in nodes.items()
}
def get_major_node_coords(name: str, diameter: int) -> dict[str, dict[str, Any]]:
node_types = get_nodes_id_and_type(name)
return {
node_id: {**get_node_coord(name, node_id), "type": node_types[node_id]}
for node_id in get_major_nodes(name, diameter)
}
def get_network_link_nodes(name: str) -> list[str]:
links = get_links_id_and_type(name)
return [
f"{link_id}:{link_type}:{nodes[0]}:{nodes[1]}"
for link_id, link_type in links.items()
if (nodes := get_link_nodes(name, link_id))
]
def get_major_pipe_nodes(name: str, diameter: int) -> list[str]:
return [
f"{link_id}:pipe:{nodes[0]}:{nodes[1]}"
for link_id in get_major_pipes(name, diameter)
if (nodes := get_link_nodes(name, link_id))
]
def get_network_in_extent(
name: str, x1: float, y1: float, x2: float, y2: float
) -> dict[str, Any]: