@yanqirenshi/d3.ter 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -68
- package/dist/js/Entity.js +589 -8
- package/dist/js/Geometry.js +4 -6
- package/dist/js/IdentifierInstance.js +27 -3
- package/dist/js/Painter.js +33 -4
- package/dist/js/Painters/PortCardinality.js +132 -75
- package/dist/js/Painters/PortCircle.js +2 -2
- package/dist/js/Painters/PortOptionality.js +51 -42
- package/dist/js/Painters/Ports.js +16 -20
- package/dist/js/Painters/Relationships.js +19 -8
- package/dist/js/Port.js +286 -133
- package/dist/js/utils/Name.js +4 -11
- package/package.json +1 -1
|
@@ -17,12 +17,12 @@ var _Size = _interopRequireDefault(require("./utils/Size.js"));
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
19
|
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
20
22
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
23
|
|
|
22
24
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
25
|
|
|
24
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
26
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
27
|
|
|
28
28
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
@@ -55,7 +55,31 @@ var IdentifierInstance = /*#__PURE__*/function (_ColumnInstance) {
|
|
|
55
55
|
return _this;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
_createClass(IdentifierInstance, [{
|
|
59
|
+
key: "template",
|
|
60
|
+
value: function template() {
|
|
61
|
+
return {
|
|
62
|
+
_id: null,
|
|
63
|
+
_class: 'IDENTIFIER-INSTANCE',
|
|
64
|
+
name: {
|
|
65
|
+
physical: '??',
|
|
66
|
+
logical: ''
|
|
67
|
+
},
|
|
68
|
+
position: {
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 0
|
|
71
|
+
},
|
|
72
|
+
size: {
|
|
73
|
+
w: 0,
|
|
74
|
+
h: 0
|
|
75
|
+
},
|
|
76
|
+
_master: null,
|
|
77
|
+
_core: null
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}]);
|
|
81
|
+
|
|
82
|
+
return IdentifierInstance;
|
|
59
83
|
}(_ColumnInstance2["default"]);
|
|
60
84
|
|
|
61
85
|
exports["default"] = IdentifierInstance;
|
package/dist/js/Painter.js
CHANGED
|
@@ -11,6 +11,8 @@ var _Relationships = _interopRequireDefault(require("./Painters/Relationships.js
|
|
|
11
11
|
|
|
12
12
|
var _Entity = _interopRequireDefault(require("./Painters/Entity.js"));
|
|
13
13
|
|
|
14
|
+
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
17
|
|
|
16
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -25,7 +27,7 @@ var Painter = /*#__PURE__*/function () {
|
|
|
25
27
|
|
|
26
28
|
this.foreground = foreground;
|
|
27
29
|
this.background = background;
|
|
28
|
-
this.callbacks = callbacks;
|
|
30
|
+
this.callbacks = this.ensureCallbacks(callbacks);
|
|
29
31
|
this._default = {
|
|
30
32
|
line: {
|
|
31
33
|
height: 14,
|
|
@@ -35,13 +37,40 @@ var Painter = /*#__PURE__*/function () {
|
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
39
|
this._painters = {
|
|
38
|
-
ports: new _Ports["default"](),
|
|
39
|
-
relationships: new _Relationships["default"](),
|
|
40
|
+
ports: new _Ports["default"](this),
|
|
41
|
+
relationships: new _Relationships["default"](this),
|
|
40
42
|
entity: new _Entity["default"](this)
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
_createClass(Painter, [{
|
|
47
|
+
key: "ensureCallbacks",
|
|
48
|
+
value: function ensureCallbacks(callbacks) {
|
|
49
|
+
var default_callbacks = {
|
|
50
|
+
entity: {
|
|
51
|
+
click: function click(node) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
identifier: {
|
|
56
|
+
click: function click(node) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
attribute: {
|
|
61
|
+
click: function click(node) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
relationship: {
|
|
66
|
+
click: function click(node) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return (0, _deepmerge["default"])(default_callbacks, callbacks);
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
45
74
|
key: "ports",
|
|
46
75
|
value: function ports() {
|
|
47
76
|
return this._painters.ports;
|
|
@@ -70,7 +99,7 @@ var Painter = /*#__PURE__*/function () {
|
|
|
70
99
|
// entity の描画
|
|
71
100
|
var groups = this.entity().draw(entities.list); // port の描画
|
|
72
101
|
|
|
73
|
-
this.ports().
|
|
102
|
+
this.ports().draw(groups); // relationship の描画
|
|
74
103
|
|
|
75
104
|
this.relationships().drawRelationships(this.background, relationsihps);
|
|
76
105
|
}
|
|
@@ -73,128 +73,185 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
73
73
|
to: to_point
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
}, {
|
|
77
|
+
key: "calOneLine",
|
|
78
|
+
value: function calOneLine(d, distance) {
|
|
79
|
+
var r = 11;
|
|
80
|
+
var line = d._relationship;
|
|
79
81
|
|
|
82
|
+
if (line.from.position.x === line.to.position.x) {
|
|
83
|
+
// 縦
|
|
84
|
+
if (line.from.position.y < line.to.position.y) {
|
|
85
|
+
// (2)
|
|
86
|
+
return {
|
|
87
|
+
from: {
|
|
88
|
+
x: line.from.position.x + r,
|
|
89
|
+
y: line.from.position.y + distance
|
|
90
|
+
},
|
|
91
|
+
to: {
|
|
92
|
+
x: line.from.position.x - r,
|
|
93
|
+
y: line.from.position.y + distance
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
} else if (line.from.position.y > line.to.position.y) {
|
|
97
|
+
// (1)
|
|
98
|
+
return {
|
|
99
|
+
from: {
|
|
100
|
+
x: line.from.position.x + r,
|
|
101
|
+
y: line.from.position.y - distance
|
|
102
|
+
},
|
|
103
|
+
to: {
|
|
104
|
+
x: line.from.position.x - r,
|
|
105
|
+
y: line.from.position.y - distance
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
} else if (line.from.position.y === line.to.position.y) {
|
|
110
|
+
// 横
|
|
111
|
+
if (line.from.position.x < line.to.position.x) {
|
|
112
|
+
// (2)
|
|
113
|
+
return {
|
|
114
|
+
from: {
|
|
115
|
+
x: line.from.position.x + distance,
|
|
116
|
+
y: line.from.position.y + r
|
|
117
|
+
},
|
|
118
|
+
to: {
|
|
119
|
+
x: line.from.position.x + distance,
|
|
120
|
+
y: line.from.position.y - r
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
} else if (line.from.position.x > line.to.position.x) {
|
|
124
|
+
// (1)
|
|
125
|
+
return {
|
|
126
|
+
from: {
|
|
127
|
+
x: line.from.position.x - distance,
|
|
128
|
+
y: line.from.position.y + r
|
|
129
|
+
},
|
|
130
|
+
to: {
|
|
131
|
+
x: line.from.position.x - distance,
|
|
132
|
+
y: line.from.position.y - r
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
from: {
|
|
140
|
+
x: 0,
|
|
141
|
+
y: 0
|
|
142
|
+
},
|
|
143
|
+
to: {
|
|
144
|
+
x: 0,
|
|
145
|
+
y: 0
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
80
149
|
}, {
|
|
81
150
|
key: "drawLine",
|
|
82
|
-
value:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
151
|
+
value:
|
|
152
|
+
/* **************************************************************** *
|
|
153
|
+
* Draw Line (port to entity)
|
|
154
|
+
* **************************************************************** */
|
|
155
|
+
function drawLine(g) {
|
|
156
|
+
var lines = g.selectAll('line').data(function (d) {
|
|
157
|
+
return d.ports.items.list;
|
|
158
|
+
}, function (d) {
|
|
159
|
+
return d.id();
|
|
88
160
|
}); // delete
|
|
89
161
|
|
|
90
162
|
lines.exit().remove(); // update
|
|
91
163
|
|
|
92
|
-
lines.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
d.position = line.to;
|
|
96
|
-
d.line = line;
|
|
97
|
-
}).attr("x1", function (d) {
|
|
98
|
-
return d.line.from.x;
|
|
164
|
+
lines.attr("x1", function (d) {
|
|
165
|
+
return d.linePosition().from.x;
|
|
99
166
|
}).attr("y1", function (d) {
|
|
100
|
-
return d.
|
|
167
|
+
return d.linePosition().from.y;
|
|
101
168
|
}).attr("x2", function (d) {
|
|
102
|
-
return d.
|
|
169
|
+
return d.linePosition().to.x;
|
|
103
170
|
}).attr("y2", function (d) {
|
|
104
|
-
return d.
|
|
105
|
-
}).attr("stroke-width",
|
|
106
|
-
|
|
107
|
-
lines.enter().each(function (d, i) {
|
|
108
|
-
var line = _this.calLinePoints(d);
|
|
171
|
+
return d.linePosition().to.y;
|
|
172
|
+
}).attr("stroke-width", 1).attr("stroke", "#a3a3a2"); // add
|
|
109
173
|
|
|
110
|
-
|
|
111
|
-
d.
|
|
112
|
-
}).append("line").attr("x1", function (d) {
|
|
113
|
-
return d.line.from.x;
|
|
174
|
+
lines.enter().append("line").attr("x1", function (d) {
|
|
175
|
+
return d.linePosition().from.x;
|
|
114
176
|
}).attr("y1", function (d) {
|
|
115
|
-
return d.
|
|
177
|
+
return d.linePosition().from.y;
|
|
116
178
|
}).attr("x2", function (d) {
|
|
117
|
-
return d.
|
|
179
|
+
return d.linePosition().to.x;
|
|
118
180
|
}).attr("y2", function (d) {
|
|
119
|
-
return d.
|
|
120
|
-
}).attr("stroke-width",
|
|
181
|
+
return d.linePosition().to.y;
|
|
182
|
+
}).attr("stroke-width", 1).attr("stroke", "#a3a3a2");
|
|
121
183
|
}
|
|
122
184
|
}, {
|
|
123
185
|
key: "drawCardinalityOne",
|
|
124
186
|
value: function drawCardinalityOne(g) {
|
|
125
|
-
var _this2 = this;
|
|
126
|
-
|
|
127
187
|
var filter = function filter() {
|
|
128
188
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
129
|
-
return ports.filter(function (
|
|
130
|
-
return
|
|
189
|
+
return ports.filter(function (port) {
|
|
190
|
+
return port.cardinality() === 1;
|
|
131
191
|
});
|
|
132
192
|
};
|
|
133
193
|
|
|
134
194
|
var optionalities = g.selectAll('line.cardinality').data(function (d) {
|
|
135
|
-
return filter(d.
|
|
195
|
+
return filter(d.ports.items.list);
|
|
136
196
|
}, function (d) {
|
|
137
|
-
return d.
|
|
197
|
+
return d.id();
|
|
138
198
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return d.line_cardinality.to.y;
|
|
158
|
-
}).attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
199
|
+
|
|
200
|
+
var draw = function draw(selection) {
|
|
201
|
+
selection.attr("x1", function (d) {
|
|
202
|
+
return d.cardinalityPosition().from.x;
|
|
203
|
+
}).attr("y1", function (d) {
|
|
204
|
+
return d.cardinalityPosition().from.y;
|
|
205
|
+
}).attr("x2", function (d) {
|
|
206
|
+
return d.cardinalityPosition().to.x;
|
|
207
|
+
}).attr("y2", function (d) {
|
|
208
|
+
return d.cardinalityPosition().to.y;
|
|
209
|
+
}).attr("stroke-width", 1).attr("stroke", "#a3a3a2");
|
|
210
|
+
}; // update
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
draw(optionalities); // add
|
|
214
|
+
|
|
215
|
+
var add_targets = optionalities.enter().append('line').classed("cardinality", true);
|
|
216
|
+
draw(add_targets);
|
|
159
217
|
}
|
|
160
218
|
}, {
|
|
161
219
|
key: "drawCardinalityThree",
|
|
162
220
|
value: function drawCardinalityThree(g) {
|
|
163
|
-
var _this3 = this;
|
|
164
|
-
|
|
165
221
|
var filter = function filter() {
|
|
166
222
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
167
|
-
return ports.filter(function (
|
|
168
|
-
return
|
|
223
|
+
return ports.filter(function (port) {
|
|
224
|
+
return port.cardinality() === 3;
|
|
169
225
|
});
|
|
170
226
|
};
|
|
171
227
|
|
|
172
228
|
var optionalities = g.selectAll('path.cardinality').data(function (d) {
|
|
173
|
-
return filter(d.
|
|
229
|
+
return filter(d.ports.items.list);
|
|
174
230
|
}, function (d) {
|
|
175
|
-
return d.
|
|
231
|
+
return d.id();
|
|
176
232
|
});
|
|
177
233
|
var line = d3.line().x(function (d) {
|
|
178
234
|
return d[0];
|
|
179
235
|
}).y(function (d) {
|
|
180
236
|
return d[1];
|
|
181
237
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
238
|
+
|
|
239
|
+
var draw = function draw(selection) {
|
|
240
|
+
selection.attr('d', function (d) {
|
|
241
|
+
return line(d._cardinality);
|
|
242
|
+
}).attr("fill", 'none').attr("stroke-width", 1).attr("stroke", "#a3a3a2");
|
|
243
|
+
}; // update
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
draw(optionalities); // add
|
|
247
|
+
|
|
248
|
+
var add_targets = optionalities.enter().append('path').classed("cardinality", true);
|
|
249
|
+
draw(add_targets);
|
|
192
250
|
}
|
|
193
251
|
}, {
|
|
194
252
|
key: "draw",
|
|
195
253
|
value: function draw(g) {
|
|
196
|
-
|
|
197
|
-
// this.drawLine(g);
|
|
254
|
+
this.drawLine(g);
|
|
198
255
|
this.drawCardinalityOne(g);
|
|
199
256
|
this.drawCardinalityThree(g);
|
|
200
257
|
}
|
|
@@ -29,9 +29,9 @@ var PortCircle = /*#__PURE__*/function () {
|
|
|
29
29
|
value: // protected
|
|
30
30
|
function drawPortsCore(ports) {
|
|
31
31
|
ports.attr('class', 'entity-port').attr('cx', function (d) {
|
|
32
|
-
return d.position.x;
|
|
32
|
+
return d.position().x;
|
|
33
33
|
}).attr('cy', function (d) {
|
|
34
|
-
return d.position.y;
|
|
34
|
+
return d.position().y;
|
|
35
35
|
}).attr('r', 4).attr('fill', '#fff').attr('stroke', '#000').attr('stroke-width', 0.5).attr('degree', function (d) {
|
|
36
36
|
return d._owner._core.position || 0;
|
|
37
37
|
}).attr('port-id', function (d) {
|
|
@@ -25,70 +25,79 @@ var PortOptionality = /*#__PURE__*/function () {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
_createClass(PortOptionality, [{
|
|
28
|
+
key: "selections",
|
|
29
|
+
value: function selections(g, selector, filter) {
|
|
30
|
+
return g.selectAll(selector).data(function (d) {
|
|
31
|
+
return filter(d.ports.items.list);
|
|
32
|
+
}, function (d) {
|
|
33
|
+
return d.id();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
28
37
|
key: "drawOptionalityOne",
|
|
29
38
|
value: function drawOptionalityOne(g) {
|
|
30
|
-
var _this = this;
|
|
31
|
-
|
|
32
39
|
var filter = function filter() {
|
|
33
40
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
34
41
|
return ports.filter(function (d) {
|
|
35
|
-
return d.optionality === 1;
|
|
42
|
+
return d.optionality() === 1;
|
|
36
43
|
});
|
|
37
44
|
};
|
|
38
45
|
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
var selector = 'line.optionality';
|
|
47
|
+
var optionalities = this.selections(g, selector, filter);
|
|
48
|
+
|
|
49
|
+
var draw = function draw(selection) {
|
|
50
|
+
selection.attr("x1", function (d) {
|
|
51
|
+
return d.optionalityPosition().from.x;
|
|
52
|
+
}).attr("y1", function (d) {
|
|
53
|
+
return d.optionalityPosition().from.y;
|
|
54
|
+
}).attr("x2", function (d) {
|
|
55
|
+
return d.optionalityPosition().to.x;
|
|
56
|
+
}).attr("y2", function (d) {
|
|
57
|
+
return d.optionalityPosition().to.y;
|
|
58
|
+
}).attr("stroke-width", 1).attr("stroke", "#a3a3a2");
|
|
59
|
+
}; // remove
|
|
60
|
+
// ???
|
|
61
|
+
// update
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
draw(optionalities); // add
|
|
65
|
+
|
|
66
|
+
var add_taregts = optionalities.enter().append('line').classed("optionality", true);
|
|
67
|
+
draw(add_taregts);
|
|
55
68
|
}
|
|
56
69
|
}, {
|
|
57
70
|
key: "drawOptionalityZero",
|
|
58
71
|
value: function drawOptionalityZero(g) {
|
|
59
|
-
var _this2 = this;
|
|
60
|
-
|
|
61
72
|
var filter = function filter() {
|
|
62
73
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
63
74
|
return ports.filter(function (d) {
|
|
64
|
-
return d.optionality === 0;
|
|
75
|
+
return d.optionality() === 0;
|
|
65
76
|
});
|
|
66
77
|
};
|
|
67
78
|
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}).attr("r", 5).attr("fill", "#fefefe").attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
79
|
+
var selector = 'circle.optionality';
|
|
80
|
+
var optionalities = this.selections(g, selector, filter);
|
|
81
|
+
|
|
82
|
+
var draw = function draw(selection) {
|
|
83
|
+
selection.attr("cx", function (d) {
|
|
84
|
+
return d.optionalityPosition().x;
|
|
85
|
+
}).attr("cy", function (d) {
|
|
86
|
+
return d.optionalityPosition().y;
|
|
87
|
+
}).attr("r", 5).attr("fill", "#fefefe").attr("stroke-width", 1).attr("stroke", "#a3a3a2");
|
|
88
|
+
}; // remove
|
|
89
|
+
// ???
|
|
90
|
+
// update
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
draw(optionalities); // add
|
|
94
|
+
|
|
95
|
+
var add_taregts = optionalities.enter().append("circle").classed("optionality", true);
|
|
96
|
+
draw(add_taregts);
|
|
87
97
|
}
|
|
88
98
|
}, {
|
|
89
99
|
key: "draw",
|
|
90
100
|
value: function draw(g) {
|
|
91
|
-
// E1のインスタンス1つに対応する、E2のインスタンスの最小数
|
|
92
101
|
this.drawOptionalityOne(g);
|
|
93
102
|
this.drawOptionalityZero(g);
|
|
94
103
|
}
|
|
@@ -30,34 +30,30 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
30
30
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
31
|
|
|
32
32
|
var Ports = /*#__PURE__*/function () {
|
|
33
|
-
function Ports() {
|
|
33
|
+
function Ports(parent) {
|
|
34
34
|
_classCallCheck(this, Ports);
|
|
35
35
|
|
|
36
|
+
this._parent = parent;
|
|
36
37
|
this.cardinality = new _PortCardinality["default"]();
|
|
37
38
|
this.optionality = new _PortOptionality["default"]();
|
|
38
39
|
this.circle = new _PortCircle["default"]();
|
|
39
40
|
}
|
|
40
|
-
/* **************************************************************** *
|
|
41
|
-
* こんな感じで書いていた。
|
|
42
|
-
* **************************************************************** */
|
|
43
|
-
// draw (g) {
|
|
44
|
-
// this.drawLine(g);
|
|
45
|
-
// this.drawCardinality(g);
|
|
46
|
-
// this.drawOptionality(g);
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
/* **************************************************************** *
|
|
50
|
-
* Old
|
|
51
|
-
* **************************************************************** */
|
|
52
|
-
// public
|
|
53
|
-
|
|
54
41
|
|
|
55
42
|
_createClass(Ports, [{
|
|
56
|
-
key: "
|
|
57
|
-
value: function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
key: "callbacks",
|
|
44
|
+
value: function callbacks() {
|
|
45
|
+
return this._parent.callbacks;
|
|
46
|
+
}
|
|
47
|
+
/* **************************************************************** *
|
|
48
|
+
* Old
|
|
49
|
+
* **************************************************************** */
|
|
50
|
+
// public
|
|
51
|
+
|
|
52
|
+
}, {
|
|
53
|
+
key: "draw",
|
|
54
|
+
value: function draw(groups_entity) {
|
|
55
|
+
this.cardinality.draw(groups_entity);
|
|
56
|
+
this.optionality.draw(groups_entity);
|
|
61
57
|
}
|
|
62
58
|
}]);
|
|
63
59
|
|
|
@@ -12,41 +12,52 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
13
|
|
|
14
14
|
var Relationships = /*#__PURE__*/function () {
|
|
15
|
-
function Relationships() {
|
|
15
|
+
function Relationships(parent) {
|
|
16
16
|
_classCallCheck(this, Relationships);
|
|
17
|
+
|
|
18
|
+
this._parent = parent;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
_createClass(Relationships, [{
|
|
22
|
+
key: "callbacks",
|
|
23
|
+
value: function callbacks() {
|
|
24
|
+
return this._parent.callbacks;
|
|
25
|
+
} // public
|
|
26
|
+
|
|
27
|
+
}, {
|
|
20
28
|
key: "drawRelationshipsCore",
|
|
21
|
-
value:
|
|
22
|
-
function drawRelationshipsCore(edges) {
|
|
29
|
+
value: function drawRelationshipsCore(edges) {
|
|
23
30
|
edges.attr('x1', function (d) {
|
|
24
31
|
var port = d.from;
|
|
25
32
|
var entity = d.from._owner;
|
|
26
|
-
return port.position.x + entity.position.x;
|
|
33
|
+
return port.position().x + entity.position.x;
|
|
27
34
|
}).attr('y1', function (d) {
|
|
28
35
|
var port = d.from;
|
|
29
36
|
var entity = d.from._owner;
|
|
30
|
-
return port.position.y + entity.position.y;
|
|
37
|
+
return port.position().y + entity.position.y;
|
|
31
38
|
}).attr('x2', function (d) {
|
|
32
39
|
var port = d.to;
|
|
33
40
|
var entity = d.to._owner;
|
|
34
|
-
return port.position.x + entity.position.x;
|
|
41
|
+
return port.position().x + entity.position.x;
|
|
35
42
|
}).attr('y2', function (d) {
|
|
36
43
|
var port = d.to;
|
|
37
44
|
var entity = d.to._owner;
|
|
38
|
-
return port.position.y + entity.position.y;
|
|
45
|
+
return port.position().y + entity.position.y;
|
|
39
46
|
}).attr('stroke', '#888888').attr('stroke-width', 1);
|
|
40
47
|
}
|
|
41
48
|
}, {
|
|
42
49
|
key: "drawRelationships",
|
|
43
50
|
value: function drawRelationships(place, relationships) {
|
|
51
|
+
var callbacks = this.callbacks();
|
|
44
52
|
var data = relationships.list.filter(function (edge) {
|
|
45
53
|
return edge.from._class === 'PORT-FROM' && edge.to._class === 'PORT-TO';
|
|
46
54
|
});
|
|
47
55
|
var edges = place.selectAll('line.connector').data(data, function (d) {
|
|
48
56
|
return d._id;
|
|
49
|
-
}).enter().append('line').
|
|
57
|
+
}).enter().append('line').on("click", function (event, d) {
|
|
58
|
+
var func = callbacks.relationship.click;
|
|
59
|
+
if (func) func(d);
|
|
60
|
+
}).attr('class', 'connector');
|
|
50
61
|
this.drawRelationshipsCore(edges);
|
|
51
62
|
}
|
|
52
63
|
}]);
|