started to code superpositions
This commit is contained in:
parent
e080c4ac5e
commit
764ec8ad18
@ -52,6 +52,14 @@ fragment ConcernementFields on Concernement {
|
||||
entite {
|
||||
id
|
||||
agissante
|
||||
proximite {
|
||||
id
|
||||
title
|
||||
}
|
||||
superposition {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,6 +463,10 @@ export default {
|
||||
// the sub items for one concernement
|
||||
this.paper_main_object.addChild(this.setPaperContour());
|
||||
|
||||
if (this.concernement.has_superpositions) {
|
||||
this.paper_main_object.addChild(this.setPaperSuperpositions());
|
||||
}
|
||||
|
||||
if (this.concernement.has_puissancedagir) {
|
||||
this.addNewPaperSymbolInstance('puissanceagir_icon', false, 0.7);
|
||||
}
|
||||
@ -635,6 +639,31 @@ export default {
|
||||
}
|
||||
return g;
|
||||
},
|
||||
setPaperSuperpositions(){
|
||||
console.log('setPaperSuperpositions');
|
||||
let g = new paper.Group({
|
||||
pivot: new paper.Point(this.pos),
|
||||
name: 'entites_superposes'
|
||||
});
|
||||
for (let i = 0; i < this.concernement.revisions_byid[this.concernement.active_revision].entites.length; i++) {
|
||||
let entite = this.concernement.revisions_byid[this.concernement.active_revision].entites[i];
|
||||
if (entite.entite && entite.entite.superposition.length) {
|
||||
// console.log(`entite ${entite.entite.id}`, entite, entite.entite.superposition);
|
||||
// use paper symbol
|
||||
let instance = new paper.SymbolItem(this.paper_symbol_definitions['entite']);
|
||||
instance.name = 'entite';
|
||||
instance.position = new paper.Point([this.pos.x + entite.display.pos.x * this.scale, this.pos.y + entite.display.pos.y * this.scale]);
|
||||
// instance.scale(this.scale);
|
||||
instance.scale(3);
|
||||
instance.fillColor = '#000';
|
||||
instance.item_id = entite.entite.id;
|
||||
instance.item_type = 'entite_superpose';
|
||||
instance.is_symbol_instance = true;
|
||||
g.addChild(instance)
|
||||
}
|
||||
}
|
||||
return g;
|
||||
},
|
||||
setPaperAgissantes(){
|
||||
console.log('setPaperAgissantes');
|
||||
let g = new paper.Group({
|
||||
@ -1086,6 +1115,20 @@ export default {
|
||||
this.paper_main_object.children['contours'].visible = false;
|
||||
}
|
||||
|
||||
// proximite
|
||||
|
||||
// superposition
|
||||
if (this.concernement.has_superpositions) {
|
||||
if (this.map_mode === "superposition") {
|
||||
if (!this.is_opened) {
|
||||
this.paper_main_object.children.entites_superposes.visible = true; // if not opened and has_superpositions draw the entites_superposes points
|
||||
} else {
|
||||
this.paper_main_object.children.entites_superposes.visible = false;
|
||||
}
|
||||
} else {
|
||||
this.paper_main_object.children.entites_superposes.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// puissance d'agir
|
||||
if (this.concernement.has_puissancedagir) {
|
||||
@ -1436,7 +1479,9 @@ export default {
|
||||
if (this.opened_concernement.id !== this.id) {
|
||||
this.pushAside()
|
||||
}
|
||||
} else if (this.map_mode === 'puissancedagir'
|
||||
} else if (this.map_mode === 'proximite'
|
||||
|| this.map_mode === 'superposition'
|
||||
|| this.map_mode === 'puissancedagir'
|
||||
|| this.map_mode === 'action'
|
||||
|| this.map_mode === 'doleancer'){ // apply focus forces : move unfocused on the sides and focused on the center
|
||||
this.applyFocusForces(); //
|
||||
@ -1457,6 +1502,8 @@ export default {
|
||||
},
|
||||
isFocused(){
|
||||
return this.map_mode === 'terraindevie'
|
||||
|| (this.map_mode === 'proximite' && this.concernement.has_proximites)
|
||||
|| (this.map_mode === 'superposition' && this.concernement.has_superpositions)
|
||||
|| (this.map_mode === 'action' && this.concernement.has_agissantes)
|
||||
|| (this.map_mode === 'puissancedagir' && this.concernement.has_puissancedagir)
|
||||
|| (this.map_mode === 'doleancer' && this.concernement.has_doleance);
|
||||
|
@ -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 => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user