mirror of https://gitlab.com/pamhyr/pamhyr2
debug geometry
parent
0946212c4b
commit
5357eb9735
|
|
@ -197,8 +197,10 @@ class Reach(SQLSubModel):
|
||||||
self.undelete([profile])
|
self.undelete([profile])
|
||||||
profile.num = index
|
profile.num = index
|
||||||
else:
|
else:
|
||||||
profile.num = index
|
gi = self.get_global_profil_index(index)
|
||||||
self._profiles.insert(index, profile)
|
profile.num = gi
|
||||||
|
print(f"gi = {gi}")
|
||||||
|
self._profiles.insert(gi, profile)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
|
|
@ -211,11 +213,12 @@ class Reach(SQLSubModel):
|
||||||
Returns:
|
Returns:
|
||||||
Nothing.
|
Nothing.
|
||||||
"""
|
"""
|
||||||
|
gi = [self.get_global_profil_index(i) for i in indexes]
|
||||||
list(
|
list(
|
||||||
map(
|
map(
|
||||||
lambda p: p[1].set_as_deleted(),
|
lambda p: p[1].set_as_deleted(),
|
||||||
filter(
|
filter(
|
||||||
lambda e: e[0] in indexes,
|
lambda e: e[0] in gi,
|
||||||
enumerate(self._profiles)
|
enumerate(self._profiles)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -231,11 +234,12 @@ class Reach(SQLSubModel):
|
||||||
Returns:
|
Returns:
|
||||||
Nothing.
|
Nothing.
|
||||||
"""
|
"""
|
||||||
|
gi = [self.get_global_profil_index(i) for i in indexes]
|
||||||
self._profiles = list(
|
self._profiles = list(
|
||||||
map(
|
map(
|
||||||
lambda p: p[1],
|
lambda p: p[1],
|
||||||
filter(
|
filter(
|
||||||
lambda e: e[0] not in indexes,
|
lambda e: e[0] not in gi,
|
||||||
enumerate(self._profiles)
|
enumerate(self._profiles)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -931,3 +935,24 @@ class Reach(SQLSubModel):
|
||||||
nr2._profiles = list(map(lambda p: p.cloned_for(nr2), nr2_profiles))
|
nr2._profiles = list(map(lambda p: p.cloned_for(nr2), nr2_profiles))
|
||||||
|
|
||||||
return nr1, nr2
|
return nr1, nr2
|
||||||
|
|
||||||
|
def get_local_profil_index(self, index):
|
||||||
|
local_index = -1
|
||||||
|
for i, p in enumerate(self._profiles):
|
||||||
|
if not p.is_deleted():
|
||||||
|
local_index += 1
|
||||||
|
if i == index:
|
||||||
|
break
|
||||||
|
|
||||||
|
return local_index
|
||||||
|
|
||||||
|
def get_global_profil_index(self, index):
|
||||||
|
local_index = -1
|
||||||
|
for i, p in enumerate(self._profiles):
|
||||||
|
if not p.is_deleted():
|
||||||
|
local_index += 1
|
||||||
|
if local_index == index:
|
||||||
|
global_index = i
|
||||||
|
break
|
||||||
|
|
||||||
|
return global_index
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue