|
@@ -31,6 +31,7 @@ export default {
|
|
|
concernement: null,
|
|
|
active_revision: null,
|
|
|
entities: null,
|
|
|
+ activeEntites: null,
|
|
|
superposedEntiteID: null,
|
|
|
// superposedEntitesIDsList: [],
|
|
|
canvas: null,
|
|
@@ -116,9 +117,9 @@ export default {
|
|
|
//
|
|
|
this.parseEntityPointsValues();
|
|
|
|
|
|
-
|
|
|
+ let activeEntites = this.getActiveEntites(this.entites);
|
|
|
// this.getSalientPoints()
|
|
|
- this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(this.entites)
|
|
|
+ this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(activeEntites)
|
|
|
|
|
|
// define init position of the item
|
|
|
this.pos = this.getRandomPos();
|
|
@@ -412,7 +413,7 @@ export default {
|
|
|
// TODO sometimes active revision is not on revisions_by_id ... why ?
|
|
|
let revisions_ids = Object.keys(this.concernement.revisions_byid);
|
|
|
if (revisions_ids.indexOf(this.concernement.revision_id) !== -1) {
|
|
|
- this.entites = this.concernement.revisions_byid[this.concernement.revision_id].entites;
|
|
|
+ this.entites = this.concernement.revisions_byid[this.concernement.revision_id].entites;
|
|
|
} else {
|
|
|
this.entites = this.concernement.revisions_byid[revisions_ids.pop()].entites;
|
|
|
}
|
|
@@ -465,6 +466,17 @@ export default {
|
|
|
this.concernement.parsedEntites = true;
|
|
|
|
|
|
},
|
|
|
+ getActiveEntites(entites){
|
|
|
+ // console.log('getActiveEntites', entites);
|
|
|
+
|
|
|
+ let activeEntites = [];
|
|
|
+ for (let i = 0; i < entites.length; i++) {
|
|
|
+ if (entites[i].active) {
|
|
|
+ activeEntites.push(entites[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return activeEntites;
|
|
|
+ },
|
|
|
getSalientPoints_OLD() {
|
|
|
// debugger
|
|
|
// console.log(this.entites);
|
|
@@ -500,6 +512,12 @@ export default {
|
|
|
// console.log(`this.salientPoints ${this.concernement.id}`, this.salientPoints);
|
|
|
},
|
|
|
getJarvisEnvelopeConvexeEntites(entites){
|
|
|
+ // console.log(`getJarvisEnvelopeConvexeEntites cid:${this.cid}`, entites);
|
|
|
+ if (entites.length === 0) {
|
|
|
+ console.error('getJarvisEnvelopeConvexeEntites entites must not be empty')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
let sailentEntites = [];
|
|
|
// https://www.geeksforgeeks.org/convex-hull-using-jarvis-algorithm-or-wrapping/
|
|
|
// find the most left point
|
|
@@ -530,19 +548,21 @@ export default {
|
|
|
// clockwise than q, then update q.
|
|
|
q = (p + 1) % entites.length;
|
|
|
for (let i = 0; i < entites.length; i++) {
|
|
|
- let p_x = (entites[p].display.ray) * Math.cos(entites[p].display.alpha * (Math.PI/180));
|
|
|
- let p_y = (entites[p].display.ray) * Math.sin(entites[p].display.alpha * (Math.PI/180));
|
|
|
- let i_x = (entites[i].display.ray) * Math.cos(entites[i].display.alpha * (Math.PI/180));
|
|
|
- let i_y = (entites[i].display.ray) * Math.sin(entites[i].display.alpha * (Math.PI/180));
|
|
|
- let q_x = (entites[q].display.ray) * Math.cos(entites[q].display.alpha * (Math.PI/180));
|
|
|
- let q_y = (entites[q].display.ray) * Math.sin(entites[q].display.alpha * (Math.PI/180));
|
|
|
-
|
|
|
- let val = (i_y - p_y) * (q_x - i_x) - (i_x - p_x) * (q_y - i_y);
|
|
|
-
|
|
|
- // If i is more clockwise than current q, then update q
|
|
|
- if (val > 0){
|
|
|
- q = i;
|
|
|
- }
|
|
|
+ // if (entite.active) {
|
|
|
+ let p_x = (entites[p].display.ray) * Math.cos(entites[p].display.alpha * (Math.PI/180));
|
|
|
+ let p_y = (entites[p].display.ray) * Math.sin(entites[p].display.alpha * (Math.PI/180));
|
|
|
+ let i_x = (entites[i].display.ray) * Math.cos(entites[i].display.alpha * (Math.PI/180));
|
|
|
+ let i_y = (entites[i].display.ray) * Math.sin(entites[i].display.alpha * (Math.PI/180));
|
|
|
+ let q_x = (entites[q].display.ray) * Math.cos(entites[q].display.alpha * (Math.PI/180));
|
|
|
+ let q_y = (entites[q].display.ray) * Math.sin(entites[q].display.alpha * (Math.PI/180));
|
|
|
+
|
|
|
+ let val = (i_y - p_y) * (q_x - i_x) - (i_x - p_x) * (q_y - i_y);
|
|
|
+
|
|
|
+ // If i is more clockwise than current q, then update q
|
|
|
+ if (val > 0){
|
|
|
+ q = i;
|
|
|
+ }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
// Now q is the most clockwise with
|
|
@@ -817,7 +837,8 @@ export default {
|
|
|
});
|
|
|
// rebuild the contours with the new ray
|
|
|
this.parseEntityPointsValues()
|
|
|
- this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(this.entites)
|
|
|
+ let activeEntites = this.getActiveEntites(this.entites);
|
|
|
+ this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(activeEntites)
|
|
|
// redraw the contours
|
|
|
this.paper_main_object.addChild(this.setPaperContour());
|
|
|
|
|
@@ -916,8 +937,9 @@ export default {
|
|
|
console.log(`entite len : ${this.concernement.revisions_byid[this.active_revision].entites.length}`);
|
|
|
|
|
|
this.parseEntityPointsValues()
|
|
|
-
|
|
|
- this.sailentEntites = this.getJarvisEnvelopeConvexeEntites(this.concernement.revisions_byid[this.active_revision].entites);
|
|
|
+
|
|
|
+ let activeEntites = this.getActiveEntites(this.concernement.revisions_byid[this.active_revision].entites);
|
|
|
+ this.sailentEntites = this.getJarvisEnvelopeConvexeEntites(activeEntites);
|
|
|
|
|
|
// remove contours if already exists
|
|
|
if (this.paper_main_object.children && this.paper_main_object.children.contours) {
|
|
@@ -1098,23 +1120,29 @@ export default {
|
|
|
// for (let i = 0; i < this.entites.length; i++) {
|
|
|
for (let i = 0; i < this.concernement.revisions_byid[this.active_revision].entites.length; i++) {
|
|
|
let entite = this.concernement.revisions_byid[this.active_revision].entites[i];
|
|
|
+
|
|
|
+ if (!entite.active && !this.concernement.can_update) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
// item type
|
|
|
- let item_type = entite.entite ? entite.entite.agissante ? 'entite_action' : 'entite' : 'entite_hidden';
|
|
|
+ let item_type = entite.entite ? entite.entite.agissante ? 'entite_action' : entite.active ? 'entite' : 'entite_inactive' : 'entite_hidden';
|
|
|
|
|
|
// use paper symbol
|
|
|
let symbol_name = item_type;
|
|
|
- switch (item_type) {
|
|
|
- case 'entite':
|
|
|
- if(parseInt(this.opened_entite_id) === entite.entite.id){
|
|
|
+ if(parseInt(this.opened_entite_id) === entite.entite.id){
|
|
|
+ switch (item_type) {
|
|
|
+ case 'entite':
|
|
|
symbol_name = 'entite_hover';
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'entite_action':
|
|
|
- if(parseInt(this.opened_entite_id) === entite.entite.id){
|
|
|
+ break;
|
|
|
+ case 'inactive_entite':
|
|
|
+ symbol_name = 'entite_inactive_hover';
|
|
|
+ break;
|
|
|
+ case 'entite_action':
|
|
|
symbol_name = 'entite_action_hover';
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// console.log(`item_type: ${item_type}, symbol_name: ${symbol_name}`);
|
|
|
|
|
@@ -1398,9 +1426,10 @@ export default {
|
|
|
}); // end of loop on proximite for each main entite
|
|
|
|
|
|
|
|
|
+ let activeEntites = this.getActiveEntites(allEntiteRefConcernementContourEntites);
|
|
|
// general contour arround proximité
|
|
|
// console.log('allEntiteRefConcernementContourEntites', allEntiteRefConcernementContourEntites);
|
|
|
- let genContoursEntite = this.getJarvisEnvelopeConvexeEntites(allEntiteRefConcernementContourEntites);
|
|
|
+ let genContoursEntite = this.getJarvisEnvelopeConvexeEntites(activeEntites);
|
|
|
// console.log('genContoursEntite', genContoursEntite);
|
|
|
let points = [];
|
|
|
genContoursEntite.forEach(ent => {
|
|
@@ -2132,11 +2161,15 @@ export default {
|
|
|
group.children.forEach((item) => {
|
|
|
if (this.opened_entite_id && item.item_id === parseInt(this.opened_entite_id) && item.item_type !== 'entite_hidden') {
|
|
|
// switch symbole definition to hover
|
|
|
- item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite_hover : this.paper_symbol_definitions.entite_action_hover;
|
|
|
+ item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite_hover
|
|
|
+ : item.item_type === 'entite_inactive' ? this.paper_symbol_definitions.entite_inactive_hover
|
|
|
+ : this.paper_symbol_definitions.entite_action_hover;
|
|
|
} else {
|
|
|
// switch back symbole definition to normal
|
|
|
if ((!this.hover_elmt || item.item_id !== this.hover_elmt.id) && item.item_type !== 'entite_hidden') {
|
|
|
- item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite : this.paper_symbol_definitions.entite_action;
|
|
|
+ item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite
|
|
|
+ : item.item_type === 'entite_inactive' ? this.paper_symbol_definitions.entite_inactive
|
|
|
+ : this.paper_symbol_definitions.entite_action;
|
|
|
}
|
|
|
}
|
|
|
})
|