Browse Source

hidden entite points are displayed without being accessible #2151 #2188

bach 1 year ago
parent
commit
7ef77fd71e

+ 8 - 6
src/components/ConcernementMapItem.vue

@@ -210,8 +210,9 @@ export default {
           x: this.entites[i].display.ray * Math.cos(this.entites[i].display.alpha * (Math.PI/180)),
           y: this.entites[i].display.ray * Math.sin(this.entites[i].display.alpha * (Math.PI/180))
         }
-
-        this.entites_byid[entite.entite.id].display = this.entites[i].display;
+        if (entite.entite) {
+          this.entites_byid[entite.entite.id].display = this.entites[i].display;
+        }
       }
     },
     getSalientPoints_OLD() {
@@ -557,12 +558,13 @@ export default {
       });
       for (let i = 0; i < this.entites.length; i++) {
         // use paper symbol
-        let instance = new paper.SymbolItem(this.paper_symbol_definitions['entite']);
+        let symbol_name = this.entites[i].entite ? 'entite' : 'entite_hidden';
+        let instance = new paper.SymbolItem(this.paper_symbol_definitions[symbol_name]);
         instance.name = 'entite';
         instance.position = new paper.Point([this.pos.x + this.entites[i].display.pos.x, this.pos.y + this.entites[i].display.pos.y]);
         instance.fillColor = '#000';
-        instance.item_id = this.entites[i].entite.id;
-        instance.item_type = 'entite';
+        instance.item_id = this.entites[i].entite ? this.entites[i].entite.id : null;
+        instance.item_type = this.entites[i].entite ? 'entite' : 'hidden_entite';
         instance.is_symbol_instance = true;
         g.addChild(instance)
       }
@@ -574,7 +576,7 @@ export default {
         name: 'agissantes'
       });
       for (let i = 0; i < this.entites.length; i++) {
-        if (this.entites[i].entite.agissante) {
+        if (this.entites[i].entite && this.entites[i].entite.agissante) {
           let instance = new paper.SymbolItem(this.paper_symbol_definitions['entite_action']);
           instance.name = 'entite_action';
           instance.position = new paper.Point([this.pos.x + this.entites[i].display.pos.x, this.pos.y + this.entites[i].display.pos.y]);

+ 11 - 0
src/components/MapConcernements.vue

@@ -208,6 +208,7 @@ export default {
       this.addPaperSymbolDefinition('doleance_icon', this.setPaperDoleanceICONSymbol());
       //
       this.addPaperSymbolDefinition('entite', this.setPaperEntiteSymbol());
+      this.addPaperSymbolDefinition('entite_hidden', this.setPaperHiddenEntiteSymbol());
       this.addPaperSymbolDefinition('entite_hover', this.setPaperEntiteHoverSymbol());
       this.addPaperSymbolDefinition('entite_action', this.setPaperEntiteActionSymbol());
       this.addPaperSymbolDefinition('entite_action_hover', this.setPaperEntiteActionHoverSymbol());
@@ -874,6 +875,16 @@ export default {
         strokeWidth:2
       })
     },
+    setPaperHiddenEntiteSymbol(){
+      return new paper.Path.Circle({
+        pivot: new paper.Point({x:0,y:0}),
+        center: [0,0],
+        radius: 0.7, //0.3
+        fillColor: '#fff',
+        strokeColor: 'rgba(255,255,255,0.05)',
+        strokeWidth:2
+      })
+    },
     setPaperEntiteHoverSymbol(){
       return new paper.Path.Circle({
         pivot: new paper.Point({x:0,y:0}),

+ 5 - 5
src/stores/concernements.js

@@ -56,7 +56,7 @@ export const ConcernementsStore = defineStore({
         // console.log('ast', ast);
         GQL.post('', { query: print(ast) })
           .then(({ data : { data  : { allconcernements } } }) => {
-            console.log('loadconcernements loaded', allconcernements)
+            console.log('loadconcernements all loaded', allconcernements)
             this.concernements = [];
             // parse concernements
             allconcernements.forEach(concernement => {
@@ -65,9 +65,9 @@ export const ConcernementsStore = defineStore({
               concernement.entites_byid = {};
               concernement.entitesagissantes_byid = {};
               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
-              entites_temp.forEach(entite => {
+              // 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
+              concernement.entites.forEach(entite => {
                 if (entite.entite) { // entite.entite may be null because of workflow confidentiality
                   concernement.entites_byid[entite.entite.id] = entite;
                   // record entite agissante
@@ -77,7 +77,7 @@ 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
+                  // concernement.entites.push(entite); // fill the entites array with visible entite only
                 }
               });