|
@@ -74,7 +74,8 @@ export default {
|
|
|
...mapState(ConcernementsStore,['opened_concernement']),
|
|
|
...mapState(ConcernementsStore,['opened_entite_id']),
|
|
|
...mapState(CommonStore,['hover_elmt']),
|
|
|
- ...mapState(CommonStore,['cartouch_width'])
|
|
|
+ ...mapState(CommonStore,['cartouch_width']),
|
|
|
+ ...mapState(CommonStore,['paper_symbol_definitions'])
|
|
|
},
|
|
|
created () {
|
|
|
// console.log(`ConcernementsMapItem ${this.concernement.id} created`, this.canvasMap, this.matterEngine);
|
|
@@ -369,11 +370,14 @@ export default {
|
|
|
},
|
|
|
// PAPER OBJECTS
|
|
|
initPaperObjects(){
|
|
|
+ // the main paper group containing all paper graphical items for one concernement
|
|
|
this.paper_main_object = new paper.Group({
|
|
|
pivot: new paper.Point(this.pos),
|
|
|
cid: this.id
|
|
|
});
|
|
|
- this.paper_main_object.addChild(this.setPaperBoussoleBG());
|
|
|
+
|
|
|
+ // the sub items for one concernement
|
|
|
+ this.addNewPaperSymbolInstance('boussole_bg');
|
|
|
this.paper_main_object.addChild(this.setPaperContour());
|
|
|
this.paper_main_object.addChild(this.setPaperEntites());
|
|
|
// this.paper_groups.entites = this.setPaperEntites()
|
|
@@ -395,165 +399,12 @@ export default {
|
|
|
|
|
|
this.initPaperEvents()
|
|
|
},
|
|
|
- setPaperBoussoleBG(){
|
|
|
- // BOUSSOLE
|
|
|
- let children = [];
|
|
|
- let ray = this.ray*0.92*this.scale;
|
|
|
-
|
|
|
- // // // exterieur circle
|
|
|
- // children.push(new paper.Path.Circle({
|
|
|
- // center: [this.pos.x, this.pos.y],
|
|
|
- // radius: ray,
|
|
|
- // strokeWidth: 2
|
|
|
- // }));
|
|
|
-
|
|
|
- // // interieur circle
|
|
|
- // children.push(new paper.Path.Circle({
|
|
|
- // center: [this.pos.x, this.pos.y],
|
|
|
- // radius: this.ray/2*this.scale,
|
|
|
- // strokeWidth: 2
|
|
|
- // }));
|
|
|
-
|
|
|
- // cercles pointillés
|
|
|
- for (let i = 1; i < 9; i++) {
|
|
|
- let sw = i === 4 || i === 8 ? 2 : 1;
|
|
|
- let da = i === 4 || i === 8 ? null : [5,5];
|
|
|
- children.push(new paper.Path.Circle({
|
|
|
- center: [this.pos.x, this.pos.y],
|
|
|
- radius: ray/8*i,
|
|
|
- strokeColor: '#fff',
|
|
|
- strokeWidth: sw,
|
|
|
- dashArray: da
|
|
|
- }));
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // axes
|
|
|
- // vertical
|
|
|
- children.push(new paper.Path.Line({
|
|
|
- from: [this.pos.x, this.pos.y - ray],
|
|
|
- to: [this.pos.x, this.pos.y + ray],
|
|
|
- strokeColor: '#fff',
|
|
|
- strokeWidth: 2
|
|
|
- }));
|
|
|
- // horizontal
|
|
|
- children.push(new paper.Path.Line({
|
|
|
- from: [this.pos.x - ray, this.pos.y],
|
|
|
- to: [this.pos.x + ray, this.pos.y],
|
|
|
- strokeColor: '#fff',
|
|
|
- strokeWidth: 2
|
|
|
- }))
|
|
|
-
|
|
|
- // fleches
|
|
|
- // haute
|
|
|
- children.push(new paper.Path({
|
|
|
- segments: [
|
|
|
- [this.pos.x - (8*this.scale), this.pos.y - ray + (8*this.scale)],
|
|
|
- [this.pos.x, this.pos.y - ray],
|
|
|
- [this.pos.x + (8*this.scale), this.pos.y - ray + (8*this.scale)],
|
|
|
- ],
|
|
|
- strokeWidth: 2,
|
|
|
- strokeColor: '#fff',
|
|
|
- }));
|
|
|
- // milieu
|
|
|
- children.push(new paper.Path({
|
|
|
- segments: [
|
|
|
- [this.pos.x - (8*this.scale), this.pos.y + (8*this.scale)],
|
|
|
- [this.pos.x, this.pos.y],
|
|
|
- [this.pos.x + (8*this.scale), this.pos.y + (8*this.scale)],
|
|
|
- ],
|
|
|
- strokeWidth: 2,
|
|
|
- strokeColor: '#fff',
|
|
|
- }));
|
|
|
-
|
|
|
-
|
|
|
- // MOINS - PLUS
|
|
|
- // PLUS
|
|
|
- // horizontal
|
|
|
- children.push(new paper.Path.Line({
|
|
|
- from: [this.pos.x + ray - (5 * this.scale), this.pos.y - ray],
|
|
|
- to: [this.pos.x + ray + (5 * this.scale), this.pos.y - ray],
|
|
|
- strokeWidth: 8,
|
|
|
- strokeColor: '#fff',
|
|
|
- }))
|
|
|
- // vertical
|
|
|
- children.push(new paper.Path.Line({
|
|
|
- from: [this.pos.x + ray, this.pos.y - ray - (5 * this.scale)],
|
|
|
- to: [this.pos.x + ray, this.pos.y - ray + (5 * this.scale)],
|
|
|
- strokeWidth: 8,
|
|
|
- strokeColor: '#fff',
|
|
|
- }))
|
|
|
-
|
|
|
- // MOINS
|
|
|
- // horizontal
|
|
|
- children.push(new paper.Path.Line({
|
|
|
- from: [this.pos.x - ray - (5 * this.scale), this.pos.y - ray],
|
|
|
- to: [this.pos.x - ray + (5 * this.scale), this.pos.y - ray],
|
|
|
- strokeWidth: 8,
|
|
|
- strokeColor: '#fff',
|
|
|
- }))
|
|
|
-
|
|
|
- let fontsize = 4;
|
|
|
- let fontFamily = "public_sans";
|
|
|
-
|
|
|
- children.push(new paper.PointText({
|
|
|
- point: [this.pos.x + 4.5, this.pos.y - ray - 5],
|
|
|
- content: `entités qui menacent \u2194 entités qui maintiennent`,
|
|
|
- fontSize: fontsize,
|
|
|
- fontFamily: fontFamily,
|
|
|
- justification: 'center',
|
|
|
- fillColor: '#000',
|
|
|
- }))
|
|
|
-
|
|
|
- children.push(new paper.PointText({
|
|
|
- point: [this.pos.x - ray - 5, this.pos.y + 1],
|
|
|
- content: "axe d'intensité",
|
|
|
- fontSize: fontsize,
|
|
|
- fontFamily: fontFamily,
|
|
|
- justification: 'right',
|
|
|
- fillColor: '#000',
|
|
|
- }))
|
|
|
-
|
|
|
- children.push(new paper.PointText({
|
|
|
- point: [this.pos.x + ray + 5, this.pos.y - 3],
|
|
|
- content: "situation future\n\u2195\nsituation actuelle",
|
|
|
- fontSize: fontsize,
|
|
|
- fontFamily: fontFamily,
|
|
|
- justification: 'left',
|
|
|
- fillColor: '#000',
|
|
|
- }))
|
|
|
-
|
|
|
-
|
|
|
- let t1 = new paper.PointText({
|
|
|
- point: [this.pos.x - ray/8*2.3, this.pos.y - ray/8*2.3],
|
|
|
- content: "avec prise",
|
|
|
- fontSize: fontsize,
|
|
|
- fontFamily: fontFamily,
|
|
|
- justification: 'center',
|
|
|
- fillColor: '#000',
|
|
|
- })
|
|
|
- t1.rotate(-45)
|
|
|
- children.push(t1)
|
|
|
-
|
|
|
- let t2 = new paper.PointText({
|
|
|
- point: [this.pos.x - ray/8*2.95, this.pos.y - ray/8*2.95],
|
|
|
- content: "sans prise",
|
|
|
- fontSize: fontsize,
|
|
|
- fontFamily: fontFamily,
|
|
|
- justification: 'center',
|
|
|
- fillColor: '#000',
|
|
|
- })
|
|
|
- t2.rotate(-45)
|
|
|
- children.push(t2)
|
|
|
-
|
|
|
-
|
|
|
- return new paper.Group({
|
|
|
- children: children,
|
|
|
- pivot: new paper.Point(this.pos),
|
|
|
- name: 'boussole_bg',
|
|
|
- locked: true,
|
|
|
- });
|
|
|
-
|
|
|
+ addNewPaperSymbolInstance(name){
|
|
|
+ let instance = new paper.SymbolItem(this.paper_symbol_definitions[name]);
|
|
|
+ instance.name = name;
|
|
|
+ instance.position = this.pos;
|
|
|
+ instance.scale = this.scale;
|
|
|
+ this.paper_main_object.addChild(instance);
|
|
|
},
|
|
|
setPaperContour(){
|
|
|
console.log(`setPaperContour ${this.concernement.id}`);
|
|
@@ -588,111 +439,6 @@ export default {
|
|
|
const vnao = { x: vma.y, y: -vma.x } // get the ma normal vector Out
|
|
|
const hao = [ vnao.x*hlo, vnao.y*hlo ]; // get the handleOut point
|
|
|
|
|
|
- // - / - / - / - / - / - / - / - / - / - / - / - / - / - / - /
|
|
|
- if (d) {
|
|
|
- let debug = new paper.Group({
|
|
|
- pivot: new paper.Point(this.pos),
|
|
|
- name: 'debug'
|
|
|
- });
|
|
|
- // B
|
|
|
- debug.addChild(new paper.PointText({
|
|
|
- point: [this.pos.x + b.x, this.pos.y + b.y],
|
|
|
- content: "b",
|
|
|
- fontSize: 10,
|
|
|
- justification: 'center',
|
|
|
- fillColor: 'red'
|
|
|
- }))
|
|
|
- // A
|
|
|
- debug.addChild(new paper.PointText({
|
|
|
- point: [this.pos.x + a.x, this.pos.y + a.y],
|
|
|
- content: "a",
|
|
|
- fontSize: 10,
|
|
|
- justification: 'center',
|
|
|
- fillColor: 'red'
|
|
|
- }))
|
|
|
- // C
|
|
|
- debug.addChild(new paper.PointText({
|
|
|
- point: [this.pos.x + c.x, this.pos.y + c.y],
|
|
|
- content: "c",
|
|
|
- fontSize: 10,
|
|
|
- justification: 'center',
|
|
|
- fillColor: 'red'
|
|
|
- }))
|
|
|
- // N
|
|
|
- debug.addChild(new paper.PointText({
|
|
|
- point: [this.pos.x + n.x, this.pos.y + n.y],
|
|
|
- content: "n",
|
|
|
- fontSize: 10,
|
|
|
- justification: 'center',
|
|
|
- fillColor: 'red'
|
|
|
- }))
|
|
|
- // M
|
|
|
- debug.addChild(new paper.PointText({
|
|
|
- point: [this.pos.x + m.x, this.pos.y + m.y],
|
|
|
- content: "m",
|
|
|
- fontSize: 10,
|
|
|
- justification: 'center',
|
|
|
- fillColor: 'red'
|
|
|
- }))
|
|
|
- // BA
|
|
|
- debug.addChild(new paper.Path.Line({
|
|
|
- from: [this.pos.x + b.x, this.pos.y + b.y],
|
|
|
- to: [this.pos.x + a.x, this.pos.y + a.y],
|
|
|
- strokeWidth: 4,
|
|
|
- strokeColor: 'green',
|
|
|
- // dashArray: [5,5]
|
|
|
- }))
|
|
|
- // CA
|
|
|
- debug.addChild(new paper.Path.Line({
|
|
|
- from: [this.pos.x + c.x, this.pos.y + c.y],
|
|
|
- to: [this.pos.x + a.x, this.pos.y + a.y],
|
|
|
- strokeWidth: 4,
|
|
|
- strokeColor: 'green',
|
|
|
- // dashArray: [5,5]
|
|
|
- }))
|
|
|
- // NA
|
|
|
- debug.addChild(new paper.Path.Line({
|
|
|
- from: [this.pos.x + n.x, this.pos.y + n.y],
|
|
|
- to: [this.pos.x + a.x, this.pos.y + a.y],
|
|
|
- strokeWidth: 2,
|
|
|
- strokeColor: 'blue',
|
|
|
- // dashArray: [5,5]
|
|
|
- }))
|
|
|
- // NC
|
|
|
- debug.addChild(new paper.Path.Line({
|
|
|
- from: [this.pos.x + n.x, this.pos.y + n.y],
|
|
|
- to: [this.pos.x + c.x, this.pos.y + c.y],
|
|
|
- strokeWidth: 2,
|
|
|
- strokeColor: 'orange',
|
|
|
- // dashArray: [5,5]
|
|
|
- }))
|
|
|
- // // MA
|
|
|
- // debug.addChild(new paper.Path.Line({
|
|
|
- // from: [this.pos.x + m.x, this.pos.y + m.y],
|
|
|
- // to: [this.pos.x + a.x, this.pos.y + a.y],
|
|
|
- // strokeWidth: 1,
|
|
|
- // strokeColor: 'red',
|
|
|
- // // dashArray: [5,5]
|
|
|
- // }))
|
|
|
- // // NC
|
|
|
- // debug.addChild(new paper.Path.Line({
|
|
|
- // from: [this.pos.x + n.x, this.pos.y + n.y],
|
|
|
- // to: [this.pos.x + c.x, this.pos.y + c.y],
|
|
|
- // strokeWidth: 1,
|
|
|
- // strokeColor: 'green',
|
|
|
- // dashArray: [5,5]
|
|
|
- // }))
|
|
|
- this.paper_main_object.addChild(debug)
|
|
|
-
|
|
|
- }
|
|
|
- // - / - / - / - / - / - / - / - / - / - / - / - / - / - / - /
|
|
|
- // return new paper.Segment({
|
|
|
- // point: [
|
|
|
- // this.pos.x+(a.x)*this.scale,
|
|
|
- // this.pos.y+(a.y)*this.scale
|
|
|
- // ]
|
|
|
- // })
|
|
|
-
|
|
|
return new paper.Segment({
|
|
|
point: pa,
|
|
|
handleIn: hai,
|