mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-29 19:10:42 +01:00
debug geometry
This commit is contained in:
1 parent
0946212c4b
commit
5357eb9735
2 files changed
+29
-4
No files matched your search
@@ -197,8 +197,10 @@ class Reach(SQLSubModel):
|
||||
self.undelete([profile])
|
||||
profile.num = index
|
||||
else:
|
||||
profile.num = index
|
||||
self._profiles.insert(index, profile)
|
||||
gi = self.get_global_profil_index(index)
|
||||
profile.num = gi
|
||||
print(f"gi = {gi}")
|
||||
self._profiles.insert(gi, profile)
|
||||
|
||||
self.modified()
|
||||
|
||||
@@ -211,11 +213,12 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
gi = [self.get_global_profil_index(i) for i in indexes]
|
||||
list(
|
||||
map(
|
||||
lambda p: p[1].set_as_deleted(),
|
||||
filter(
|
||||
lambda e: e[0] in indexes,
|
||||
lambda e: e[0] in gi,
|
||||
enumerate(self._profiles)
|
||||
)
|
||||
)
|
||||
@@ -231,11 +234,12 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
gi = [self.get_global_profil_index(i) for i in indexes]
|
||||
self._profiles = list(
|
||||
map(
|
||||
lambda p: p[1],
|
||||
filter(
|
||||
lambda e: e[0] not in indexes,
|
||||
lambda e: e[0] not in gi,
|
||||
enumerate(self._profiles)
|
||||
)
|
||||
)
|
||||
@@ -931,3 +935,24 @@ class Reach(SQLSubModel):
|
||||
nr2._profiles = list(map(lambda p: p.cloned_for(nr2), nr2_profiles))
|
||||
|
||||
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.
Reference in new issue
Block a user