@yanqirenshi/d3.ter 0.1.5 → 0.1.7
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 +602 -9
- package/dist/js/Geometry.js +4 -6
- package/dist/js/IdentifierInstance.js +27 -3
- package/dist/js/Painter.js +45 -5
- package/dist/js/Painters/Entity.js +10 -0
- package/dist/js/Painters/PortCardinality.js +80 -123
- package/dist/js/Painters/PortCircle.js +2 -2
- package/dist/js/Painters/PortOptionality.js +64 -39
- package/dist/js/Painters/Ports.js +29 -23
- package/dist/js/Painters/Relationships.js +29 -8
- package/dist/js/Port.js +298 -133
- package/dist/js/Rectum.js +33 -13
- package/dist/js/utils/Name.js +4 -8
- 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"); } }
|
|
@@ -20,12 +22,13 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
20
22
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
23
|
|
|
22
24
|
var Painter = /*#__PURE__*/function () {
|
|
23
|
-
function Painter(foreground, background, callbacks) {
|
|
25
|
+
function Painter(rectum, foreground, background, callbacks) {
|
|
24
26
|
_classCallCheck(this, Painter);
|
|
25
27
|
|
|
28
|
+
this._rectum = rectum;
|
|
26
29
|
this.foreground = foreground;
|
|
27
30
|
this.background = background;
|
|
28
|
-
this.callbacks = callbacks;
|
|
31
|
+
this.callbacks = this.ensureCallbacks(callbacks);
|
|
29
32
|
this._default = {
|
|
30
33
|
line: {
|
|
31
34
|
height: 14,
|
|
@@ -35,13 +38,50 @@ var Painter = /*#__PURE__*/function () {
|
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
40
|
this._painters = {
|
|
38
|
-
ports: new _Ports["default"](),
|
|
39
|
-
relationships: new _Relationships["default"](),
|
|
41
|
+
ports: new _Ports["default"](this),
|
|
42
|
+
relationships: new _Relationships["default"](this),
|
|
40
43
|
entity: new _Entity["default"](this)
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
_createClass(Painter, [{
|
|
48
|
+
key: "rectum",
|
|
49
|
+
value: function rectum() {
|
|
50
|
+
return this._rectum;
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "style",
|
|
54
|
+
value: function style() {
|
|
55
|
+
return this.rectum().style();
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "ensureCallbacks",
|
|
59
|
+
value: function ensureCallbacks(callbacks) {
|
|
60
|
+
var default_callbacks = {
|
|
61
|
+
entity: {
|
|
62
|
+
click: function click(node) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
identifier: {
|
|
67
|
+
click: function click(node) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
attribute: {
|
|
72
|
+
click: function click(node) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
relationship: {
|
|
77
|
+
click: function click(node) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return (0, _deepmerge["default"])(default_callbacks, callbacks);
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
45
85
|
key: "ports",
|
|
46
86
|
value: function ports() {
|
|
47
87
|
return this._painters.ports;
|
|
@@ -70,7 +110,7 @@ var Painter = /*#__PURE__*/function () {
|
|
|
70
110
|
// entity の描画
|
|
71
111
|
var groups = this.entity().draw(entities.list); // port の描画
|
|
72
112
|
|
|
73
|
-
this.ports().
|
|
113
|
+
this.ports().draw(groups); // relationship の描画
|
|
74
114
|
|
|
75
115
|
this.relationships().drawRelationships(this.background, relationsihps);
|
|
76
116
|
}
|
|
@@ -27,6 +27,16 @@ var Entity = /*#__PURE__*/function () {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
_createClass(Entity, [{
|
|
30
|
+
key: "rectum",
|
|
31
|
+
value: function rectum() {
|
|
32
|
+
return this._parent.rectum();
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
key: "style",
|
|
36
|
+
value: function style() {
|
|
37
|
+
return this.rectum().style();
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
30
40
|
key: "foreground",
|
|
31
41
|
value: function foreground() {
|
|
32
42
|
return this._parent.foreground;
|
|
@@ -20,58 +20,21 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
20
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
21
|
|
|
22
22
|
var PortCardinality = /*#__PURE__*/function () {
|
|
23
|
-
function PortCardinality() {
|
|
23
|
+
function PortCardinality(parent) {
|
|
24
24
|
_classCallCheck(this, PortCardinality);
|
|
25
|
+
|
|
26
|
+
this._parent = parent;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
_createClass(PortCardinality, [{
|
|
28
|
-
key: "
|
|
29
|
-
value: function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
size: {
|
|
37
|
-
w: table.w,
|
|
38
|
-
h: table.h
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var geometry = this.geometry;
|
|
42
|
-
var four_side_lines = geometry.getFourSideLines(rect);
|
|
43
|
-
var line_port = geometry.getPortLine(port, rect);
|
|
44
|
-
var cross_point = geometry.getCrossPoint(four_side_lines, line_port);
|
|
45
|
-
var len = 33 + 4;
|
|
46
|
-
var to_point = cross_point.point;
|
|
47
|
-
var from_point;
|
|
48
|
-
|
|
49
|
-
if (cross_point.target === 'top') {
|
|
50
|
-
from_point = {
|
|
51
|
-
x: to_point.x,
|
|
52
|
-
y: to_point.y + len
|
|
53
|
-
};
|
|
54
|
-
} else if (cross_point.target === 'right') {
|
|
55
|
-
from_point = {
|
|
56
|
-
x: to_point.x - len,
|
|
57
|
-
y: to_point.y
|
|
58
|
-
};
|
|
59
|
-
} else if (cross_point.target === 'bottom') {
|
|
60
|
-
from_point = {
|
|
61
|
-
x: to_point.x,
|
|
62
|
-
y: to_point.y - len
|
|
63
|
-
};
|
|
64
|
-
} else if (cross_point.target === 'left') {
|
|
65
|
-
from_point = {
|
|
66
|
-
x: to_point.x + len,
|
|
67
|
-
y: to_point.y
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
from: from_point,
|
|
73
|
-
to: to_point
|
|
74
|
-
};
|
|
30
|
+
key: "rectum",
|
|
31
|
+
value: function rectum() {
|
|
32
|
+
return this._parent.rectum();
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
key: "style",
|
|
36
|
+
value: function style() {
|
|
37
|
+
return this.rectum().style();
|
|
75
38
|
}
|
|
76
39
|
/* **************************************************************** *
|
|
77
40
|
* Draw Line (port to entity)
|
|
@@ -82,42 +45,33 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
82
45
|
value: function drawLine(g) {
|
|
83
46
|
var _this = this;
|
|
84
47
|
|
|
85
|
-
var lines = g.selectAll('line').data(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
48
|
+
var lines = g.selectAll('line').data(function (d) {
|
|
49
|
+
return d.ports.items.list;
|
|
50
|
+
}, function (d) {
|
|
51
|
+
return d.id();
|
|
52
|
+
});
|
|
53
|
+
console.log();
|
|
54
|
+
console.log();
|
|
55
|
+
|
|
56
|
+
var draw = function draw(selection) {
|
|
57
|
+
selection.attr("x1", function (d) {
|
|
58
|
+
return d.linePosition().from.x;
|
|
59
|
+
}).attr("y1", function (d) {
|
|
60
|
+
return d.linePosition().from.y;
|
|
61
|
+
}).attr("x2", function (d) {
|
|
62
|
+
return d.linePosition().to.x;
|
|
63
|
+
}).attr("y2", function (d) {
|
|
64
|
+
return d.linePosition().to.y;
|
|
65
|
+
}).attr("stroke-width", _this.style().port.stroke.width).attr("stroke", _this.style().port.stroke.color);
|
|
66
|
+
}; // delete
|
|
67
|
+
|
|
89
68
|
|
|
90
69
|
lines.exit().remove(); // update
|
|
91
70
|
|
|
92
|
-
lines
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
d.line = line;
|
|
97
|
-
}).attr("x1", function (d) {
|
|
98
|
-
return d.line.from.x;
|
|
99
|
-
}).attr("y1", function (d) {
|
|
100
|
-
return d.line.from.y;
|
|
101
|
-
}).attr("x2", function (d) {
|
|
102
|
-
return d.line.to.x;
|
|
103
|
-
}).attr("y2", function (d) {
|
|
104
|
-
return d.line.to.y;
|
|
105
|
-
}).attr("stroke-width", 3).attr("stroke", "#a3a3a2"); // add
|
|
106
|
-
|
|
107
|
-
lines.enter().each(function (d, i) {
|
|
108
|
-
var line = _this.calLinePoints(d);
|
|
109
|
-
|
|
110
|
-
d.position = line.to;
|
|
111
|
-
d.line = line;
|
|
112
|
-
}).append("line").attr("x1", function (d) {
|
|
113
|
-
return d.line.from.x;
|
|
114
|
-
}).attr("y1", function (d) {
|
|
115
|
-
return d.line.from.y;
|
|
116
|
-
}).attr("x2", function (d) {
|
|
117
|
-
return d.line.to.x;
|
|
118
|
-
}).attr("y2", function (d) {
|
|
119
|
-
return d.line.to.y;
|
|
120
|
-
}).attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
71
|
+
draw(lines); // add
|
|
72
|
+
|
|
73
|
+
var add_targets = lines.enter().append("line");
|
|
74
|
+
draw(add_targets);
|
|
121
75
|
}
|
|
122
76
|
}, {
|
|
123
77
|
key: "drawCardinalityOne",
|
|
@@ -126,36 +80,36 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
126
80
|
|
|
127
81
|
var filter = function filter() {
|
|
128
82
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
129
|
-
return ports.filter(function (
|
|
130
|
-
return
|
|
83
|
+
return ports.filter(function (port) {
|
|
84
|
+
return port.cardinality() === 1;
|
|
131
85
|
});
|
|
132
86
|
};
|
|
133
87
|
|
|
134
|
-
var
|
|
135
|
-
return filter(d.
|
|
88
|
+
var cardinalities = g.selectAll('line.cardinality').data(function (d) {
|
|
89
|
+
return filter(d.ports.items.list);
|
|
136
90
|
}, function (d) {
|
|
137
|
-
return d.
|
|
91
|
+
return d.id();
|
|
138
92
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
93
|
+
|
|
94
|
+
var draw = function draw(selection) {
|
|
95
|
+
selection.attr("x1", function (d) {
|
|
96
|
+
return d.cardinalityPosition().from.x;
|
|
97
|
+
}).attr("y1", function (d) {
|
|
98
|
+
return d.cardinalityPosition().from.y;
|
|
99
|
+
}).attr("x2", function (d) {
|
|
100
|
+
return d.cardinalityPosition().to.x;
|
|
101
|
+
}).attr("y2", function (d) {
|
|
102
|
+
return d.cardinalityPosition().to.y;
|
|
103
|
+
}).attr("stroke-width", _this2.style().port.stroke.width).attr("stroke", _this2.style().port.stroke.color);
|
|
104
|
+
}; // delete
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
cardinalities.exit().remove(); // update
|
|
108
|
+
|
|
109
|
+
draw(cardinalities); // add
|
|
110
|
+
|
|
111
|
+
var add_targets = cardinalities.enter().append('line').classed("cardinality", true);
|
|
112
|
+
draw(add_targets);
|
|
159
113
|
}
|
|
160
114
|
}, {
|
|
161
115
|
key: "drawCardinalityThree",
|
|
@@ -164,37 +118,40 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
164
118
|
|
|
165
119
|
var filter = function filter() {
|
|
166
120
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
167
|
-
return ports.filter(function (
|
|
168
|
-
return
|
|
121
|
+
return ports.filter(function (port) {
|
|
122
|
+
return port.cardinality() === 3;
|
|
169
123
|
});
|
|
170
124
|
};
|
|
171
125
|
|
|
172
|
-
var
|
|
173
|
-
return filter(d.
|
|
126
|
+
var cardinalities = g.selectAll('path.cardinality').data(function (d) {
|
|
127
|
+
return filter(d.ports.items.list);
|
|
174
128
|
}, function (d) {
|
|
175
|
-
return d.
|
|
129
|
+
return d.id();
|
|
176
130
|
});
|
|
177
131
|
var line = d3.line().x(function (d) {
|
|
178
132
|
return d[0];
|
|
179
133
|
}).y(function (d) {
|
|
180
134
|
return d[1];
|
|
181
135
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
136
|
+
|
|
137
|
+
var draw = function draw(selection) {
|
|
138
|
+
selection.attr('d', function (d) {
|
|
139
|
+
return line(d._cardinality);
|
|
140
|
+
}).attr("fill", 'none').attr("stroke-width", _this3.style().port.stroke.width).attr("stroke", _this3.style().port.stroke.color);
|
|
141
|
+
}; // delete
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
cardinalities.exit().remove(); // update
|
|
145
|
+
|
|
146
|
+
draw(cardinalities); // add
|
|
147
|
+
|
|
148
|
+
var add_targets = cardinalities.enter().append('path').classed("cardinality", true);
|
|
149
|
+
draw(add_targets);
|
|
192
150
|
}
|
|
193
151
|
}, {
|
|
194
152
|
key: "draw",
|
|
195
153
|
value: function draw(g) {
|
|
196
|
-
|
|
197
|
-
// this.drawLine(g);
|
|
154
|
+
this.drawLine(g);
|
|
198
155
|
this.drawCardinalityOne(g);
|
|
199
156
|
this.drawCardinalityThree(g);
|
|
200
157
|
}
|
|
@@ -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) {
|
|
@@ -20,11 +20,32 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
20
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
21
|
|
|
22
22
|
var PortOptionality = /*#__PURE__*/function () {
|
|
23
|
-
function PortOptionality() {
|
|
23
|
+
function PortOptionality(parent) {
|
|
24
24
|
_classCallCheck(this, PortOptionality);
|
|
25
|
+
|
|
26
|
+
this._parent = parent;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
_createClass(PortOptionality, [{
|
|
30
|
+
key: "rectum",
|
|
31
|
+
value: function rectum() {
|
|
32
|
+
return this._parent.rectum();
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
key: "style",
|
|
36
|
+
value: function style() {
|
|
37
|
+
return this.rectum().style();
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "selections",
|
|
41
|
+
value: function selections(g, selector, filter) {
|
|
42
|
+
return g.selectAll(selector).data(function (d) {
|
|
43
|
+
return filter(d.ports.items.list);
|
|
44
|
+
}, function (d) {
|
|
45
|
+
return d.id();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
28
49
|
key: "drawOptionalityOne",
|
|
29
50
|
value: function drawOptionalityOne(g) {
|
|
30
51
|
var _this = this;
|
|
@@ -32,26 +53,32 @@ var PortOptionality = /*#__PURE__*/function () {
|
|
|
32
53
|
var filter = function filter() {
|
|
33
54
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
34
55
|
return ports.filter(function (d) {
|
|
35
|
-
return d.optionality === 1;
|
|
56
|
+
return d.optionality() === 1;
|
|
36
57
|
});
|
|
37
58
|
};
|
|
38
59
|
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
var selector = 'line.optionality';
|
|
61
|
+
var optionalities = this.selections(g, selector, filter);
|
|
62
|
+
|
|
63
|
+
var draw = function draw(selection) {
|
|
64
|
+
selection.attr("x1", function (d) {
|
|
65
|
+
return d.optionalityPosition().from.x;
|
|
66
|
+
}).attr("y1", function (d) {
|
|
67
|
+
return d.optionalityPosition().from.y;
|
|
68
|
+
}).attr("x2", function (d) {
|
|
69
|
+
return d.optionalityPosition().to.x;
|
|
70
|
+
}).attr("y2", function (d) {
|
|
71
|
+
return d.optionalityPosition().to.y;
|
|
72
|
+
}).attr("stroke-width", _this.style().port.stroke.width).attr("stroke", _this.style().port.stroke.color);
|
|
73
|
+
}; // delete
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
optionalities.exit().remove(); // update
|
|
77
|
+
|
|
78
|
+
draw(optionalities); // add
|
|
79
|
+
|
|
80
|
+
var add_taregts = optionalities.enter().append('line').classed("optionality", true);
|
|
81
|
+
draw(add_taregts);
|
|
55
82
|
}
|
|
56
83
|
}, {
|
|
57
84
|
key: "drawOptionalityZero",
|
|
@@ -61,34 +88,32 @@ var PortOptionality = /*#__PURE__*/function () {
|
|
|
61
88
|
var filter = function filter() {
|
|
62
89
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
63
90
|
return ports.filter(function (d) {
|
|
64
|
-
return d.optionality === 0;
|
|
91
|
+
return d.optionality() === 0;
|
|
65
92
|
});
|
|
66
93
|
};
|
|
67
94
|
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
optionalities.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}).attr("r", 5).attr("fill", "#fefefe").attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
95
|
+
var selector = 'circle.optionality';
|
|
96
|
+
var optionalities = this.selections(g, selector, filter);
|
|
97
|
+
|
|
98
|
+
var draw = function draw(selection) {
|
|
99
|
+
selection.attr("cx", function (d) {
|
|
100
|
+
return d.optionalityPosition().x;
|
|
101
|
+
}).attr("cy", function (d) {
|
|
102
|
+
return d.optionalityPosition().y;
|
|
103
|
+
}).attr("r", 5).attr("fill", "#fefefe").attr("stroke-width", _this2.style().port.stroke.width).attr("stroke", _this2.style().port.stroke.color);
|
|
104
|
+
}; // delete
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
optionalities.exit().remove(); // update
|
|
108
|
+
|
|
109
|
+
draw(optionalities); // add
|
|
110
|
+
|
|
111
|
+
var add_taregts = optionalities.enter().append("circle").classed("optionality", true);
|
|
112
|
+
draw(add_taregts);
|
|
87
113
|
}
|
|
88
114
|
}, {
|
|
89
115
|
key: "draw",
|
|
90
116
|
value: function draw(g) {
|
|
91
|
-
// E1のインスタンス1つに対応する、E2のインスタンスの最小数
|
|
92
117
|
this.drawOptionalityOne(g);
|
|
93
118
|
this.drawOptionalityZero(g);
|
|
94
119
|
}
|
|
@@ -30,34 +30,40 @@ 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.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
36
|
+
this._parent = parent;
|
|
37
|
+
this.cardinality = new _PortCardinality["default"](this);
|
|
38
|
+
this.optionality = new _PortOptionality["default"](this);
|
|
39
|
+
this.circle = new _PortCircle["default"](this);
|
|
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: "rectum",
|
|
44
|
+
value: function rectum() {
|
|
45
|
+
return this._parent.rectum();
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "style",
|
|
49
|
+
value: function style() {
|
|
50
|
+
return this.rectum().style();
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "callbacks",
|
|
54
|
+
value: function callbacks() {
|
|
55
|
+
return this._parent.callbacks;
|
|
56
|
+
}
|
|
57
|
+
/* **************************************************************** *
|
|
58
|
+
* Old
|
|
59
|
+
* **************************************************************** */
|
|
60
|
+
// public
|
|
61
|
+
|
|
62
|
+
}, {
|
|
63
|
+
key: "draw",
|
|
64
|
+
value: function draw(groups_entity) {
|
|
65
|
+
this.cardinality.draw(groups_entity);
|
|
66
|
+
this.optionality.draw(groups_entity);
|
|
61
67
|
}
|
|
62
68
|
}]);
|
|
63
69
|
|