@yanqirenshi/d3.pad 0.3.1 → 0.4.1
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 +108 -12
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/dist/pad/Pad.d.ts +2 -3
- package/dist/pad/Pad.d.ts.map +1 -1
- package/dist/pad/Pad.js +23 -29
- package/dist/pad/PadDiagram.js +1 -1
- package/dist/pad/builtins.d.ts +2 -0
- package/dist/pad/builtins.d.ts.map +1 -0
- package/dist/pad/builtins.js +24 -0
- package/dist/pad/{datamodels → elements}/Assignment.d.ts +3 -1
- package/dist/pad/elements/Assignment.d.ts.map +1 -0
- package/dist/pad/{painters → elements}/Assignment.js +51 -5
- package/dist/pad/{datamodels → elements}/Call.d.ts +7 -1
- package/dist/pad/elements/Call.d.ts.map +1 -0
- package/dist/pad/{painters → elements}/Call.js +115 -18
- package/dist/pad/{datamodels → elements}/Group.d.ts +9 -2
- package/dist/pad/elements/Group.d.ts.map +1 -0
- package/dist/pad/elements/Group.js +113 -0
- package/dist/pad/{datamodels → elements}/Loop.d.ts +9 -2
- package/dist/pad/elements/Loop.d.ts.map +1 -0
- package/dist/pad/{painters → elements}/Loop.js +73 -54
- package/dist/pad/elements/PadContainerBase.d.ts +56 -0
- package/dist/pad/elements/PadContainerBase.d.ts.map +1 -0
- package/dist/pad/elements/PadContainerBase.js +110 -0
- package/dist/pad/elements/PadElementBase.d.ts +12 -0
- package/dist/pad/elements/PadElementBase.d.ts.map +1 -0
- package/dist/pad/elements/PadElementBase.js +11 -0
- package/dist/pad/{datamodels → elements}/Parallel.d.ts +4 -1
- package/dist/pad/elements/Parallel.d.ts.map +1 -0
- package/dist/pad/elements/Parallel.js +125 -0
- package/dist/pad/elements/Predefined.d.ts +51 -0
- package/dist/pad/elements/Predefined.d.ts.map +1 -0
- package/dist/pad/elements/Predefined.js +48 -0
- package/dist/pad/{datamodels → elements}/Process.d.ts +4 -1
- package/dist/pad/elements/Process.d.ts.map +1 -0
- package/dist/pad/{painters → elements}/Process.js +75 -7
- package/dist/pad/{datamodels → elements}/Selection.d.ts +9 -2
- package/dist/pad/elements/Selection.d.ts.map +1 -0
- package/dist/pad/{painters → elements}/Selection.js +73 -47
- package/dist/pad/{datamodels → elements}/Terminal.d.ts +3 -1
- package/dist/pad/elements/Terminal.d.ts.map +1 -0
- package/dist/pad/{datamodels → elements}/Terminal.js +19 -6
- package/dist/pad/parts/connector.d.ts +3 -0
- package/dist/pad/parts/connector.d.ts.map +1 -0
- package/dist/pad/parts/connector.js +17 -0
- package/dist/pad/parts/interactive.d.ts.map +1 -0
- package/dist/pad/{painters → parts}/interactive.js +2 -2
- package/dist/pad/parts/underline.d.ts +9 -0
- package/dist/pad/parts/underline.d.ts.map +1 -0
- package/dist/pad/parts/underline.js +30 -0
- package/dist/pad/registry.d.ts +7 -5
- package/dist/pad/registry.d.ts.map +1 -1
- package/dist/pad/registry.js +19 -8
- package/dist/pad/types.d.ts +3 -3
- package/package.json +3 -3
- package/src/index.ts +11 -8
- package/src/pad/Pad.ts +23 -29
- package/src/pad/PadDiagram.tsx +2 -2
- package/src/pad/builtins.ts +26 -0
- package/src/pad/{painters → elements}/Assignment.ts +56 -5
- package/src/pad/{painters → elements}/Call.ts +128 -17
- package/src/pad/elements/Group.ts +130 -0
- package/src/pad/{painters → elements}/Loop.ts +81 -62
- package/src/pad/elements/PadContainerBase.ts +145 -0
- package/src/pad/elements/PadElementBase.ts +22 -0
- package/src/pad/elements/Parallel.ts +140 -0
- package/src/pad/elements/Predefined.ts +55 -0
- package/src/pad/{painters → elements}/Process.ts +79 -7
- package/src/pad/{painters → elements}/Selection.ts +81 -54
- package/src/pad/{datamodels → elements}/Terminal.ts +24 -6
- package/src/pad/parts/connector.ts +19 -0
- package/src/pad/{painters → parts}/interactive.ts +2 -2
- package/src/pad/parts/underline.ts +33 -0
- package/src/pad/registry.ts +33 -14
- package/src/pad/types.ts +4 -4
- package/dist/pad/datamodels/Assignment.d.ts.map +0 -1
- package/dist/pad/datamodels/Assignment.js +0 -51
- package/dist/pad/datamodels/Call.d.ts.map +0 -1
- package/dist/pad/datamodels/Call.js +0 -83
- package/dist/pad/datamodels/Connector.d.ts +0 -35
- package/dist/pad/datamodels/Connector.d.ts.map +0 -1
- package/dist/pad/datamodels/Connector.js +0 -23
- package/dist/pad/datamodels/Group.d.ts.map +0 -1
- package/dist/pad/datamodels/Group.js +0 -71
- package/dist/pad/datamodels/Loop.d.ts.map +0 -1
- package/dist/pad/datamodels/Loop.js +0 -77
- package/dist/pad/datamodels/Parallel.d.ts.map +0 -1
- package/dist/pad/datamodels/Parallel.js +0 -80
- package/dist/pad/datamodels/Process.d.ts.map +0 -1
- package/dist/pad/datamodels/Process.js +0 -59
- package/dist/pad/datamodels/Selection.d.ts.map +0 -1
- package/dist/pad/datamodels/Selection.js +0 -81
- package/dist/pad/datamodels/Terminal.d.ts.map +0 -1
- package/dist/pad/elements.d.ts +0 -2
- package/dist/pad/elements.d.ts.map +0 -1
- package/dist/pad/elements.js +0 -32
- package/dist/pad/painters/Assignment.d.ts +0 -4
- package/dist/pad/painters/Assignment.d.ts.map +0 -1
- package/dist/pad/painters/Call.d.ts +0 -4
- package/dist/pad/painters/Call.d.ts.map +0 -1
- package/dist/pad/painters/Connector.d.ts +0 -4
- package/dist/pad/painters/Connector.d.ts.map +0 -1
- package/dist/pad/painters/Connector.js +0 -15
- package/dist/pad/painters/Group.d.ts +0 -4
- package/dist/pad/painters/Group.d.ts.map +0 -1
- package/dist/pad/painters/Group.js +0 -99
- package/dist/pad/painters/Loop.d.ts +0 -4
- package/dist/pad/painters/Loop.d.ts.map +0 -1
- package/dist/pad/painters/Parallel.d.ts +0 -4
- package/dist/pad/painters/Parallel.d.ts.map +0 -1
- package/dist/pad/painters/Parallel.js +0 -102
- package/dist/pad/painters/Process.d.ts +0 -5
- package/dist/pad/painters/Process.d.ts.map +0 -1
- package/dist/pad/painters/Selection.d.ts +0 -4
- package/dist/pad/painters/Selection.d.ts.map +0 -1
- package/dist/pad/painters/Terminal.d.ts +0 -4
- package/dist/pad/painters/Terminal.d.ts.map +0 -1
- package/dist/pad/painters/Terminal.js +0 -19
- package/dist/pad/painters/interactive.d.ts.map +0 -1
- package/src/pad/datamodels/Assignment.ts +0 -55
- package/src/pad/datamodels/Call.ts +0 -91
- package/src/pad/datamodels/Connector.ts +0 -25
- package/src/pad/datamodels/Group.ts +0 -76
- package/src/pad/datamodels/Loop.ts +0 -82
- package/src/pad/datamodels/Parallel.ts +0 -85
- package/src/pad/datamodels/Process.ts +0 -63
- package/src/pad/datamodels/Selection.ts +0 -87
- package/src/pad/elements.ts +0 -34
- package/src/pad/painters/Connector.ts +0 -15
- package/src/pad/painters/Group.ts +0 -116
- package/src/pad/painters/Parallel.ts +0 -115
- package/src/pad/painters/Terminal.ts +0 -23
- /package/dist/pad/{painters → parts}/interactive.d.ts +0 -0
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Assignment(代入文)のデータクラス。
|
|
2
|
-
// 代入先(targets)と値(value_text)を「代入先 ← 値」の形で可視化する要素。
|
|
3
|
-
// 値がSQLでもリテラルでも、同じ形で表す。
|
|
4
|
-
// 入力データの正規化のみを担当し、描画は painters/Assignment.ts が担当する
|
|
5
|
-
// (@yanqirenshi/d3.deployment の datamodels/painters 分離に倣う)。
|
|
6
|
-
import Theme from '../Theme.js';
|
|
7
|
-
|
|
8
|
-
const HEIGHT = 44;
|
|
9
|
-
const NOTCH_WIDTH = 12; // 代入先と値を区切る「<」の横幅(浅め)
|
|
10
|
-
|
|
11
|
-
export default class Assignment {
|
|
12
|
-
dataTemplate () {
|
|
13
|
-
return {
|
|
14
|
-
targets_text: '',
|
|
15
|
-
value_text: '',
|
|
16
|
-
description: null, // 説明。無ければnull
|
|
17
|
-
size: { w: 0, h: HEIGHT }, // 幅はテキスト実測後に painter が確定する
|
|
18
|
-
position: { x: 0, y: 0 },
|
|
19
|
-
font: { family: '"Courier New", monospace', size: 14, color: Theme.text },
|
|
20
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
21
|
-
notch: { width: NOTCH_WIDTH },
|
|
22
|
-
// trueのときConnector用のanchorをbox.x(PADの縦線位置)にする。
|
|
23
|
-
// 見た目(描画位置)は常にbox.xからの左詰め=変わらない。
|
|
24
|
-
anchor_at_spine: false,
|
|
25
|
-
// NOTE: 幅がテキスト実測依存のため、x座標は暫定値(yのみ確定)。
|
|
26
|
-
// painters/Assignment.ts が実測後に確定値へ更新する。
|
|
27
|
-
anchors: { top: { x: 0, y: 0 }, bottom: { x: 0, y: HEIGHT } },
|
|
28
|
-
_id: null,
|
|
29
|
-
_core: null,
|
|
30
|
-
_class: 'ASSIGNMENT',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// core: { id, targets: string[], value_text: string, description?: string }
|
|
35
|
-
// box: { x, y, width, center } 配置先の左上座標。widthはこの要素では
|
|
36
|
-
// 使わない(テキストにちょうど収まる幅で描画するため)。
|
|
37
|
-
normalize (core: any, box: any) {
|
|
38
|
-
if (!core) return null;
|
|
39
|
-
|
|
40
|
-
const data = this.dataTemplate();
|
|
41
|
-
data._core = core;
|
|
42
|
-
data._id = core.id;
|
|
43
|
-
data.targets_text = (core.targets || []).join(', ');
|
|
44
|
-
data.value_text = core.value_text || '';
|
|
45
|
-
data.description = core.description || null;
|
|
46
|
-
data.position = { x: box.x, y: box.y };
|
|
47
|
-
data.anchor_at_spine = !!box.center;
|
|
48
|
-
data.anchors = {
|
|
49
|
-
top: { x: box.x, y: box.y },
|
|
50
|
-
bottom: { x: box.x, y: box.y + HEIGHT },
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return data;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// CALL(呼び出し)のデータクラス。
|
|
2
|
-
// 箱の中身(cells・dividers・links)は PROCESS と同じ形で、箱自体の見た目も PROCESS と同じ
|
|
3
|
-
// (painters/Process.ts の drawCells をそのまま使う)。違うのは、呼び出し先(callee)を持てることだけ。
|
|
4
|
-
// callee は、呼び出し先のノードの配列(PROCESS などの入力の配列。Pad に渡すものと同じ)。
|
|
5
|
-
// 無ければ(または空なら)箱だけを描く。callee の中にさらに CALL があれば、同じ規則で入れ子に開く。
|
|
6
|
-
// 入れ子の CALL の開閉は、いちばん外の Pad から描き直す(painters/Call.ts が data.redraw を呼び出し先の Pad に渡す)。
|
|
7
|
-
// 入力データの正規化のみを担当し、描画は painters/Call.ts が担当する。
|
|
8
|
-
//
|
|
9
|
-
// 箱の中身の文言(たとえば 'execute' とファイル名)は、要素の中に固定しない。使う側が cells に入れる。
|
|
10
|
-
// (もとは d3.pad.dhn の EXECUTE が持っていた動きを、固有の言葉を抜いて汎用にしたもの。#290)
|
|
11
|
-
import Theme from '../Theme.js';
|
|
12
|
-
import { PAD } from '../registry.js';
|
|
13
|
-
|
|
14
|
-
const HEIGHT = 44;
|
|
15
|
-
const CHEVRON_DEPTH = 12;
|
|
16
|
-
const CALLEE_PAD_WIDTH = 750;
|
|
17
|
-
const CALLEE_PAD_GAP = 24;
|
|
18
|
-
|
|
19
|
-
/** 「開く」「閉じる」の文言の既定 */
|
|
20
|
-
export const DEFAULT_CALL_LABELS = { open: '開く', close: '閉じる' };
|
|
21
|
-
|
|
22
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
23
|
-
|
|
24
|
-
// 呼び出し先のノードの配列から、実際に描画・高さ計測に使う Pad インスタンスを組み立てる。
|
|
25
|
-
// datamodel 側の事前の高さ計算(後続要素と重ならないためのスペース確保)と、painter 側の実描画とで
|
|
26
|
-
// 同じジオメトリになるよう、生成方法をここに 1 箇所だけ持つ。
|
|
27
|
-
// Pad は Pad.ts を import せず、registry.ts の PAD から取り出す(Pad.ts が読み込まれたときに入れる)。
|
|
28
|
-
// Pad.ts ↔ このファイルの循環参照を避けるため。Pad.ts を読まずにここだけ読んでも、読み込みでは落ちない。
|
|
29
|
-
export function buildCalleePad (nodes: any[]) {
|
|
30
|
-
const PadClass = PAD.Pad;
|
|
31
|
-
if (!PadClass) throw new Error('Pad が登録されていません(Pad.ts を先に読み込むこと)');
|
|
32
|
-
return new PadClass({ width: CALLEE_PAD_WIDTH, gap: CALLEE_PAD_GAP, center: true }).data(nodes);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default class Call {
|
|
36
|
-
dataTemplate () {
|
|
37
|
-
return {
|
|
38
|
-
cells: [] as any[],
|
|
39
|
-
dividers: [] as any[],
|
|
40
|
-
links: [] as any[],
|
|
41
|
-
callee: null as any[] | null, // 呼び出し先のノードの配列(あれば、その箱の右に開く)
|
|
42
|
-
expanded: true, // false なら呼び出し先を畳んで隠す(painters/Call.ts の「開く/閉じる」)
|
|
43
|
-
labels: { ...DEFAULT_CALL_LABELS }, // 開閉の文言
|
|
44
|
-
font: { family: '"Courier New", monospace', size: 14, color: Theme.text },
|
|
45
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
46
|
-
chevron_depth: CHEVRON_DEPTH,
|
|
47
|
-
size: { w: 0, h: HEIGHT }, // 幅はテキスト実測後に painter が確定する
|
|
48
|
-
position: { x: 0, y: 0 },
|
|
49
|
-
// true のとき Connector 用の anchor を box.x(PAD の縦線位置)にする。
|
|
50
|
-
// 見た目(描画位置)は常に box.x からの左詰め=変わらない。
|
|
51
|
-
anchor_at_spine: false,
|
|
52
|
-
anchors: { top: { x: 0, y: 0 }, bottom: { x: 0, y: HEIGHT } },
|
|
53
|
-
_id: null as any,
|
|
54
|
-
_core: null as any,
|
|
55
|
-
_class: 'CALL',
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
normalize (core: any, box: any) {
|
|
60
|
-
if (!core) return null;
|
|
61
|
-
|
|
62
|
-
const data = this.dataTemplate();
|
|
63
|
-
data._core = core;
|
|
64
|
-
data._id = core.id;
|
|
65
|
-
data.cells = core.cells || [];
|
|
66
|
-
data.dividers = core.dividers || [];
|
|
67
|
-
data.links = core.links || [];
|
|
68
|
-
data.callee = core.callee || null;
|
|
69
|
-
data.expanded = core.expanded !== false;
|
|
70
|
-
data.labels = { ...DEFAULT_CALL_LABELS, ...(core.labels || {}) };
|
|
71
|
-
data.position = { x: box.x, y: box.y };
|
|
72
|
-
data.anchor_at_spine = !!box.center;
|
|
73
|
-
|
|
74
|
-
// 呼び出し先(あれば、かつ「開く」状態のときだけ)は自分の箱の上端に揃えて(下方向にだけ)
|
|
75
|
-
// 配置する(painters/Call.ts 参照)。上方向には広がらないため、前の行との間で重なることはない。
|
|
76
|
-
// その全高が自分の箱の高さより大きい分だけ、後続の要素と重ならないよう自分の高さ
|
|
77
|
-
// (anchors.bottom.y)を広げておく。「閉じる」状態では呼び出し先ぶんの高さを確保しない。
|
|
78
|
-
let height = HEIGHT;
|
|
79
|
-
if (data.expanded && data.callee && data.callee.length) {
|
|
80
|
-
const calleeHeight = buildCalleePad(data.callee).layout().height;
|
|
81
|
-
height = Math.max(HEIGHT, calleeHeight);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
data.anchors = {
|
|
85
|
-
top: { x: box.x, y: box.y },
|
|
86
|
-
bottom: { x: box.x, y: box.y + height },
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Connector(要素間をつなぐ縦線)のデータクラス。
|
|
2
|
-
// PADは要素を上から下へ積み重ねた「幹」の上に並べる構造のため、隣接する
|
|
3
|
-
// 要素同士は必ずこの線でつながる。Pad.ts が要素を並べる際に、直前の要素の
|
|
4
|
-
// anchors.bottom と直後の要素の anchors.top から自動的に生成する
|
|
5
|
-
// (データ側で個別に指定する要素ではない)。
|
|
6
|
-
import Theme from '../Theme.js';
|
|
7
|
-
|
|
8
|
-
export default class Connector {
|
|
9
|
-
dataTemplate () {
|
|
10
|
-
return {
|
|
11
|
-
from: { x: 0, y: 0 },
|
|
12
|
-
to: { x: 0, y: 0 },
|
|
13
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
14
|
-
_id: null,
|
|
15
|
-
_class: 'CONNECTOR',
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
normalize (from: any, to: any) {
|
|
20
|
-
const data = this.dataTemplate();
|
|
21
|
-
data.from = from;
|
|
22
|
-
data.to = to;
|
|
23
|
-
return data;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// GROUP(まとまり)のデータクラス。
|
|
2
|
-
// 「連続性のある処理のベース」+「複数処理の実行」の考え方に基づき、まとまりの名前
|
|
3
|
-
// (label、例:'SET'。省略すると空)を左側に表示し、右側に本体(rows、まとまりに
|
|
4
|
-
// 含める要素を1行ずつ積み重ねる)を並べる。LOOPと同じくPad本体のレジストリ
|
|
5
|
-
// (registry.ts)で対応するデータクラスに振り分ける(_class省略時はPROCESS扱い)。
|
|
6
|
-
// 入力データの正規化のみを担当し、描画は painters/Group.ts が担当する
|
|
7
|
-
// (@yanqirenshi/d3.deployment の datamodels/painters 分離に倣う)。
|
|
8
|
-
import Theme from '../Theme.js';
|
|
9
|
-
import { ELEMENTS } from '../registry.js';
|
|
10
|
-
|
|
11
|
-
const ROW_GAP = 11;
|
|
12
|
-
const LABEL_HEIGHT = 44; // 名前の箱の高さ(painters/Group.ts の LABEL_HEIGHT と同じ)
|
|
13
|
-
|
|
14
|
-
export default class Group {
|
|
15
|
-
dataTemplate () {
|
|
16
|
-
return {
|
|
17
|
-
label: '', // まとまりの名前(例:'SET'。左側のボックスに表示する)
|
|
18
|
-
rows: [], // { _class?: string, ... }[](_class省略時はPROCESS扱い)
|
|
19
|
-
font: { family: '"Courier New", monospace', size: 14, color: Theme.text },
|
|
20
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
21
|
-
row_gap: ROW_GAP,
|
|
22
|
-
chevron_depth: 12,
|
|
23
|
-
size: { w: 0, h: 0 }, // 幅・高さともに描画時(実測後)に確定する
|
|
24
|
-
position: { x: 0, y: 0 },
|
|
25
|
-
// trueのときConnector用のanchorをbox.x(PADの縦線位置)にする。
|
|
26
|
-
// 見た目(描画位置)は常にbox.xからの左詰め=変わらない。
|
|
27
|
-
anchor_at_spine: false,
|
|
28
|
-
// NOTE: 幅がテキスト実測依存のため、x座標は暫定値(yのみ確定)。
|
|
29
|
-
// painters/Group.ts が実測後に確定値へ更新する。
|
|
30
|
-
anchors: { top: { x: 0, y: 0 }, bottom: { x: 0, y: 0 } },
|
|
31
|
-
_id: null,
|
|
32
|
-
_core: null,
|
|
33
|
-
_class: 'GROUP',
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// 各行のデータクラスにnormalizeさせて高さだけを求める(LOOPと同じ
|
|
38
|
-
// 考え方。高さは常にデータから確定できるためDOM計測を伴わない)。
|
|
39
|
-
// 数えるのは、実際に描く行だけ(知らない _class の行は、painter が飛ばす)。行が無くても、条件・ラベルの箱
|
|
40
|
-
// (LABEL_HEIGHT)は描かれるので、それを最低の高さとする(painter の totalHeight と同じ式にそろえる。#307)。
|
|
41
|
-
measureRowsHeight (rows: any, rowGap: any) {
|
|
42
|
-
let y = 0;
|
|
43
|
-
let drawn = 0;
|
|
44
|
-
for (const row of rows) {
|
|
45
|
-
const rowClass = row._class || 'PROCESS';
|
|
46
|
-
const entry = ELEMENTS[rowClass];
|
|
47
|
-
if (!entry) continue;
|
|
48
|
-
const model = new entry.datamodel();
|
|
49
|
-
const rowData = model.normalize(row, { x: 0, y, width: 0, center: false });
|
|
50
|
-
y = rowData.anchors.bottom.y + rowGap;
|
|
51
|
-
drawn++;
|
|
52
|
-
}
|
|
53
|
-
return Math.max(LABEL_HEIGHT, drawn ? y - rowGap : 0);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// core: { id, label?: string, rows: ({_class?, ...})[] }
|
|
57
|
-
normalize (core: any, box: any) {
|
|
58
|
-
if (!core) return null;
|
|
59
|
-
|
|
60
|
-
const data = this.dataTemplate();
|
|
61
|
-
data._core = core;
|
|
62
|
-
data._id = core.id;
|
|
63
|
-
data.label = core.label || '';
|
|
64
|
-
data.rows = core.rows || [];
|
|
65
|
-
data.position = { x: box.x, y: box.y };
|
|
66
|
-
data.anchor_at_spine = !!box.center;
|
|
67
|
-
|
|
68
|
-
const height = this.measureRowsHeight(data.rows, data.row_gap);
|
|
69
|
-
data.anchors = {
|
|
70
|
-
top: { x: box.x, y: box.y },
|
|
71
|
-
bottom: { x: box.x, y: box.y + height },
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return data;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// LOOP(反復)のデータクラス。
|
|
2
|
-
// 元のPAD(Problem Analysis Diagram)が持つ「反復」記号に相当する
|
|
3
|
-
// (PARALLEL等とは異なり、拡張ではなく本来のPAD要素)。
|
|
4
|
-
// 反復の条件(condition、例:'@CALENDAR' や 'i < 10')を左側に固定表示し、右側に
|
|
5
|
-
// 本体(rows)を積み重ねる。test: 'pre'(前判定。既定)は条件の箱の左に二重線、
|
|
6
|
-
// test: 'post'(後判定)は右に二重線を描く。各行は { _class, ...そのクラスの入力形式 } を
|
|
7
|
-
// 持ち、Pad本体と同じレジストリ(registry.ts)で対応するデータクラスに
|
|
8
|
-
// 振り分ける(_class省略時はPROCESS扱い)。これにより、本体の1行として
|
|
9
|
-
// PARALLEL等を入れ子にできる。
|
|
10
|
-
// 入力データの正規化のみを担当し、描画は painters/Loop.ts が担当する
|
|
11
|
-
import Theme from '../Theme.js';
|
|
12
|
-
import { ELEMENTS } from '../registry.js';
|
|
13
|
-
|
|
14
|
-
const ROW_GAP = 11;
|
|
15
|
-
const LABEL_HEIGHT = 44; // 条件の箱の高さ(painters/Loop.ts の LABEL_HEIGHT と同じ)
|
|
16
|
-
|
|
17
|
-
export default class Loop {
|
|
18
|
-
dataTemplate () {
|
|
19
|
-
return {
|
|
20
|
-
condition: '', // 反復の条件(例:'@CALENDAR')
|
|
21
|
-
test: 'pre' as 'pre' | 'post', // 前判定(二重線が左)か後判定(二重線が右)か
|
|
22
|
-
rows: [], // { _class?: string, ... }[](_class省略時はPROCESS扱い)
|
|
23
|
-
font: { family: '"Courier New", monospace', size: 14, color: Theme.text },
|
|
24
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
25
|
-
row_gap: ROW_GAP,
|
|
26
|
-
chevron_depth: 12,
|
|
27
|
-
size: { w: 0, h: 0 }, // 幅・高さともに描画時(実測後)に確定する
|
|
28
|
-
position: { x: 0, y: 0 },
|
|
29
|
-
// trueのときConnector用のanchorをbox.x(PADの縦線位置)にする。
|
|
30
|
-
// 見た目(描画位置)は常にbox.xからの左詰め=変わらない。
|
|
31
|
-
anchor_at_spine: false,
|
|
32
|
-
// NOTE: 幅がテキスト実測依存のため、x座標は暫定値(yのみ確定)。
|
|
33
|
-
// painters/Loop.ts が実測後に確定値へ更新する。
|
|
34
|
-
anchors: { top: { x: 0, y: 0 }, bottom: { x: 0, y: 0 } },
|
|
35
|
-
_id: null,
|
|
36
|
-
_core: null,
|
|
37
|
-
_class: 'LOOP',
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 各行のデータクラスにnormalizeさせて高さだけを求める。PROCESS/PARALLEL
|
|
42
|
-
// 等どの要素も高さは常にデータ(引数の個数・PARALLELならtasksの数)から
|
|
43
|
-
// 確定できるため、ここではDOM計測を伴わない(幅の実測は描画時のみ必要)。
|
|
44
|
-
// 数えるのは、実際に描く行だけ(知らない _class の行は、painter が飛ばす)。行が無くても、条件・ラベルの箱
|
|
45
|
-
// (LABEL_HEIGHT)は描かれるので、それを最低の高さとする(painter の totalHeight と同じ式にそろえる。#307)。
|
|
46
|
-
measureRowsHeight (rows: any, rowGap: any) {
|
|
47
|
-
let y = 0;
|
|
48
|
-
let drawn = 0;
|
|
49
|
-
for (const row of rows) {
|
|
50
|
-
const rowClass = row._class || 'PROCESS';
|
|
51
|
-
const entry = ELEMENTS[rowClass];
|
|
52
|
-
if (!entry) continue;
|
|
53
|
-
const model = new entry.datamodel();
|
|
54
|
-
const rowData = model.normalize(row, { x: 0, y, width: 0, center: false });
|
|
55
|
-
y = rowData.anchors.bottom.y + rowGap;
|
|
56
|
-
drawn++;
|
|
57
|
-
}
|
|
58
|
-
return Math.max(LABEL_HEIGHT, drawn ? y - rowGap : 0);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// core: { id, condition: string, test?: 'pre' | 'post', rows: ({_class?, ...})[] }
|
|
62
|
-
normalize (core: any, box: any) {
|
|
63
|
-
if (!core) return null;
|
|
64
|
-
|
|
65
|
-
const data = this.dataTemplate();
|
|
66
|
-
data._core = core;
|
|
67
|
-
data._id = core.id;
|
|
68
|
-
data.condition = core.condition || '';
|
|
69
|
-
data.test = core.test === 'post' ? 'post' : 'pre';
|
|
70
|
-
data.rows = core.rows || [];
|
|
71
|
-
data.position = { x: box.x, y: box.y };
|
|
72
|
-
data.anchor_at_spine = !!box.center;
|
|
73
|
-
|
|
74
|
-
const height = this.measureRowsHeight(data.rows, data.row_gap);
|
|
75
|
-
data.anchors = {
|
|
76
|
-
top: { x: box.x, y: box.y },
|
|
77
|
-
bottom: { x: box.x, y: box.y + height },
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return data;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
// Parallel(PARALLEL { TASK{...} TASK{...} })のデータクラス。
|
|
2
|
-
// 元のPAD(Problem Analysis Diagram)には無い記号だが、複数の処理が並行して
|
|
3
|
-
// 走ることを図示するためにこのプロジェクト独自に追加する。
|
|
4
|
-
// 各TASKは、従来通りPROCESS要素そのもの({cells, dividers})1行として
|
|
5
|
-
// 描画するか、あるいは複数の文が連続するTASK(例: 同じ処理を続けて2回
|
|
6
|
-
// 呼ぶ等)を表すために{rows: [...]}として複数行を持てる
|
|
7
|
-
// (rowsはLOOP/SELECTIONの本体と同じくregistry.ts経由で_classごとに描画する。
|
|
8
|
-
// _class省略時はPROCESS扱い)。
|
|
9
|
-
// 入力データの正規化のみを担当し、描画は painters/Parallel.ts が担当する
|
|
10
|
-
// (@yanqirenshi/d3.deployment の datamodels/painters 分離に倣う)。
|
|
11
|
-
import Theme from '../Theme.js';
|
|
12
|
-
import { ELEMENTS } from '../registry.js';
|
|
13
|
-
|
|
14
|
-
const ROW_HEIGHT = 44;
|
|
15
|
-
const ROW_GAP = 11; // TASK同士(要素間)・TASK内の行同士の余白
|
|
16
|
-
const BRACKET_WIDTH = 12; // 左のブラケット(矩形)の幅
|
|
17
|
-
const BRACKET_MARGIN = 0; // ブラケットと本体(行)の間隔
|
|
18
|
-
|
|
19
|
-
// 1つのTASKの高さを求める。{rows: [...]}を持つTASKは本体(LOOP/SELECTIONの
|
|
20
|
-
// bodyと同じ考え方)としてregistry.ts経由で各行の高さを積み上げる。
|
|
21
|
-
// 持たないTASK(従来通りの{cells, dividers})は固定のROW_HEIGHTとする。
|
|
22
|
-
// {rows: [...]}を持っても、描ける行が無い(空・知らない_classだけ)TASKは、painters/Parallel.tsと同じく
|
|
23
|
-
// ROW_HEIGHTとする(数えるのは、実際に描く行だけ。#307)。
|
|
24
|
-
function taskHeight (task: any, rowGap: any) {
|
|
25
|
-
if (!task.rows) return ROW_HEIGHT;
|
|
26
|
-
|
|
27
|
-
let y = 0;
|
|
28
|
-
let drawn = 0;
|
|
29
|
-
for (const row of task.rows) {
|
|
30
|
-
const rowClass = row._class || 'PROCESS';
|
|
31
|
-
const entry = ELEMENTS[rowClass];
|
|
32
|
-
if (!entry) continue;
|
|
33
|
-
const model = new entry.datamodel();
|
|
34
|
-
const rowData = model.normalize(row, { x: 0, y, width: 0, center: false });
|
|
35
|
-
y = rowData.anchors.bottom.y + rowGap;
|
|
36
|
-
drawn++;
|
|
37
|
-
}
|
|
38
|
-
return drawn ? y - rowGap : ROW_HEIGHT;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default class Parallel {
|
|
42
|
-
dataTemplate () {
|
|
43
|
-
return {
|
|
44
|
-
// tasks: ({ cells: string[], dividers: (...)[] } | { rows: ({_class?, ...})[] })[]
|
|
45
|
-
tasks: [],
|
|
46
|
-
font: { family: '"Courier New", monospace', size: 14, color: Theme.text },
|
|
47
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
48
|
-
row_height: ROW_HEIGHT,
|
|
49
|
-
row_gap: ROW_GAP,
|
|
50
|
-
bracket: { width: BRACKET_WIDTH, margin: BRACKET_MARGIN },
|
|
51
|
-
chevron_depth: 12,
|
|
52
|
-
size: { w: 0, h: 0 }, // 幅・高さともに描画時(実測後)に確定する
|
|
53
|
-
position: { x: 0, y: 0 },
|
|
54
|
-
// trueのときConnector用のanchorをbox.x(PADの縦線位置)にする。
|
|
55
|
-
// 見た目(描画位置)は常にbox.xからの左詰め=変わらない。
|
|
56
|
-
anchor_at_spine: false,
|
|
57
|
-
// NOTE: 幅がテキスト実測依存のため、x座標は暫定値(yのみ確定)。
|
|
58
|
-
// painters/Parallel.ts が実測後に確定値へ更新する。
|
|
59
|
-
anchors: { top: { x: 0, y: 0 }, bottom: { x: 0, y: 0 } },
|
|
60
|
-
_id: null,
|
|
61
|
-
_core: null,
|
|
62
|
-
_class: 'PARALLEL',
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
normalize (core: any, box: any) {
|
|
67
|
-
if (!core) return null;
|
|
68
|
-
|
|
69
|
-
const data = this.dataTemplate();
|
|
70
|
-
data._core = core;
|
|
71
|
-
data._id = core.id;
|
|
72
|
-
data.tasks = core.tasks || [];
|
|
73
|
-
data.position = { x: box.x, y: box.y };
|
|
74
|
-
data.anchor_at_spine = !!box.center;
|
|
75
|
-
|
|
76
|
-
const n = data.tasks.length;
|
|
77
|
-
const h = data.tasks.reduce((sum, task)=> sum + taskHeight(task, ROW_GAP) + ROW_GAP, 0) - (n ? ROW_GAP : 0);
|
|
78
|
-
data.anchors = {
|
|
79
|
-
top: { x: box.x, y: box.y },
|
|
80
|
-
bottom: { x: box.x, y: box.y + h },
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return data;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// PROCESS(処理)のデータクラス。
|
|
2
|
-
// 1つの処理を、四角い箱の中の「ラベル+引数」の並び(cells)として表す。
|
|
3
|
-
// セルの区切り(dividers)は点線・実線・山形、セルごとにリンク(links)も付けられる。
|
|
4
|
-
// 何をセルに入れるかは、使う側が決める(要素は文言を固定しない)。
|
|
5
|
-
// 入力データの正規化のみを担当し、描画は painters/Process.ts が担当する
|
|
6
|
-
// (@yanqirenshi/d3.deployment の datamodels/painters 分離に倣う)。
|
|
7
|
-
import Theme from '../Theme.js';
|
|
8
|
-
|
|
9
|
-
const HEIGHT = 44;
|
|
10
|
-
const CHEVRON_DEPTH = 12;
|
|
11
|
-
|
|
12
|
-
export default class Process {
|
|
13
|
-
dataTemplate () {
|
|
14
|
-
return {
|
|
15
|
-
// cells: string[](先頭はラベル。以降は表示する引数)
|
|
16
|
-
// dividers: ('dotted'|'solid'|{type:'chevron', direction:'left'|'right'})[]
|
|
17
|
-
// 要素数は cells.length - 1。dotted=ラベルと最初の引数の区切り、
|
|
18
|
-
// solid=引数同士の区切り、chevron=前の値が次の値へ流れ込む
|
|
19
|
-
// (Assignmentの「<」と同じ役割)ことを表す。
|
|
20
|
-
cells: [],
|
|
21
|
-
dividers: [],
|
|
22
|
-
// cellsと同じ長さの配列(省略可)。リンクさせたいセルの位置に
|
|
23
|
-
// URL文字列、それ以外はnullを入れる(例: dwmem_load/dwtab_rebuild
|
|
24
|
-
// が対象とするテーブル名セルをWBSページへのリンクにする)。
|
|
25
|
-
links: [],
|
|
26
|
-
description: null, // 箱の右に添える説明。無ければnull
|
|
27
|
-
font: { family: '"Courier New", monospace', size: 14, color: Theme.text },
|
|
28
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
29
|
-
chevron_depth: CHEVRON_DEPTH,
|
|
30
|
-
size: { w: 0, h: HEIGHT }, // 幅はテキスト実測後に painter が確定する
|
|
31
|
-
position: { x: 0, y: 0 },
|
|
32
|
-
// trueのときConnector用のanchorをbox.x(PADの縦線位置)にする。
|
|
33
|
-
// 見た目(描画位置)は常にbox.xからの左詰め=変わらない。
|
|
34
|
-
anchor_at_spine: false,
|
|
35
|
-
// NOTE: 幅がテキスト実測依存のため、x座標は暫定値(yのみ確定)。
|
|
36
|
-
// painters/Process.ts が実測後に確定値へ更新する。
|
|
37
|
-
anchors: { top: { x: 0, y: 0 }, bottom: { x: 0, y: HEIGHT } },
|
|
38
|
-
_id: null,
|
|
39
|
-
_core: null,
|
|
40
|
-
_class: 'PROCESS',
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
normalize (core: any, box: any) {
|
|
45
|
-
if (!core) return null;
|
|
46
|
-
|
|
47
|
-
const data = this.dataTemplate();
|
|
48
|
-
data._core = core;
|
|
49
|
-
data._id = core.id;
|
|
50
|
-
data.cells = core.cells || [];
|
|
51
|
-
data.dividers = core.dividers || [];
|
|
52
|
-
data.links = core.links || [];
|
|
53
|
-
data.description = core.description || null;
|
|
54
|
-
data.position = { x: box.x, y: box.y };
|
|
55
|
-
data.anchor_at_spine = !!box.center;
|
|
56
|
-
data.anchors = {
|
|
57
|
-
top: { x: box.x, y: box.y },
|
|
58
|
-
bottom: { x: box.x, y: box.y + HEIGHT },
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// SELECTION(選択)のデータクラス。
|
|
2
|
-
// 元のPAD(Problem Analysis Diagram)が持つ「選択」記号に相当する
|
|
3
|
-
// (PARALLEL等とは異なり、拡張ではなく本来のPAD要素)。
|
|
4
|
-
// SELECTION { WHEN(条件){本体} WHEN(条件){本体} ... ELSE{本体} } のように、条件
|
|
5
|
-
// (WHEN)を複数持てる形で表す(構文上は複数許容される可能性があるため)。
|
|
6
|
-
// 末尾にELSE(どのWHENにも合致しない場合の処理)を1つ持てる。whens配列内で
|
|
7
|
-
// { else: true, body } と表す(条件式のかわりに固定ラベル「ELSE」を表示する
|
|
8
|
-
// だけで、構造上はWHENと同じ1行として扱う)。
|
|
9
|
-
// 各行の本体(body)は { _class?: string, ... }[] を持ち、Pad本体と同じ
|
|
10
|
-
// レジストリ(registry.ts)で対応するデータクラスに振り分ける(LOOPの
|
|
11
|
-
// rowsと同じ考え方。_class省略時はPROCESS扱い)。
|
|
12
|
-
// 入力データの正規化のみを担当し、描画は painters/Selection.ts が担当する
|
|
13
|
-
// (@yanqirenshi/d3.deployment の datamodels/painters 分離に倣う)。
|
|
14
|
-
import Theme from '../Theme.js';
|
|
15
|
-
import { ELEMENTS } from '../registry.js';
|
|
16
|
-
|
|
17
|
-
const CONDITION_HEIGHT = 44;
|
|
18
|
-
const ROW_GAP = 11;
|
|
19
|
-
// ブラケットが条件ボックスの上下にはみ出す量(painters/Selection.ts の BRACKET_MARGIN と同じ値)。
|
|
20
|
-
// はみ出しを自分の高さに含めるので、上下に BRACKET_MARGIN ずつの余白を持つ(#309)。
|
|
21
|
-
const BRACKET_MARGIN = 8;
|
|
22
|
-
|
|
23
|
-
export default class Selection {
|
|
24
|
-
dataTemplate () {
|
|
25
|
-
return {
|
|
26
|
-
whens: [], // ({ condition: string } | { else: true })[] & { body: ({_class?, ...})[] }[]
|
|
27
|
-
font: { family: '"Courier New", monospace', size: 14, color: Theme.text },
|
|
28
|
-
stroke: { color: Theme.stroke, width: 1 },
|
|
29
|
-
row_gap: ROW_GAP,
|
|
30
|
-
chevron_depth: 12,
|
|
31
|
-
size: { w: 0, h: 0 }, // 幅・高さともに描画時(実測後)に確定する
|
|
32
|
-
position: { x: 0, y: 0 },
|
|
33
|
-
// trueのときConnector用のanchorをbox.x(PADの縦線位置)にする。
|
|
34
|
-
// 見た目(描画位置)は常にbox.xからの左詰め=変わらない。
|
|
35
|
-
anchor_at_spine: false,
|
|
36
|
-
// NOTE: 幅がテキスト実測依存のため、x座標は暫定値(yのみ確定)。
|
|
37
|
-
// painters/Selection.ts が実測後に確定値へ更新する。
|
|
38
|
-
anchors: { top: { x: 0, y: 0 }, bottom: { x: 0, y: 0 } },
|
|
39
|
-
_id: null,
|
|
40
|
-
_core: null,
|
|
41
|
-
_class: 'SELECTION',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// 本体(body)のデータクラスにnormalizeさせて高さだけを求める。PROCESS/
|
|
46
|
-
// PARALLEL等どの要素も高さは常にデータから確定できるため、ここでは
|
|
47
|
-
// DOM計測を伴わない(幅の実測は描画時のみ必要)。
|
|
48
|
-
measureBodyHeight (body: any, rowGap: any) {
|
|
49
|
-
let y = 0;
|
|
50
|
-
for (const row of body) {
|
|
51
|
-
const rowClass = row._class || 'PROCESS';
|
|
52
|
-
const entry = ELEMENTS[rowClass];
|
|
53
|
-
if (!entry) continue;
|
|
54
|
-
const model = new entry.datamodel();
|
|
55
|
-
const rowData = model.normalize(row, { x: 0, y, width: 0, center: false });
|
|
56
|
-
y = rowData.anchors.bottom.y + rowGap;
|
|
57
|
-
}
|
|
58
|
-
return body.length ? y - rowGap : 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// core: { id, whens: { condition: string, body: ({_class?, ...})[] }[] }
|
|
62
|
-
normalize (core: any, box: any) {
|
|
63
|
-
if (!core) return null;
|
|
64
|
-
|
|
65
|
-
const data = this.dataTemplate();
|
|
66
|
-
data._core = core;
|
|
67
|
-
data._id = core.id;
|
|
68
|
-
data.whens = core.whens || [];
|
|
69
|
-
data.position = { x: box.x, y: box.y };
|
|
70
|
-
data.anchor_at_spine = !!box.center;
|
|
71
|
-
|
|
72
|
-
let y = BRACKET_MARGIN;
|
|
73
|
-
for (const when of data.whens) {
|
|
74
|
-
const bodyHeight = this.measureBodyHeight((when as any).body || [], data.row_gap);
|
|
75
|
-
const rowHeight = Math.max(CONDITION_HEIGHT, bodyHeight);
|
|
76
|
-
y += rowHeight + data.row_gap;
|
|
77
|
-
}
|
|
78
|
-
const totalHeight = data.whens.length ? y - data.row_gap + BRACKET_MARGIN : 0;
|
|
79
|
-
|
|
80
|
-
data.anchors = {
|
|
81
|
-
top: { x: box.x, y: box.y },
|
|
82
|
-
bottom: { x: box.x, y: box.y + totalHeight },
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
|
-
}
|
package/src/pad/elements.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// d3.pad が最初から持つ 9 つの要素を、レジストリ(registry.ts)に登録する。
|
|
2
|
-
// import されるだけで登録される(Pad.ts が import する)。
|
|
3
|
-
// 要素は registry.ts だけを import し、このファイルも Pad.ts も import しないので、循環参照にならない。
|
|
4
|
-
// (CALL は呼び出し先を別の Pad で描くが、Pad は registry.ts の PAD から取り出す。datamodels/Call.ts の buildCalleePad 参照)
|
|
5
|
-
import { registerElement } from './registry.js';
|
|
6
|
-
|
|
7
|
-
import Terminal from './datamodels/Terminal.js';
|
|
8
|
-
import TerminalPainter from './painters/Terminal.js';
|
|
9
|
-
import Assignment from './datamodels/Assignment.js';
|
|
10
|
-
import AssignmentPainter from './painters/Assignment.js';
|
|
11
|
-
import Process from './datamodels/Process.js';
|
|
12
|
-
import ProcessPainter from './painters/Process.js';
|
|
13
|
-
import Call from './datamodels/Call.js';
|
|
14
|
-
import CallPainter from './painters/Call.js';
|
|
15
|
-
import Parallel from './datamodels/Parallel.js';
|
|
16
|
-
import ParallelPainter from './painters/Parallel.js';
|
|
17
|
-
import Loop from './datamodels/Loop.js';
|
|
18
|
-
import LoopPainter from './painters/Loop.js';
|
|
19
|
-
import Selection from './datamodels/Selection.js';
|
|
20
|
-
import SelectionPainter from './painters/Selection.js';
|
|
21
|
-
import Group from './datamodels/Group.js';
|
|
22
|
-
import GroupPainter from './painters/Group.js';
|
|
23
|
-
import Connector from './datamodels/Connector.js';
|
|
24
|
-
import ConnectorPainter from './painters/Connector.js';
|
|
25
|
-
|
|
26
|
-
registerElement('TERMINAL', { datamodel: Terminal, painter: TerminalPainter });
|
|
27
|
-
registerElement('ASSIGNMENT', { datamodel: Assignment, painter: AssignmentPainter });
|
|
28
|
-
registerElement('PROCESS', { datamodel: Process, painter: ProcessPainter });
|
|
29
|
-
registerElement('CALL', { datamodel: Call, painter: CallPainter });
|
|
30
|
-
registerElement('PARALLEL', { datamodel: Parallel, painter: ParallelPainter });
|
|
31
|
-
registerElement('LOOP', { datamodel: Loop, painter: LoopPainter });
|
|
32
|
-
registerElement('SELECTION', { datamodel: Selection, painter: SelectionPainter });
|
|
33
|
-
registerElement('GROUP', { datamodel: Group, painter: GroupPainter });
|
|
34
|
-
registerElement('CONNECTOR', { datamodel: Connector, painter: ConnectorPainter });
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Connector(要素間をつなぐ縦線)の描画クラス。
|
|
2
|
-
// 正規化済みデータ(datamodels/Connector.ts の出力)を、d3 のセレクション
|
|
3
|
-
// (place) に対して描画する。
|
|
4
|
-
export default class Connector {
|
|
5
|
-
draw (place: any, data: any) {
|
|
6
|
-
return place.append('line')
|
|
7
|
-
.attr('class', 'pad-connector')
|
|
8
|
-
.attr('x1', data.from.x)
|
|
9
|
-
.attr('y1', data.from.y)
|
|
10
|
-
.attr('x2', data.to.x)
|
|
11
|
-
.attr('y2', data.to.y)
|
|
12
|
-
.attr('stroke', data.stroke.color)
|
|
13
|
-
.attr('stroke-width', data.stroke.width);
|
|
14
|
-
}
|
|
15
|
-
}
|