mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Point: Fix points order at DB loading.
parent
e0cee0fbef
commit
9482aaf523
|
|
@ -175,7 +175,7 @@ class PointXYZ(Point):
|
||||||
return new
|
return new
|
||||||
|
|
||||||
table = execute(
|
table = execute(
|
||||||
"SELECT pamhyr_id, deleted, " +
|
"SELECT pamhyr_id, ind, deleted, " +
|
||||||
"name, x, y, z, sl, scenario " +
|
"name, x, y, z, sl, scenario " +
|
||||||
"FROM geometry_pointXYZ " +
|
"FROM geometry_pointXYZ " +
|
||||||
f"WHERE profile = {profile.pamhyr_id} " +
|
f"WHERE profile = {profile.pamhyr_id} " +
|
||||||
|
|
@ -188,6 +188,7 @@ class PointXYZ(Point):
|
||||||
it = iter(row)
|
it = iter(row)
|
||||||
|
|
||||||
pid = next(it)
|
pid = next(it)
|
||||||
|
ind = next(it)
|
||||||
deleted = (next(it) == 1)
|
deleted = (next(it) == 1)
|
||||||
name = next(it)
|
name = next(it)
|
||||||
x = next(it)
|
x = next(it)
|
||||||
|
|
@ -218,7 +219,7 @@ class PointXYZ(Point):
|
||||||
)
|
)
|
||||||
|
|
||||||
loaded.add(pid)
|
loaded.add(pid)
|
||||||
new.append(point)
|
new.append((ind, point))
|
||||||
|
|
||||||
data["scenario"] = scenario.parent
|
data["scenario"] = scenario.parent
|
||||||
new += cls._db_load(execute, data)
|
new += cls._db_load(execute, data)
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,15 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
data["profile"] = profile
|
data["profile"] = profile
|
||||||
profile._points = PointXYZ._db_load(execute, data.copy())
|
profile._points = list(
|
||||||
|
map(
|
||||||
|
lambda ip: ip[1],
|
||||||
|
sorted(
|
||||||
|
PointXYZ._db_load(execute, data.copy()),
|
||||||
|
key=lambda ip: ip[0]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
loaded.add(pid)
|
loaded.add(pid)
|
||||||
new.append(profile)
|
new.append(profile)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue