@yanqirenshi/d3.ter 0.0.1 → 0.0.2

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.
@@ -1,58 +1,54 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports["default"] = void 0;
7
9
 
8
- var _Pool = _interopRequireDefault(require("./Pool.js"));
10
+ var _Atman2 = _interopRequireDefault(require("./Atman.js"));
9
11
 
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
+ var _Name = _interopRequireDefault(require("./utils/Name.js"));
11
13
 
12
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
15
 
14
16
  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); } }
15
17
 
16
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
19
 
18
- var Identifier = /*#__PURE__*/function () {
19
- function Identifier() {
20
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
+
22
+ 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); }
23
+
24
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
25
+
26
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
27
+
28
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
29
+
30
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
+
32
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
33
+
34
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
+
36
+ var Identifier = /*#__PURE__*/function (_Atman) {
37
+ _inherits(Identifier, _Atman);
38
+
39
+ var _super = _createSuper(Identifier);
40
+
41
+ function Identifier(data) {
42
+ var _this;
43
+
20
44
  _classCallCheck(this, Identifier);
45
+
46
+ _this = _super.call(this, 'IDENTIFIER', data);
47
+ _this.name = new _Name["default"](data.name);
48
+ return _this;
21
49
  }
22
50
 
23
- _createClass(Identifier, [{
24
- key: "list2pool",
25
- value: function list2pool(list) {
26
- return new _Pool["default"]().list2pool(list, function (d) {
27
- return d;
28
- });
29
- }
30
- }, {
31
- key: "template",
32
- value: function template() {
33
- return {
34
- _id: null,
35
- _class: 'IDENTIFIER',
36
- name: {
37
- physical: '??',
38
- logical: ''
39
- },
40
- _core: null
41
- };
42
- }
43
- }, {
44
- key: "build",
45
- value: function build(core) {
46
- var element = this.template();
47
- element._id = core.id;
48
- element.name = core.name;
49
- element._core = core;
50
- core._element = element;
51
- return element;
52
- }
53
- }]);
54
-
55
- return Identifier;
56
- }();
51
+ return _createClass(Identifier);
52
+ }(_Atman2["default"]);
57
53
 
58
54
  exports["default"] = Identifier;
@@ -9,14 +9,20 @@ exports["default"] = void 0;
9
9
 
10
10
  var _ColumnInstance2 = _interopRequireDefault(require("./ColumnInstance.js"));
11
11
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
+ var _Name = _interopRequireDefault(require("./utils/Name.js"));
13
13
 
14
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ var _Position = _interopRequireDefault(require("./utils/Position.js"));
15
+
16
+ var _Size = _interopRequireDefault(require("./utils/Size.js"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
19
 
16
20
  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); } }
17
21
 
18
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; }
19
23
 
24
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
+
20
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); }
21
27
 
22
28
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
@@ -36,38 +42,20 @@ var IdentifierInstance = /*#__PURE__*/function (_ColumnInstance) {
36
42
 
37
43
  var _super = _createSuper(IdentifierInstance);
38
44
 
39
- function IdentifierInstance() {
45
+ function IdentifierInstance(master, data) {
46
+ var _this;
47
+
40
48
  _classCallCheck(this, IdentifierInstance);
41
49
 
42
- return _super.apply(this, arguments);
50
+ _this = _super.call(this, 'IDENTIFIER-INSTANCE', master, data);
51
+ _this.name = new _Name["default"](data.name ? data.name : master.name);
52
+ _this.position = new _Position["default"]();
53
+ _this.size = new _Size["default"]();
54
+ _this._ports = [];
55
+ return _this;
43
56
  }
44
57
 
45
- _createClass(IdentifierInstance, [{
46
- key: "template",
47
- value: function template() {
48
- return {
49
- _id: null,
50
- _class: 'IDENTIFIER-INSTANCE',
51
- name: {
52
- physical: '??',
53
- logical: ''
54
- },
55
- position: {
56
- x: 0,
57
- y: 0
58
- },
59
- size: {
60
- w: 0,
61
- h: 0
62
- },
63
- _master: null,
64
- _core: null,
65
- _ports: []
66
- };
67
- }
68
- }]);
69
-
70
- return IdentifierInstance;
58
+ return _createClass(IdentifierInstance);
71
59
  }(_ColumnInstance2["default"]);
72
60
 
73
61
  exports["default"] = IdentifierInstance;
@@ -0,0 +1,430 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var d3 = _interopRequireWildcard(require("d3"));
11
+
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+
18
+ 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); } }
19
+
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
+
22
+ var Painter = /*#__PURE__*/function () {
23
+ function Painter() {
24
+ _classCallCheck(this, Painter);
25
+
26
+ this._default = {
27
+ line: {
28
+ height: 14,
29
+ font: {
30
+ size: 14
31
+ }
32
+ }
33
+ };
34
+ }
35
+ /* **************************************************************** *
36
+ * Move
37
+ * **************************************************************** */
38
+
39
+
40
+ _createClass(Painter, [{
41
+ key: "dragStart",
42
+ value: function dragStart(d) {// let e = d3.event;
43
+ // d._drag = {
44
+ // start: {
45
+ // x: e.x,
46
+ // y: e.y,
47
+ // }
48
+ // };
49
+ }
50
+ }, {
51
+ key: "dragged",
52
+ value: function dragged(d) {// let e = d3.event;
53
+ // d.position.x += e.x - d._drag.start.x;
54
+ // d.position.y += e.y - d._drag.start.y;
55
+ // this.moveEntity(d);
56
+ }
57
+ }, {
58
+ key: "dragEnd",
59
+ value: function dragEnd(entity) {// let campus = STORE.get('active.ter.campus');
60
+ // delete entity._drag;
61
+ // ACTIONS.saveTerEntityPosition(campus, entity);
62
+ }
63
+ }, {
64
+ key: "addMoveEvents2Body",
65
+ value: function addMoveEvents2Body(body) {
66
+ var _this = this;
67
+
68
+ return body.call(d3.drag().on("start", function (d) {
69
+ return _this.dragStart(d);
70
+ }).on("drag", function (d) {
71
+ return _this.dragged(d);
72
+ }).on("end", function (d) {
73
+ return _this.dragEnd(d);
74
+ }));
75
+ }
76
+ /* **************************************************************** *
77
+ * Draw this.entity
78
+ * **************************************************************** */
79
+
80
+ }, {
81
+ key: "drawGroup",
82
+ value: function drawGroup(place, data) {
83
+ return place.selectAll('g.entity').data(data, function (d) {
84
+ return d._id;
85
+ }).enter().append('g').attr('class', 'entity').attr('entity-id', function (d) {
86
+ return d._id;
87
+ }).attr('entity-code', function (d) {
88
+ return d._core.type;
89
+ }).attr('entity-type', function (d) {
90
+ return d._class;
91
+ }).attr("transform", function (d) {
92
+ return "translate(" + d.position.x + "," + d.position.y + ")";
93
+ });
94
+ }
95
+ /* ************************************ *
96
+ * Body *
97
+ * ************************************ */
98
+
99
+ }, {
100
+ key: "drawBodyCore",
101
+ value: function drawBodyCore(body) {
102
+ body.attr('class', 'entity-body').attr('width', function (d) {
103
+ return d.size.w;
104
+ }).attr('height', function (d) {
105
+ return d.size.h;
106
+ }).attr('rx', function (d) {
107
+ return 5;
108
+ }).attr('ry', function (d) {
109
+ return 5;
110
+ }).attr('fill', function (d) {
111
+ return d.background.color;
112
+ });
113
+ }
114
+ }, {
115
+ key: "drawBody",
116
+ value: function drawBody(groups) {
117
+ var body = groups.append('rect');
118
+ this.drawBodyCore(body);
119
+ return this.addMoveEvents2Body(body);
120
+ }
121
+ /* ************************************ *
122
+ * Name *
123
+ * ************************************ */
124
+
125
+ }, {
126
+ key: "drawNameRect",
127
+ value: function drawNameRect(rects) {
128
+ rects.attr('x', function (d) {
129
+ return d.name.position.x;
130
+ }).attr('y', function (d) {
131
+ return d.name.position.y;
132
+ }).attr('width', function (d) {
133
+ return d.name.size.w;
134
+ }).attr('height', function (d) {
135
+ return d.name.size.h;
136
+ }).attr('rx', function (d) {
137
+ return 3;
138
+ }).attr('ry', function (d) {
139
+ return 3;
140
+ }).attr('fill', function (d) {
141
+ return d.background.color;
142
+ });
143
+ }
144
+ }, {
145
+ key: "drawNameText",
146
+ value: function drawNameText(texts) {
147
+ var _this2 = this;
148
+
149
+ return texts.attr('class', 'entity-title').attr("x", function (d) {
150
+ return d.padding + d.name.padding;
151
+ }).attr("y", function (d) {
152
+ return d.padding + d.name.padding + _this2._default.line.font.size;
153
+ }).attr("fill", function (d) {
154
+ return '#fff';
155
+ }).attr("font-size", function (d) {
156
+ return 24;
157
+ }).text(function (d) {
158
+ return d.name.val();
159
+ });
160
+ }
161
+ }, {
162
+ key: "drawName",
163
+ value: function drawName(groups, callbacks) {
164
+ var rects = groups.append('rect').on("click", function (d) {
165
+ var func = callbacks.entity.click;
166
+ if (func) func(d);
167
+ }).attr('class', 'entity-title');
168
+ this.drawNameRect(rects);
169
+ var texts = groups.append('text').on("click", function (d) {
170
+ var func = callbacks.entity.click;
171
+ if (func) func(d);
172
+ }).attr('class', 'entity-title');
173
+ this.drawNameText(texts).each(function (d) {
174
+ if (!d._max) d._max_w = {
175
+ name: 0,
176
+ identifier: 0,
177
+ attribute: 0
178
+ };
179
+ var w = this.getBBox().width;
180
+ if (w > d._max_w.name) d._max_w.name = w;
181
+ });
182
+ }
183
+ /* ************************************ *
184
+ * Type *
185
+ * ************************************ */
186
+
187
+ }, {
188
+ key: "drawTypeRect",
189
+ value: function drawTypeRect(selection) {
190
+ selection.attr('x', function (d) {
191
+ return d.type.position.x;
192
+ }).attr('y', function (d) {
193
+ return d.type.position.y;
194
+ }).attr('width', function (d) {
195
+ return d.type.size.w;
196
+ }).attr('height', function (d) {
197
+ return d.type.size.h;
198
+ }).attr('rx', function (d) {
199
+ return 3;
200
+ }).attr('ry', function (d) {
201
+ return 3;
202
+ }).attr('fill', function (d) {
203
+ return d.background.color;
204
+ });
205
+ }
206
+ }, {
207
+ key: "drawTypeText",
208
+ value: function drawTypeText(selection) {
209
+ var _this3 = this;
210
+
211
+ return selection.attr("x", function (d) {
212
+ return d.padding + d.name.size.w + 11 + d.type.padding;
213
+ }).attr("y", function (d) {
214
+ return d.type.position.y + d.type.padding + _this3._default.line.font.size;
215
+ }).attr("fill", function (d) {
216
+ return '#fff';
217
+ }).text(function (d) {
218
+ return d.type.contents;
219
+ });
220
+ }
221
+ }, {
222
+ key: "drawType",
223
+ value: function drawType(groups) {
224
+ var rects = groups.append('rect').attr('class', 'entity-type');
225
+ this.drawTypeRect(rects);
226
+ var texts = groups.append('text').attr('class', 'entity-type');
227
+ this.drawTypeText(texts).each(function (d) {
228
+ var w = this.getBBox().width;
229
+ if (w > (d.type._max_w || 0)) d.type._max_w = w;
230
+ });
231
+ }
232
+ /* ************************************ *
233
+ * Identifiers *
234
+ * ************************************ */
235
+
236
+ }, {
237
+ key: "drawIdentifiersRect",
238
+ value: function drawIdentifiersRect(rects) {
239
+ rects.attr('x', function (d) {
240
+ return d.identifiers.position.x;
241
+ }).attr('y', function (d) {
242
+ return d.identifiers.position.y;
243
+ }).attr('width', function (d) {
244
+ return d.identifiers.size.w;
245
+ }).attr('height', function (d) {
246
+ return d.identifiers.size.h;
247
+ }).attr('rx', function (d) {
248
+ return 3;
249
+ }).attr('ry', function (d) {
250
+ return 3;
251
+ }).attr('fill', function (d) {
252
+ return d.identifiers.background.color;
253
+ });
254
+ }
255
+ }, {
256
+ key: "drawIdentifiersText",
257
+ value: function drawIdentifiersText(texts) {
258
+ return texts.attr("x", function (d) {
259
+ return d.position.x;
260
+ }).attr("y", function (d) {
261
+ return d.position.y;
262
+ }).text(function (d) {
263
+ return d.name.val();
264
+ });
265
+ }
266
+ }, {
267
+ key: "drawIdentifiers",
268
+ value: function drawIdentifiers(groups) {
269
+ var rects = groups.append('rect').attr('class', 'entity-identifiers');
270
+ this.drawIdentifiersRect(rects);
271
+ var texts = groups.selectAll('text.identifier').data(function (d) {
272
+ return d.identifiers.contents.list;
273
+ }).enter().append('text').attr('class', 'identifier').attr('identifier-id', function (d) {
274
+ return d._id;
275
+ });
276
+ this.drawIdentifiersText(texts).each(function (identifier) {
277
+ var w = this.getBBox().width;
278
+ if (w > identifier._entity._max_w.identifier) identifier._entity._max_w.identifier = w;
279
+ });
280
+ }
281
+ /* ************************************ *
282
+ * Attributes *
283
+ * ************************************ */
284
+
285
+ }, {
286
+ key: "drawAttributesRect",
287
+ value: function drawAttributesRect(rects) {
288
+ rects.attr('x', function (d) {
289
+ return d.attributes.position.x;
290
+ }).attr('y', function (d) {
291
+ return d.attributes.position.y;
292
+ }).attr('width', function (d) {
293
+ return d.attributes.size.w;
294
+ }).attr('height', function (d) {
295
+ return d.attributes.size.h;
296
+ }).attr('rx', function (d) {
297
+ return 3;
298
+ }).attr('ry', function (d) {
299
+ return 3;
300
+ }).attr('fill', function (d) {
301
+ return d.identifiers.background.color;
302
+ });
303
+ }
304
+ }, {
305
+ key: "drawAttributesText",
306
+ value: function drawAttributesText(texts) {
307
+ return texts.attr("x", function (d) {
308
+ return d.position.x;
309
+ }).attr("y", function (d) {
310
+ return d.position.y;
311
+ }).text(function (d) {
312
+ return d.name.val();
313
+ });
314
+ }
315
+ }, {
316
+ key: "drawAttributes",
317
+ value: function drawAttributes(groups) {
318
+ var rects = groups.append('rect').attr('class', 'entity-attributes');
319
+ this.drawAttributesRect(rects);
320
+ var texts = groups.selectAll('text.attribute').data(function (d) {
321
+ return d.attributes.contents.list;
322
+ }).enter().append('text').attr('class', 'attribute').attr('attribute-id', function (d) {
323
+ return d._id;
324
+ });
325
+ this.drawAttributesText(texts).each(function (attribute) {
326
+ var w = this.getBBox().width;
327
+ if (w > attribute._entity._max_w.attribute) attribute._entity._max_w.attribute = w;
328
+ });
329
+ }
330
+ /* ************************************ *
331
+ * Port *
332
+ * ************************************ */
333
+
334
+ }, {
335
+ key: "drawPortsCore",
336
+ value: function drawPortsCore(ports) {
337
+ ports.attr('class', 'entity-port').attr('cx', function (d) {
338
+ return d.position.x;
339
+ }).attr('cy', function (d) {
340
+ return d.position.y;
341
+ }).attr('r', 4).attr('fill', '#fff').attr('stroke', '#000').attr('stroke-width', 0.5).attr('degree', function (d) {
342
+ return d._owner._core.position || 0;
343
+ }).attr('port-id', function (d) {
344
+ return d._id;
345
+ });
346
+ }
347
+ }, {
348
+ key: "drawPorts",
349
+ value: function drawPorts(groups) {
350
+ var ports = groups.selectAll('circle.entity-port').data(function (d) {
351
+ return d.ports.items.list;
352
+ }).enter().append('circle');
353
+ this.drawPortsCore(ports);
354
+ }
355
+ /* ************************************ *
356
+ * relationships *
357
+ * ************************************ */
358
+
359
+ }, {
360
+ key: "drawRelationshipsCore",
361
+ value: function drawRelationshipsCore(edges) {
362
+ edges.attr('x1', function (d) {
363
+ var port = d.from;
364
+ var entity = d.from._entity;
365
+ return port.position.x + entity.position.x;
366
+ }).attr('y1', function (d) {
367
+ var port = d.from;
368
+ var entity = d.from._entity;
369
+ return port.position.y + entity.position.y;
370
+ }).attr('x2', function (d) {
371
+ var port = d.to;
372
+ var entity = d.to._entity;
373
+ return port.position.x + entity.position.x;
374
+ }).attr('y2', function (d) {
375
+ var port = d.to;
376
+ var entity = d.to._entity;
377
+ return port.position.y + entity.position.y;
378
+ }).attr('stroke', '#888888').attr('stroke-width', 1);
379
+ }
380
+ }, {
381
+ key: "drawRelationships",
382
+ value: function drawRelationships(place, relationships) {
383
+ var data = relationships.list.filter(function (edge) {
384
+ return edge.from._class === 'PORT-FROM' && edge.to._class === 'PORT-TO';
385
+ });
386
+ var edges = place.selectAll('line.connector').data(data, function (d) {
387
+ return d._id;
388
+ }).enter().append('line').attr('class', 'connector');
389
+ this.drawRelationshipsCore(edges);
390
+ }
391
+ /* ************************************ *
392
+ * Draw Main *
393
+ * ************************************ */
394
+
395
+ }, {
396
+ key: "redraw",
397
+ value: function redraw(groups) {
398
+ this.drawBodyCore(groups.selectAll('rect.entity-body'));
399
+ this.drawNameRect(groups.selectAll('rect.entity-title'));
400
+ this.drawNameText(groups.selectAll('text.entity-title'));
401
+ this.drawTypeRect(groups.selectAll('rect.entity-type'));
402
+ this.drawTypeText(groups.selectAll('text.entity-type'));
403
+ this.drawIdentifiersRect(groups.selectAll('rect.entity-identifiers'));
404
+ this.drawIdentifiersText(groups.selectAll('text.identifier'));
405
+ this.drawAttributesRect(groups.selectAll('rect.entity-attributes'));
406
+ this.drawAttributesText(groups.selectAll('text.attribute'));
407
+ }
408
+ }, {
409
+ key: "draw",
410
+ value: function draw(fore, back, entities, relationsihps) {
411
+ var groups = this.drawGroup(fore, entities.list);
412
+ this.drawBody(groups);
413
+ this.drawName(groups, this._callbacks);
414
+ this.drawType(groups);
415
+ this.drawIdentifiers(groups);
416
+ this.drawAttributes(groups); // resizing & redraw
417
+
418
+ groups.each(function (entity) {
419
+ return entity.reSizing().positioning();
420
+ });
421
+ this.redraw(groups);
422
+ this.drawPorts(groups);
423
+ this.drawRelationships(back, relationsihps);
424
+ }
425
+ }]);
426
+
427
+ return Painter;
428
+ }();
429
+
430
+ exports["default"] = Painter;