@yanqirenshi/d3.ter 0.1.1 → 0.1.3
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/Geometry.js +1 -1
- package/dist/js/Painter.js +5 -2
- package/dist/js/Painters/Entity.js +11 -3
- package/dist/js/Painters/PortCardinality.js +206 -0
- package/dist/js/Painters/PortCircle.js +54 -0
- package/dist/js/Painters/PortOptionality.js +100 -0
- package/dist/js/Painters/Ports.js +32 -20
- package/dist/js/Port.js +10 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
2
|
-
|
|
3
|
-
## Available Scripts
|
|
4
|
-
|
|
5
|
-
In the project directory, you can run:
|
|
6
|
-
|
|
7
|
-
### `npm start`
|
|
8
|
-
|
|
9
|
-
Runs the app in the development mode.<br />
|
|
10
|
-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
11
|
-
|
|
12
|
-
The page will reload if you make edits.<br />
|
|
13
|
-
You will also see any lint errors in the console.
|
|
14
|
-
|
|
15
|
-
### `npm test`
|
|
16
|
-
|
|
17
|
-
Launches the test runner in the interactive watch mode.<br />
|
|
18
|
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
19
|
-
|
|
20
|
-
### `npm run build`
|
|
21
|
-
|
|
22
|
-
Builds the app for production to the `build` folder.<br />
|
|
23
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
24
|
-
|
|
25
|
-
The build is minified and the filenames include the hashes.<br />
|
|
26
|
-
Your app is ready to be deployed!
|
|
27
|
-
|
|
28
|
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
29
|
-
|
|
30
|
-
### `npm run eject`
|
|
31
|
-
|
|
32
|
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
33
|
-
|
|
34
|
-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
35
|
-
|
|
36
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
37
|
-
|
|
38
|
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
39
|
-
|
|
40
|
-
## Learn More
|
|
41
|
-
|
|
42
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
43
|
-
|
|
44
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
45
|
-
|
|
46
|
-
### Code Splitting
|
|
47
|
-
|
|
48
|
-
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
|
49
|
-
|
|
50
|
-
### Analyzing the Bundle Size
|
|
51
|
-
|
|
52
|
-
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
|
53
|
-
|
|
54
|
-
### Making a Progressive Web App
|
|
55
|
-
|
|
56
|
-
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
|
57
|
-
|
|
58
|
-
### Advanced Configuration
|
|
59
|
-
|
|
60
|
-
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
|
61
|
-
|
|
62
|
-
### Deployment
|
|
63
|
-
|
|
64
|
-
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
|
65
|
-
|
|
66
|
-
### `npm run build` fails to minify
|
|
67
|
-
|
|
68
|
-
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
|
1
|
+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
2
|
+
|
|
3
|
+
## Available Scripts
|
|
4
|
+
|
|
5
|
+
In the project directory, you can run:
|
|
6
|
+
|
|
7
|
+
### `npm start`
|
|
8
|
+
|
|
9
|
+
Runs the app in the development mode.<br />
|
|
10
|
+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
11
|
+
|
|
12
|
+
The page will reload if you make edits.<br />
|
|
13
|
+
You will also see any lint errors in the console.
|
|
14
|
+
|
|
15
|
+
### `npm test`
|
|
16
|
+
|
|
17
|
+
Launches the test runner in the interactive watch mode.<br />
|
|
18
|
+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
19
|
+
|
|
20
|
+
### `npm run build`
|
|
21
|
+
|
|
22
|
+
Builds the app for production to the `build` folder.<br />
|
|
23
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
24
|
+
|
|
25
|
+
The build is minified and the filenames include the hashes.<br />
|
|
26
|
+
Your app is ready to be deployed!
|
|
27
|
+
|
|
28
|
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
29
|
+
|
|
30
|
+
### `npm run eject`
|
|
31
|
+
|
|
32
|
+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
33
|
+
|
|
34
|
+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
35
|
+
|
|
36
|
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
37
|
+
|
|
38
|
+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
39
|
+
|
|
40
|
+
## Learn More
|
|
41
|
+
|
|
42
|
+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
43
|
+
|
|
44
|
+
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
45
|
+
|
|
46
|
+
### Code Splitting
|
|
47
|
+
|
|
48
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
|
49
|
+
|
|
50
|
+
### Analyzing the Bundle Size
|
|
51
|
+
|
|
52
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
|
53
|
+
|
|
54
|
+
### Making a Progressive Web App
|
|
55
|
+
|
|
56
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
|
57
|
+
|
|
58
|
+
### Advanced Configuration
|
|
59
|
+
|
|
60
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
|
61
|
+
|
|
62
|
+
### Deployment
|
|
63
|
+
|
|
64
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
|
65
|
+
|
|
66
|
+
### `npm run build` fails to minify
|
|
67
|
+
|
|
68
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
package/dist/js/Geometry.js
CHANGED
|
@@ -129,7 +129,7 @@ var Geometry = /*#__PURE__*/function () {
|
|
|
129
129
|
value: function getPortLine(port, rect) {
|
|
130
130
|
// degree,
|
|
131
131
|
var from = this.getPortLineFrom(rect);
|
|
132
|
-
var to = this.getPortLineTo(port.degree, rect);
|
|
132
|
+
var to = this.getPortLineTo(port.degree(), rect);
|
|
133
133
|
return {
|
|
134
134
|
from: {
|
|
135
135
|
x: from.x,
|
package/dist/js/Painter.js
CHANGED
|
@@ -67,8 +67,11 @@ var Painter = /*#__PURE__*/function () {
|
|
|
67
67
|
}, {
|
|
68
68
|
key: "draw",
|
|
69
69
|
value: function draw(entities, relationsihps) {
|
|
70
|
-
|
|
71
|
-
this.
|
|
70
|
+
// entity の描画
|
|
71
|
+
var groups = this.entity().draw(entities.list); // port の描画
|
|
72
|
+
|
|
73
|
+
this.ports().drawPorts(groups); // relationship の描画
|
|
74
|
+
|
|
72
75
|
this.relationships().drawRelationships(this.background, relationsihps);
|
|
73
76
|
}
|
|
74
77
|
}]);
|
|
@@ -47,7 +47,7 @@ var Entity = /*#__PURE__*/function () {
|
|
|
47
47
|
return this._parent._default;
|
|
48
48
|
}
|
|
49
49
|
/* **************************************************************** *
|
|
50
|
-
* Move
|
|
50
|
+
* Move
|
|
51
51
|
* TODO: これは Painter に持っていくべきかも。全部じゃないにしても。
|
|
52
52
|
* **************************************************************** */
|
|
53
53
|
|
|
@@ -306,11 +306,15 @@ var Entity = /*#__PURE__*/function () {
|
|
|
306
306
|
}, {
|
|
307
307
|
key: "drawIdentifiers",
|
|
308
308
|
value: function drawIdentifiers(groups) {
|
|
309
|
+
var callbacks = this.callbacks();
|
|
309
310
|
var rects = groups.append('rect').attr('class', 'entity-identifiers');
|
|
310
311
|
this.drawIdentifiersRect(rects);
|
|
311
312
|
var texts = groups.selectAll('text.identifier').data(function (d) {
|
|
312
313
|
return d.identifiers.contents.list;
|
|
313
|
-
}).enter().append('text').
|
|
314
|
+
}).enter().append('text').on("click", function (event, d) {
|
|
315
|
+
var func = callbacks.identifier.click;
|
|
316
|
+
if (func) func(d);
|
|
317
|
+
}).attr('class', 'identifier').attr('identifier-id', function (d) {
|
|
314
318
|
return d._id;
|
|
315
319
|
});
|
|
316
320
|
this.drawIdentifiersText(texts).each(function (identifier) {
|
|
@@ -355,11 +359,15 @@ var Entity = /*#__PURE__*/function () {
|
|
|
355
359
|
}, {
|
|
356
360
|
key: "drawAttributes",
|
|
357
361
|
value: function drawAttributes(groups) {
|
|
362
|
+
var callbacks = this.callbacks();
|
|
358
363
|
var rects = groups.append('rect').attr('class', 'entity-attributes');
|
|
359
364
|
this.drawAttributesRect(rects);
|
|
360
365
|
var texts = groups.selectAll('text.attribute').data(function (d) {
|
|
361
366
|
return d.attributes.contents.list;
|
|
362
|
-
}).enter().append('text').
|
|
367
|
+
}).enter().append('text').on("click", function (event, d) {
|
|
368
|
+
var func = callbacks.attribute.click;
|
|
369
|
+
if (func) func(d);
|
|
370
|
+
}).attr('class', 'attribute').attr('attribute-id', function (d) {
|
|
363
371
|
return d._id;
|
|
364
372
|
});
|
|
365
373
|
this.drawAttributesText(texts).each(function (attribute) {
|
|
@@ -0,0 +1,206 @@
|
|
|
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 PortCardinality = /*#__PURE__*/function () {
|
|
23
|
+
function PortCardinality() {
|
|
24
|
+
_classCallCheck(this, PortCardinality);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_createClass(PortCardinality, [{
|
|
28
|
+
key: "calLinePoints",
|
|
29
|
+
value: function calLinePoints(port) {
|
|
30
|
+
var table = port._column_instance._table;
|
|
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
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/* **************************************************************** *
|
|
77
|
+
* Draw Line (port to entity)
|
|
78
|
+
* **************************************************************** */
|
|
79
|
+
|
|
80
|
+
}, {
|
|
81
|
+
key: "drawLine",
|
|
82
|
+
value: function drawLine(g) {
|
|
83
|
+
var _this = this;
|
|
84
|
+
|
|
85
|
+
var lines = g.selectAll('line').data( // (d) => { return d._ports ? d._ports : []; },
|
|
86
|
+
function (d) {
|
|
87
|
+
return d._id;
|
|
88
|
+
}); // delete
|
|
89
|
+
|
|
90
|
+
lines.exit().remove(); // update
|
|
91
|
+
|
|
92
|
+
lines.each(function (d, i) {
|
|
93
|
+
var line = _this.calLinePoints(d);
|
|
94
|
+
|
|
95
|
+
d.position = line.to;
|
|
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");
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "drawCardinalityOne",
|
|
124
|
+
value: function drawCardinalityOne(g) {
|
|
125
|
+
var _this2 = this;
|
|
126
|
+
|
|
127
|
+
var filter = function filter() {
|
|
128
|
+
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
129
|
+
return ports.filter(function (d) {
|
|
130
|
+
return d.cardinality === 1;
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
var optionalities = g.selectAll('line.cardinality').data(function (d) {
|
|
135
|
+
return filter(d._ports);
|
|
136
|
+
}, function (d) {
|
|
137
|
+
return d._id;
|
|
138
|
+
});
|
|
139
|
+
optionalities.attr("x1", function (d) {
|
|
140
|
+
return d.line_cardinality.from.x;
|
|
141
|
+
}).attr("y1", function (d) {
|
|
142
|
+
return d.line_cardinality.from.y;
|
|
143
|
+
}).attr("x2", function (d) {
|
|
144
|
+
return d.line_cardinality.to.x;
|
|
145
|
+
}).attr("y2", function (d) {
|
|
146
|
+
return d.line_cardinality.to.y;
|
|
147
|
+
}).attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
148
|
+
optionalities.enter().each(function (d) {
|
|
149
|
+
return d.line_cardinality = _this2.calOneLine(d, 11);
|
|
150
|
+
}).append('line').classed("cardinality", true).attr("x1", function (d) {
|
|
151
|
+
return d.line_cardinality.from.x;
|
|
152
|
+
}).attr("y1", function (d) {
|
|
153
|
+
return d.line_cardinality.from.y;
|
|
154
|
+
}).attr("x2", function (d) {
|
|
155
|
+
return d.line_cardinality.to.x;
|
|
156
|
+
}).attr("y2", function (d) {
|
|
157
|
+
return d.line_cardinality.to.y;
|
|
158
|
+
}).attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "drawCardinalityThree",
|
|
162
|
+
value: function drawCardinalityThree(g) {
|
|
163
|
+
var _this3 = this;
|
|
164
|
+
|
|
165
|
+
var filter = function filter() {
|
|
166
|
+
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
167
|
+
return ports.filter(function (d) {
|
|
168
|
+
return d.cardinality === 3;
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
var optionalities = g.selectAll('path.cardinality').data(function (d) {
|
|
173
|
+
return filter(d._ports);
|
|
174
|
+
}, function (d) {
|
|
175
|
+
return d._id;
|
|
176
|
+
});
|
|
177
|
+
var line = d3.line().x(function (d) {
|
|
178
|
+
return d[0];
|
|
179
|
+
}).y(function (d) {
|
|
180
|
+
return d[1];
|
|
181
|
+
});
|
|
182
|
+
optionalities.each(function (d) {
|
|
183
|
+
return d.line_cardinality_three = _this3.calThreeLine(d, 11);
|
|
184
|
+
}).attr('d', function (d) {
|
|
185
|
+
return line(d.line_cardinality_three);
|
|
186
|
+
}).attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
187
|
+
optionalities.enter().each(function (d) {
|
|
188
|
+
return d.line_cardinality_three = _this3.calThreeLine(d, 11);
|
|
189
|
+
}).append('path').classed("cardinality", true).attr('d', function (d) {
|
|
190
|
+
return line(d.line_cardinality_three);
|
|
191
|
+
}).attr("fill", 'none').attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
192
|
+
}
|
|
193
|
+
}, {
|
|
194
|
+
key: "draw",
|
|
195
|
+
value: function draw(g) {
|
|
196
|
+
// E1のインスタンス1つに対応する、E2のインスタンスの最大数
|
|
197
|
+
// this.drawLine(g);
|
|
198
|
+
this.drawCardinalityOne(g);
|
|
199
|
+
this.drawCardinalityThree(g);
|
|
200
|
+
}
|
|
201
|
+
}]);
|
|
202
|
+
|
|
203
|
+
return PortCardinality;
|
|
204
|
+
}();
|
|
205
|
+
|
|
206
|
+
exports["default"] = PortCardinality;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 PortCircle = /*#__PURE__*/function () {
|
|
23
|
+
function PortCircle() {
|
|
24
|
+
_classCallCheck(this, PortCircle);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_createClass(PortCircle, [{
|
|
28
|
+
key: "drawPortsCore",
|
|
29
|
+
value: // protected
|
|
30
|
+
function drawPortsCore(ports) {
|
|
31
|
+
ports.attr('class', 'entity-port').attr('cx', function (d) {
|
|
32
|
+
return d.position.x;
|
|
33
|
+
}).attr('cy', function (d) {
|
|
34
|
+
return d.position.y;
|
|
35
|
+
}).attr('r', 4).attr('fill', '#fff').attr('stroke', '#000').attr('stroke-width', 0.5).attr('degree', function (d) {
|
|
36
|
+
return d._owner._core.position || 0;
|
|
37
|
+
}).attr('port-id', function (d) {
|
|
38
|
+
return d._id;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
key: "draw",
|
|
43
|
+
value: function draw(groups_entity) {
|
|
44
|
+
var ports = groups_entity.selectAll('circle.entity-port').data(function (d) {
|
|
45
|
+
return d.ports.items.list;
|
|
46
|
+
}).enter().append('circle');
|
|
47
|
+
this.drawPortsCore(ports);
|
|
48
|
+
}
|
|
49
|
+
}]);
|
|
50
|
+
|
|
51
|
+
return PortCircle;
|
|
52
|
+
}();
|
|
53
|
+
|
|
54
|
+
exports["default"] = PortCircle;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 PortOptionality = /*#__PURE__*/function () {
|
|
23
|
+
function PortOptionality() {
|
|
24
|
+
_classCallCheck(this, PortOptionality);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_createClass(PortOptionality, [{
|
|
28
|
+
key: "drawOptionalityOne",
|
|
29
|
+
value: function drawOptionalityOne(g) {
|
|
30
|
+
var _this = this;
|
|
31
|
+
|
|
32
|
+
var filter = function filter() {
|
|
33
|
+
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
34
|
+
return ports.filter(function (d) {
|
|
35
|
+
return d.optionality === 1;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var optionalities = g.selectAll('line.optionality').data(function (d) {
|
|
40
|
+
return filter(d._ports);
|
|
41
|
+
}, function (d) {
|
|
42
|
+
return d._id;
|
|
43
|
+
});
|
|
44
|
+
optionalities.enter().each(function (d) {
|
|
45
|
+
return d.line_optionality = _this.calOneLine(d, 22);
|
|
46
|
+
}).append('line').classed("optionality", true).attr("x1", function (d) {
|
|
47
|
+
return d.line_optionality.from.x;
|
|
48
|
+
}).attr("y1", function (d) {
|
|
49
|
+
return d.line_optionality.from.y;
|
|
50
|
+
}).attr("x2", function (d) {
|
|
51
|
+
return d.line_optionality.to.x;
|
|
52
|
+
}).attr("y2", function (d) {
|
|
53
|
+
return d.line_optionality.to.y;
|
|
54
|
+
}).attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "drawOptionalityZero",
|
|
58
|
+
value: function drawOptionalityZero(g) {
|
|
59
|
+
var _this2 = this;
|
|
60
|
+
|
|
61
|
+
var filter = function filter() {
|
|
62
|
+
var ports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
63
|
+
return ports.filter(function (d) {
|
|
64
|
+
return d.optionality === 0;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var optionalities = g.selectAll('circle.optionality').data(function (d) {
|
|
69
|
+
return filter(d._ports);
|
|
70
|
+
}, function (d) {
|
|
71
|
+
return d._id;
|
|
72
|
+
});
|
|
73
|
+
optionalities.each(function (d) {
|
|
74
|
+
return d.line_circle = _this2.calCircle(d);
|
|
75
|
+
}).attr("cx", function (d) {
|
|
76
|
+
return d.line_circle.x;
|
|
77
|
+
}).attr("cy", function (d) {
|
|
78
|
+
return d.line_circle.y;
|
|
79
|
+
}).attr("r", 5).attr("fill", "#fefefe").attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
80
|
+
optionalities.enter().each(function (d) {
|
|
81
|
+
return d.line_circle = _this2.calCircle(d);
|
|
82
|
+
}).append("circle").classed("optionality", true).attr("cx", function (d) {
|
|
83
|
+
return d.line_circle.x;
|
|
84
|
+
}).attr("cy", function (d) {
|
|
85
|
+
return d.line_circle.y;
|
|
86
|
+
}).attr("r", 5).attr("fill", "#fefefe").attr("stroke-width", 3).attr("stroke", "#a3a3a2");
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "draw",
|
|
90
|
+
value: function draw(g) {
|
|
91
|
+
// E1のインスタンス1つに対応する、E2のインスタンスの最小数
|
|
92
|
+
this.drawOptionalityOne(g);
|
|
93
|
+
this.drawOptionalityZero(g);
|
|
94
|
+
}
|
|
95
|
+
}]);
|
|
96
|
+
|
|
97
|
+
return PortOptionality;
|
|
98
|
+
}();
|
|
99
|
+
|
|
100
|
+
exports["default"] = PortOptionality;
|
|
@@ -9,6 +9,16 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var d3 = _interopRequireWildcard(require("d3"));
|
|
11
11
|
|
|
12
|
+
var _Geometry = _interopRequireDefault(require("../Geometry"));
|
|
13
|
+
|
|
14
|
+
var _PortCircle = _interopRequireDefault(require("./PortCircle.js"));
|
|
15
|
+
|
|
16
|
+
var _PortCardinality = _interopRequireDefault(require("./PortCardinality.js"));
|
|
17
|
+
|
|
18
|
+
var _PortOptionality = _interopRequireDefault(require("./PortOptionality.js"));
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
12
22
|
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
23
|
|
|
14
24
|
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; }
|
|
@@ -22,30 +32,32 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
22
32
|
var Ports = /*#__PURE__*/function () {
|
|
23
33
|
function Ports() {
|
|
24
34
|
_classCallCheck(this, Ports);
|
|
35
|
+
|
|
36
|
+
this.cardinality = new _PortCardinality["default"]();
|
|
37
|
+
this.optionality = new _PortOptionality["default"]();
|
|
38
|
+
this.circle = new _PortCircle["default"]();
|
|
25
39
|
}
|
|
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
|
+
|
|
26
54
|
|
|
27
55
|
_createClass(Ports, [{
|
|
28
|
-
key: "drawPortsCore",
|
|
29
|
-
value: // protected
|
|
30
|
-
function drawPortsCore(ports) {
|
|
31
|
-
ports.attr('class', 'entity-port').attr('cx', function (d) {
|
|
32
|
-
return d.position.x;
|
|
33
|
-
}).attr('cy', function (d) {
|
|
34
|
-
return d.position.y;
|
|
35
|
-
}).attr('r', 4).attr('fill', '#fff').attr('stroke', '#000').attr('stroke-width', 0.5).attr('degree', function (d) {
|
|
36
|
-
return d._owner._core.position || 0;
|
|
37
|
-
}).attr('port-id', function (d) {
|
|
38
|
-
return d._id;
|
|
39
|
-
});
|
|
40
|
-
} // public
|
|
41
|
-
|
|
42
|
-
}, {
|
|
43
56
|
key: "drawPorts",
|
|
44
|
-
value: function drawPorts(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.drawPortsCore(ports);
|
|
57
|
+
value: function drawPorts(groups_entity) {
|
|
58
|
+
// this.cardinality.draw(groups_entity);
|
|
59
|
+
// this.optionality.draw(groups_entity);
|
|
60
|
+
this.circle.draw(groups_entity);
|
|
49
61
|
}
|
|
50
62
|
}]);
|
|
51
63
|
|
package/dist/js/Port.js
CHANGED
|
@@ -60,12 +60,17 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
60
60
|
_this.geometry = new _Geometry["default"]();
|
|
61
61
|
return _this;
|
|
62
62
|
}
|
|
63
|
-
/* **************************************************************** *
|
|
64
|
-
* Data manegement
|
|
65
|
-
* **************************************************************** */
|
|
66
|
-
|
|
67
63
|
|
|
68
64
|
_createClass(Port, [{
|
|
65
|
+
key: "degree",
|
|
66
|
+
value: function degree() {
|
|
67
|
+
return this._core.position || 0;
|
|
68
|
+
}
|
|
69
|
+
/* **************************************************************** *
|
|
70
|
+
* Data manegement
|
|
71
|
+
* **************************************************************** */
|
|
72
|
+
|
|
73
|
+
}, {
|
|
69
74
|
key: "calLinePoints",
|
|
70
75
|
value: function calLinePoints(port) {
|
|
71
76
|
var table = port._column_instance._table;
|
|
@@ -262,7 +267,7 @@ var Port = /*#__PURE__*/function (_Atman) {
|
|
|
262
267
|
key: "addPort2Entity",
|
|
263
268
|
value:
|
|
264
269
|
/* **************************************************************** *
|
|
265
|
-
*
|
|
270
|
+
*
|
|
266
271
|
* **************************************************************** */
|
|
267
272
|
function addPort2Entity(entity) {
|
|
268
273
|
var port = this;
|