superpositions on map are ok

This commit is contained in:
2023-09-01 15:50:24 +02:00
parent 764ec8ad18
commit a6dc15d646
3 changed files with 200 additions and 50 deletions

View File

@@ -97,27 +97,44 @@ export const ConcernementsStore = defineStore({
let already_recorded = false;
// loop through all already recorded superposition to complete the array instead of create duplicates
for(let superposition of this.allSuperpositions) {
if (superposition.indexOf(entite_superpose.id) >= 0) {
already_recorded = true;
if (superposition.indexOf(entite.entite.id) < 0) {
superposition.push(entite.entite.id)
// if (superposition.indexOf(entite_superpose.id) >= 0) {
// already_recorded = true;
// if (superposition.indexOf(entite.entite.id) < 0) {
// superposition.push(entite.entite.id)
// }
// break;
// }
// if (superposition.indexOf(entite.entite.id) >= 0) {
// already_recorded = true;
// if (superposition.indexOf(entite_superpose.id) < 0) {
// superposition.push(entite_superpose.id)
// }
// break;
// }
for(let superposition_item of superposition) {
if (superposition_item.eid === entite.entite.id && !superposition_item.cid) {
console.log(`already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title);
already_recorded = true;
superposition_item.cid = concernement.id;
break;
}
break;
}
if (superposition.indexOf(entite.entite.id) >= 0) {
already_recorded = true;
if (superposition.indexOf(entite_superpose.id) < 0) {
superposition.push(entite_superpose.id)
}
if (already_recorded) {
break;
}
}
// if not already recorded, add it to the array
if (!already_recorded) {
// console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, this.allSuperpositions);
console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title);
this.allSuperpositions.push([
entite.entite.id, // entite id
entite_superpose.id // target id
{
cid: concernement.id,
eid: entite.entite.id
},
{
cid: null,
eid: entite_superpose.id
}
])
}
})