@yanqirenshi/d3.ter 0.1.6 → 0.1.8
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/dist/js/Entity.js +20 -8
- package/dist/js/Painter.js +12 -1
- package/dist/js/Painters/Entity.js +10 -0
- package/dist/js/Painters/PortCardinality.js +53 -153
- package/dist/js/Painters/PortOptionality.js +25 -9
- package/dist/js/Painters/Ports.js +13 -3
- package/dist/js/Painters/Relationships.js +10 -0
- package/dist/js/Port.js +21 -9
- package/dist/js/Rectum.js +33 -13
- package/package.json +1 -1
package/dist/js/Entity.js
CHANGED
|
@@ -56,12 +56,13 @@ var Entity = /*#__PURE__*/function (_Atman) {
|
|
|
56
56
|
|
|
57
57
|
var _super = _createSuper(Entity);
|
|
58
58
|
|
|
59
|
-
function Entity(data) {
|
|
59
|
+
function Entity(data, rectum) {
|
|
60
60
|
var _this;
|
|
61
61
|
|
|
62
62
|
_classCallCheck(this, Entity);
|
|
63
63
|
|
|
64
64
|
_this = _super.call(this, 'ENTITY', data);
|
|
65
|
+
_this._rectum = rectum;
|
|
65
66
|
|
|
66
67
|
_this.init();
|
|
67
68
|
|
|
@@ -72,7 +73,8 @@ var Entity = /*#__PURE__*/function (_Atman) {
|
|
|
72
73
|
_this.size = _objectSpread({}, data.size);
|
|
73
74
|
_this.type.contents = _this.entityTypeContents();
|
|
74
75
|
_this.background = _this.entityBackground();
|
|
75
|
-
_this.geometry = new _Geometry["default"]();
|
|
76
|
+
_this.geometry = new _Geometry["default"](); // iwasaki
|
|
77
|
+
|
|
76
78
|
_this._default = {
|
|
77
79
|
line: {
|
|
78
80
|
height: 14,
|
|
@@ -83,12 +85,22 @@ var Entity = /*#__PURE__*/function (_Atman) {
|
|
|
83
85
|
};
|
|
84
86
|
return _this;
|
|
85
87
|
}
|
|
86
|
-
/* **************************************************************** *
|
|
87
|
-
* Builder
|
|
88
|
-
* **************************************************************** */
|
|
89
|
-
|
|
90
88
|
|
|
91
89
|
_createClass(Entity, [{
|
|
90
|
+
key: "rectum",
|
|
91
|
+
value: function rectum() {
|
|
92
|
+
return this._rectum;
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "style",
|
|
96
|
+
value: function style() {
|
|
97
|
+
return this.rectum().style();
|
|
98
|
+
}
|
|
99
|
+
/* **************************************************************** *
|
|
100
|
+
* Builder
|
|
101
|
+
* **************************************************************** */
|
|
102
|
+
|
|
103
|
+
}, {
|
|
92
104
|
key: "init",
|
|
93
105
|
value: function init() {
|
|
94
106
|
this.padding = 8;
|
|
@@ -483,7 +495,7 @@ var Entity = /*#__PURE__*/function (_Atman) {
|
|
|
483
495
|
var data = this.type;
|
|
484
496
|
if (!data.contents) data.contents = '??';
|
|
485
497
|
data.size.h = this._default.line.height + data.padding * 2;
|
|
486
|
-
data.size.w = data.contents.length * this._default.line.font.size;
|
|
498
|
+
data.size.w = data.contents.length * this._default.line.font.size;
|
|
487
499
|
}
|
|
488
500
|
}, {
|
|
489
501
|
key: "sizing",
|
|
@@ -609,7 +621,7 @@ var Entity = /*#__PURE__*/function (_Atman) {
|
|
|
609
621
|
value: function positioningPort(port) {
|
|
610
622
|
var entity = this;
|
|
611
623
|
var line_port = this.geometry.getPortLine(port.degree(), entity);
|
|
612
|
-
var lines_entity = this.geometry.getFourSideLines(entity, 4,
|
|
624
|
+
var lines_entity = this.geometry.getFourSideLines(entity, 4, this.style().entity.margin);
|
|
613
625
|
var point = this.geometry.getCrossPoint(lines_entity, line_port);
|
|
614
626
|
port.position(point.point);
|
|
615
627
|
return port.point;
|
package/dist/js/Painter.js
CHANGED
|
@@ -22,9 +22,10 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
22
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; }
|
|
23
23
|
|
|
24
24
|
var Painter = /*#__PURE__*/function () {
|
|
25
|
-
function Painter(foreground, background, callbacks) {
|
|
25
|
+
function Painter(rectum, foreground, background, callbacks) {
|
|
26
26
|
_classCallCheck(this, Painter);
|
|
27
27
|
|
|
28
|
+
this._rectum = rectum;
|
|
28
29
|
this.foreground = foreground;
|
|
29
30
|
this.background = background;
|
|
30
31
|
this.callbacks = this.ensureCallbacks(callbacks);
|
|
@@ -44,6 +45,16 @@ var Painter = /*#__PURE__*/function () {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
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
|
+
}, {
|
|
47
58
|
key: "ensureCallbacks",
|
|
48
59
|
value: function ensureCallbacks(callbacks) {
|
|
49
60
|
var default_callbacks = {
|
|
@@ -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,170 +20,64 @@ 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
|
-
var rect = {
|
|
32
|
-
position: {
|
|
33
|
-
x: table.x,
|
|
34
|
-
y: table.y
|
|
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();
|
|
75
33
|
}
|
|
76
34
|
}, {
|
|
77
|
-
key: "
|
|
78
|
-
value: function
|
|
79
|
-
|
|
80
|
-
var line = d._relationship;
|
|
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
|
-
};
|
|
35
|
+
key: "style",
|
|
36
|
+
value: function style() {
|
|
37
|
+
return this.rectum().style();
|
|
148
38
|
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "drawLine",
|
|
151
|
-
value:
|
|
152
39
|
/* **************************************************************** *
|
|
153
40
|
* Draw Line (port to entity)
|
|
154
41
|
* **************************************************************** */
|
|
155
|
-
|
|
42
|
+
|
|
43
|
+
}, {
|
|
44
|
+
key: "drawLine",
|
|
45
|
+
value: function drawLine(g) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
|
|
156
48
|
var lines = g.selectAll('line').data(function (d) {
|
|
157
49
|
return d.ports.items.list;
|
|
158
50
|
}, function (d) {
|
|
159
51
|
return d.id();
|
|
160
|
-
});
|
|
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
|
+
|
|
161
68
|
|
|
162
69
|
lines.exit().remove(); // update
|
|
163
70
|
|
|
164
|
-
lines
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}).attr("x2", function (d) {
|
|
169
|
-
return d.linePosition().to.x;
|
|
170
|
-
}).attr("y2", function (d) {
|
|
171
|
-
return d.linePosition().to.y;
|
|
172
|
-
}).attr("stroke-width", 1).attr("stroke", "#a3a3a2"); // add
|
|
173
|
-
|
|
174
|
-
lines.enter().append("line").attr("x1", function (d) {
|
|
175
|
-
return d.linePosition().from.x;
|
|
176
|
-
}).attr("y1", function (d) {
|
|
177
|
-
return d.linePosition().from.y;
|
|
178
|
-
}).attr("x2", function (d) {
|
|
179
|
-
return d.linePosition().to.x;
|
|
180
|
-
}).attr("y2", function (d) {
|
|
181
|
-
return d.linePosition().to.y;
|
|
182
|
-
}).attr("stroke-width", 1).attr("stroke", "#a3a3a2");
|
|
71
|
+
draw(lines); // add
|
|
72
|
+
|
|
73
|
+
var add_targets = lines.enter().append("line");
|
|
74
|
+
draw(add_targets);
|
|
183
75
|
}
|
|
184
76
|
}, {
|
|
185
77
|
key: "drawCardinalityOne",
|
|
186
78
|
value: function drawCardinalityOne(g) {
|
|
79
|
+
var _this2 = this;
|
|
80
|
+
|
|
187
81
|
var filter = function filter() {
|
|
188
82
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
189
83
|
return ports.filter(function (port) {
|
|
@@ -191,7 +85,7 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
191
85
|
});
|
|
192
86
|
};
|
|
193
87
|
|
|
194
|
-
var
|
|
88
|
+
var cardinalities = g.selectAll('line.cardinality').data(function (d) {
|
|
195
89
|
return filter(d.ports.items.list);
|
|
196
90
|
}, function (d) {
|
|
197
91
|
return d.id();
|
|
@@ -206,18 +100,22 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
206
100
|
return d.cardinalityPosition().to.x;
|
|
207
101
|
}).attr("y2", function (d) {
|
|
208
102
|
return d.cardinalityPosition().to.y;
|
|
209
|
-
}).attr("stroke-width",
|
|
210
|
-
}; //
|
|
103
|
+
}).attr("stroke-width", _this2.style().port.stroke.width).attr("stroke", _this2.style().port.stroke.color);
|
|
104
|
+
}; // delete
|
|
211
105
|
|
|
212
106
|
|
|
213
|
-
|
|
107
|
+
cardinalities.exit().remove(); // update
|
|
214
108
|
|
|
215
|
-
|
|
109
|
+
draw(cardinalities); // add
|
|
110
|
+
|
|
111
|
+
var add_targets = cardinalities.enter().append('line').classed("cardinality", true);
|
|
216
112
|
draw(add_targets);
|
|
217
113
|
}
|
|
218
114
|
}, {
|
|
219
115
|
key: "drawCardinalityThree",
|
|
220
116
|
value: function drawCardinalityThree(g) {
|
|
117
|
+
var _this3 = this;
|
|
118
|
+
|
|
221
119
|
var filter = function filter() {
|
|
222
120
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
223
121
|
return ports.filter(function (port) {
|
|
@@ -225,7 +123,7 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
225
123
|
});
|
|
226
124
|
};
|
|
227
125
|
|
|
228
|
-
var
|
|
126
|
+
var cardinalities = g.selectAll('path.cardinality').data(function (d) {
|
|
229
127
|
return filter(d.ports.items.list);
|
|
230
128
|
}, function (d) {
|
|
231
129
|
return d.id();
|
|
@@ -239,13 +137,15 @@ var PortCardinality = /*#__PURE__*/function () {
|
|
|
239
137
|
var draw = function draw(selection) {
|
|
240
138
|
selection.attr('d', function (d) {
|
|
241
139
|
return line(d._cardinality);
|
|
242
|
-
}).attr("fill", 'none').attr("stroke-width",
|
|
243
|
-
}; //
|
|
140
|
+
}).attr("fill", 'none').attr("stroke-width", _this3.style().port.stroke.width).attr("stroke", _this3.style().port.stroke.color);
|
|
141
|
+
}; // delete
|
|
142
|
+
|
|
244
143
|
|
|
144
|
+
cardinalities.exit().remove(); // update
|
|
245
145
|
|
|
246
|
-
draw(
|
|
146
|
+
draw(cardinalities); // add
|
|
247
147
|
|
|
248
|
-
var add_targets =
|
|
148
|
+
var add_targets = cardinalities.enter().append('path').classed("cardinality", true);
|
|
249
149
|
draw(add_targets);
|
|
250
150
|
}
|
|
251
151
|
}, {
|
|
@@ -20,11 +20,23 @@ 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
|
+
}, {
|
|
28
40
|
key: "selections",
|
|
29
41
|
value: function selections(g, selector, filter) {
|
|
30
42
|
return g.selectAll(selector).data(function (d) {
|
|
@@ -36,6 +48,8 @@ var PortOptionality = /*#__PURE__*/function () {
|
|
|
36
48
|
}, {
|
|
37
49
|
key: "drawOptionalityOne",
|
|
38
50
|
value: function drawOptionalityOne(g) {
|
|
51
|
+
var _this = this;
|
|
52
|
+
|
|
39
53
|
var filter = function filter() {
|
|
40
54
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
41
55
|
return ports.filter(function (d) {
|
|
@@ -55,11 +69,11 @@ var PortOptionality = /*#__PURE__*/function () {
|
|
|
55
69
|
return d.optionalityPosition().to.x;
|
|
56
70
|
}).attr("y2", function (d) {
|
|
57
71
|
return d.optionalityPosition().to.y;
|
|
58
|
-
}).attr("stroke-width",
|
|
59
|
-
}; //
|
|
60
|
-
|
|
61
|
-
// update
|
|
72
|
+
}).attr("stroke-width", _this.style().port.stroke.width).attr("stroke", _this.style().port.stroke.color);
|
|
73
|
+
}; // delete
|
|
74
|
+
|
|
62
75
|
|
|
76
|
+
optionalities.exit().remove(); // update
|
|
63
77
|
|
|
64
78
|
draw(optionalities); // add
|
|
65
79
|
|
|
@@ -69,6 +83,8 @@ var PortOptionality = /*#__PURE__*/function () {
|
|
|
69
83
|
}, {
|
|
70
84
|
key: "drawOptionalityZero",
|
|
71
85
|
value: function drawOptionalityZero(g) {
|
|
86
|
+
var _this2 = this;
|
|
87
|
+
|
|
72
88
|
var filter = function filter() {
|
|
73
89
|
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
74
90
|
return ports.filter(function (d) {
|
|
@@ -84,11 +100,11 @@ var PortOptionality = /*#__PURE__*/function () {
|
|
|
84
100
|
return d.optionalityPosition().x;
|
|
85
101
|
}).attr("cy", function (d) {
|
|
86
102
|
return d.optionalityPosition().y;
|
|
87
|
-
}).attr("r", 5).attr("fill", "#fefefe").attr("stroke-width",
|
|
88
|
-
}; //
|
|
89
|
-
|
|
90
|
-
// update
|
|
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
|
+
|
|
91
106
|
|
|
107
|
+
optionalities.exit().remove(); // update
|
|
92
108
|
|
|
93
109
|
draw(optionalities); // add
|
|
94
110
|
|
|
@@ -34,12 +34,22 @@ var Ports = /*#__PURE__*/function () {
|
|
|
34
34
|
_classCallCheck(this, Ports);
|
|
35
35
|
|
|
36
36
|
this._parent = parent;
|
|
37
|
-
this.cardinality = new _PortCardinality["default"]();
|
|
38
|
-
this.optionality = new _PortOptionality["default"]();
|
|
39
|
-
this.circle = new _PortCircle["default"]();
|
|
37
|
+
this.cardinality = new _PortCardinality["default"](this);
|
|
38
|
+
this.optionality = new _PortOptionality["default"](this);
|
|
39
|
+
this.circle = new _PortCircle["default"](this);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
_createClass(Ports, [{
|
|
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
|
+
}, {
|
|
43
53
|
key: "callbacks",
|
|
44
54
|
value: function callbacks() {
|
|
45
55
|
return this._parent.callbacks;
|
|
@@ -19,6 +19,16 @@ var Relationships = /*#__PURE__*/function () {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
_createClass(Relationships, [{
|
|
22
|
+
key: "rectum",
|
|
23
|
+
value: function rectum() {
|
|
24
|
+
return this._parent.rectum();
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "style",
|
|
28
|
+
value: function style() {
|
|
29
|
+
return this.rectum().style();
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
22
32
|
key: "callbacks",
|
|
23
33
|
value: function callbacks() {
|
|
24
34
|
return this._parent.callbacks;
|
package/dist/js/Port.js
CHANGED
|
@@ -38,12 +38,13 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
38
38
|
|
|
39
39
|
var _super = _createSuper(Port);
|
|
40
40
|
|
|
41
|
-
function Port(type, entity, relatihonship_data) {
|
|
41
|
+
function Port(type, entity, relatihonship_data, rectum) {
|
|
42
42
|
var _this;
|
|
43
43
|
|
|
44
44
|
_classCallCheck(this, Port);
|
|
45
45
|
|
|
46
46
|
_this = _super.call(this, type === 'from' ? 'PORT-FROM' : 'PORT-TO', relatihonship_data);
|
|
47
|
+
_this._rectum = rectum;
|
|
47
48
|
_this._id = relatihonship_data.id + '_' + entity._id; // Idenrifier-Instance
|
|
48
49
|
|
|
49
50
|
_this._owner = entity;
|
|
@@ -67,6 +68,16 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
_createClass(Port, [{
|
|
71
|
+
key: "rectum",
|
|
72
|
+
value: function rectum() {
|
|
73
|
+
return this._rectum;
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "style",
|
|
77
|
+
value: function style() {
|
|
78
|
+
return this.rectum().style();
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
70
81
|
key: "core",
|
|
71
82
|
value: function core() {
|
|
72
83
|
return this._core;
|
|
@@ -154,12 +165,12 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
154
165
|
}, {
|
|
155
166
|
key: "cardinalityDistance",
|
|
156
167
|
value: function cardinalityDistance() {
|
|
157
|
-
return this.
|
|
168
|
+
return this.style().port.cardinality.distance;
|
|
158
169
|
}
|
|
159
170
|
}, {
|
|
160
171
|
key: "optionalityDistance",
|
|
161
172
|
value: function optionalityDistance() {
|
|
162
|
-
return this.
|
|
173
|
+
return this.style().port.optionality.distance;
|
|
163
174
|
}
|
|
164
175
|
}, {
|
|
165
176
|
key: "cardinalityPosition",
|
|
@@ -197,16 +208,17 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
197
208
|
h: entity_size.h
|
|
198
209
|
}
|
|
199
210
|
};
|
|
200
|
-
var geometry = this.geometry;
|
|
211
|
+
var geometry = this.geometry;
|
|
212
|
+
var margin = this.style().entity.margin; // entity の四辺
|
|
201
213
|
|
|
202
|
-
var four_side_lines = geometry.getFourSideLines(rect, 4,
|
|
214
|
+
var four_side_lines = geometry.getFourSideLines(rect, 4, margin); // port と entityの中心との直線。
|
|
203
215
|
|
|
204
216
|
var line_port = geometry.getPortLine(this.degree(), rect); // port と entityの中心との直線 と entity の四辺の交点。
|
|
205
217
|
// 交点 と どの辺 が返ってくる。
|
|
206
218
|
|
|
207
219
|
var cross_point = geometry.getCrossPoint(four_side_lines, line_port); // entity と port との距離
|
|
208
220
|
|
|
209
|
-
var len =
|
|
221
|
+
var len = margin + 4; // 4: ?
|
|
210
222
|
// point の位置を返す
|
|
211
223
|
|
|
212
224
|
var to_point = cross_point.point;
|
|
@@ -297,7 +309,7 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
297
309
|
}
|
|
298
310
|
};
|
|
299
311
|
|
|
300
|
-
case '
|
|
312
|
+
case 'UP':
|
|
301
313
|
return {
|
|
302
314
|
from: {
|
|
303
315
|
x: from.x + r,
|
|
@@ -363,7 +375,7 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
363
375
|
case 'DOWN':
|
|
364
376
|
return [[from.x - distance, from.y], [from.x, from.y + distance], [from.x + distance, from.y]];
|
|
365
377
|
|
|
366
|
-
case '
|
|
378
|
+
case 'UP':
|
|
367
379
|
return [[from.x - distance, from.y], [from.x, from.y - distance], [from.x + distance, from.y]];
|
|
368
380
|
|
|
369
381
|
case 'RIGHT':
|
|
@@ -391,7 +403,7 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
391
403
|
y: from.y + distance
|
|
392
404
|
};
|
|
393
405
|
|
|
394
|
-
case '
|
|
406
|
+
case 'UP':
|
|
395
407
|
return {
|
|
396
408
|
x: from.x,
|
|
397
409
|
y: from.y - distance
|
package/dist/js/Rectum.js
CHANGED
|
@@ -73,14 +73,6 @@ var Rectum = /*#__PURE__*/function (_Colon) {
|
|
|
73
73
|
_this.callbacks = _this.ensureCallbacks(params.callbacks);
|
|
74
74
|
_this._entities = POOL.make();
|
|
75
75
|
_this._relationships = POOL.make();
|
|
76
|
-
_this._default = {
|
|
77
|
-
line: {
|
|
78
|
-
height: 14,
|
|
79
|
-
font: {
|
|
80
|
-
size: 14
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
76
|
return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
|
|
85
77
|
}
|
|
86
78
|
|
|
@@ -145,10 +137,10 @@ var Rectum = /*#__PURE__*/function (_Colon) {
|
|
|
145
137
|
var entity_to = _this2.getEntity(to.entity); // Port のクラスインスタンスを作成する。
|
|
146
138
|
|
|
147
139
|
|
|
148
|
-
var port_from = new _Port["default"]('from', entity_from, r);
|
|
149
|
-
var port_to = new _Port["default"]('to', entity_to, r); // Relationship のクラスインスタンスを作成する。
|
|
140
|
+
var port_from = new _Port["default"]('from', entity_from, r, _this2);
|
|
141
|
+
var port_to = new _Port["default"]('to', entity_to, r, _this2); // Relationship のクラスインスタンスを作成する。
|
|
150
142
|
|
|
151
|
-
var element = new _Relationship["default"](r, port_from, port_to); // entity(from) に port をセットする。
|
|
143
|
+
var element = new _Relationship["default"](r, port_from, port_to, _this2); // entity(from) に port をセットする。
|
|
152
144
|
// entity_from.ports.items.ht[port_from._id] = port_from;
|
|
153
145
|
// entity_from.ports.items.list.push(port_from);
|
|
154
146
|
// port_from._entity = entity_from;
|
|
@@ -169,6 +161,8 @@ var Rectum = /*#__PURE__*/function (_Colon) {
|
|
|
169
161
|
}, {
|
|
170
162
|
key: "data",
|
|
171
163
|
value: function data(_data) {
|
|
164
|
+
var _this3 = this;
|
|
165
|
+
|
|
172
166
|
this._identifiers = POOL.list2pool(_data.identifiers, function (d) {
|
|
173
167
|
return new _Identifier["default"](d);
|
|
174
168
|
});
|
|
@@ -180,7 +174,7 @@ var Rectum = /*#__PURE__*/function (_Colon) {
|
|
|
180
174
|
attributes: this._attributes
|
|
181
175
|
};
|
|
182
176
|
this._entities = POOL.list2pool(_data.entities, function (d) {
|
|
183
|
-
return new _Entity["default"](d).build(elements).sizing().positioning();
|
|
177
|
+
return new _Entity["default"](d, _this3).build(elements).sizing().positioning();
|
|
184
178
|
});
|
|
185
179
|
this._relationships = this.buildRelationshipsWithPort(_data.relationships);
|
|
186
180
|
|
|
@@ -196,7 +190,33 @@ var Rectum = /*#__PURE__*/function (_Colon) {
|
|
|
196
190
|
value: function draw() {
|
|
197
191
|
var fore = this.layer('foreground');
|
|
198
192
|
var back = this.layer('background');
|
|
199
|
-
new _Painter["default"](fore, back, this.callbacks)
|
|
193
|
+
var painter = new _Painter["default"](this, fore, back, this.callbacks);
|
|
194
|
+
painter.draw(this.entities(), this._relationships);
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "style",
|
|
198
|
+
value: function style() {
|
|
199
|
+
return {
|
|
200
|
+
entity: {
|
|
201
|
+
margin: 33
|
|
202
|
+
},
|
|
203
|
+
port: {
|
|
204
|
+
stroke: {
|
|
205
|
+
width: 1,
|
|
206
|
+
color: '#888888'
|
|
207
|
+
},
|
|
208
|
+
optionality: {
|
|
209
|
+
distance: 22,
|
|
210
|
+
zero: {
|
|
211
|
+
fill: "#fefefe"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
cardinality: {
|
|
215
|
+
distance: 11
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
relationship: {}
|
|
219
|
+
};
|
|
200
220
|
}
|
|
201
221
|
}]);
|
|
202
222
|
|