started to code superpositions
This commit is contained in:
@@ -21,6 +21,8 @@ export const ConcernementsStore = defineStore({
|
||||
concernementsByID: {},
|
||||
allEntitesById: {},
|
||||
allBesoinsById: {},
|
||||
allSuperpositions: [],
|
||||
allProximites: [],
|
||||
opened_concernement: false,
|
||||
opened_entite_id: null,
|
||||
opened_recit: false,
|
||||
@@ -64,6 +66,8 @@ export const ConcernementsStore = defineStore({
|
||||
|
||||
concernement.entites_byid = {};
|
||||
concernement.entitesagissantes_byid = {};
|
||||
concernement.has_proximites = false;
|
||||
concernement.has_superpositions = false;
|
||||
concernement.has_agissantes = false;
|
||||
// var entites_temp = concernement.entites; // record a temp entites liste
|
||||
// concernement.entites = []; // erase the concernement.entite array as we want to keep only visible entites
|
||||
@@ -78,6 +82,47 @@ export const ConcernementsStore = defineStore({
|
||||
// record a flat list of all entités of all concernement for map-popup
|
||||
this.allEntitesById[entite.entite.id] = entite;
|
||||
// concernement.entites.push(entite); // fill the entites array with visible entite only
|
||||
|
||||
// PROXIMITES
|
||||
if (entite.entite.proximite.length) {
|
||||
console.log("proximite", entite.entite.proximite);
|
||||
concernement.has_proximites = true;
|
||||
}
|
||||
|
||||
// SUPERPOSITIONS
|
||||
if (entite.entite.superposition.length) {
|
||||
concernement.has_superpositions = true;
|
||||
entite.entite.superposition.forEach(entite_superpose => {
|
||||
// console.log(`superposition eid:${entite.entite.id}, teid:${entite_superpose.id}`);
|
||||
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)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (superposition.indexOf(entite.entite.id) >= 0) {
|
||||
already_recorded = true;
|
||||
if (superposition.indexOf(entite_superpose.id) < 0) {
|
||||
superposition.push(entite_superpose.id)
|
||||
}
|
||||
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);
|
||||
this.allSuperpositions.push([
|
||||
entite.entite.id, // entite id
|
||||
entite_superpose.id // target id
|
||||
])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,6 +155,7 @@ export const ConcernementsStore = defineStore({
|
||||
this.concernementsByID[concernement.id] = concernement;
|
||||
|
||||
});
|
||||
console.log('this.allSuperpositions', this.allSuperpositions);
|
||||
this.concernements_loaded = true;
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user