-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeaturetree.tex
120 lines (118 loc) · 4.62 KB
/
featuretree.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
\usetikzlibrary{angles,shadows.blur,positioning,backgrounds}
\usepackage{forest}
\forestset{
declare boolean register=legend,
legend=true,
declare count register=disjuncts from,
disjuncts from'=0,
declare count register=concrete from,
concrete from'=2,
concrete colour/.code={\colorlet{concretecol}{#1}},
abstract colour/.code={\colorlet{abstractcol}{#1}},
draw colour/.code={\colorlet{drawcol}{#1}},
concrete colour=gray,
abstract colour=white,
draw colour=black,
/tikz/mandatory/.style={circle, fill=drawcol, draw=drawcol},
/tikz/optional/.style={circle, draw=drawcol, fill=white},
/tikz/concrete/.style={fill=concretecol, draw=drawcol, align=center},
/tikz/abstract/.style={fill=abstractcol, draw=drawcol, align=center},
/tikz/or/.style={},
/tikz/xor/.style={},
mandatory/.style={edge label={node [mandatory] {}}},
optional/.style={edge label={node [optional] {}}},
multi/.style={text height=#1*4.5ex, text depth=.5ex},
multi/.default=1,
%% relation/.style={
%% %if={#1==xor}{
%% #1
%% %}{
%% % for first={
%% % tikz+={
%% % \path (.parent) coordinate (A) -- (!u.children) coordinate (B) -- (!ul.parent) coordinate (C) pic [angle radius=20pt,fill=drawcol] {angle};
%% % }
%% % }
%% %}
%% },
%relation/.default=or,
or/.style={
for first={
tikz+={
\path (.parent) coordinate (A) -- (!u.children) coordinate (B) -- (!ul.parent) coordinate (C) pic [angle radius=15pt, fill=drawcol] {angle};
}}
},
xor/.style={
for first={
tikz+={
\path (.parent) coordinate (A) -- (!u.children) coordinate (B) -- (!ul.parent) coordinate (C) pic [angle radius=15pt, draw=drawcol] {angle};
}}
},
disjunction tree/.style={
where={isodd(n_children())}{
for n={int((n_children()+1)/2)}{calign with current},
}{
calign=midpoint,
},
before typesetting nodes={
%% for nodewalk={
%% filter/.wrap pgfmath arg={{level>=##1}{n_children()>1}}{(disjuncts_from)}
%% }{
%% %relation=xor,
%% },
where={level()>=(concrete_from)}{
concrete,
}{
abstract,
},
% Legend
%% where={(legend)}{
%% legend=false,
%% tikz+={
%% [font=\sffamily]
%% \node (l) [anchor=north west, xshift=10pt] at (current bounding box.north east) {Legend};
%% \foreach \i/\j [remember=\i as \k (initially l)] in {mandatory/Mandatory,optional/Optional,or/Or,xor/Xor,abstract/Abstract,concrete/Concrete}
%% {
%% \node (\i) [below=20pt of \k.north, anchor=north, text centered, \i, minimum width=5pt,] {};
%% \node (\j) [right=15pt of \i.center -| mandatory.west, anchor=west] {\j};
%% };
%% \draw [drawcol] (xor.south west) coordinate (A) -- (xor.north) coordinate (B) -- (xor.south east) coordinate (C) pic [draw=drawcol, angle radius=5pt] {angle};
%% \draw [drawcol] (or.south west) coordinate (A) -- (or.north) coordinate (B) -- (or.south east) coordinate (C) pic [fill=drawcol, angle radius=5pt] {angle};
%% \foreach \i in {mandatory,optional} \draw [darkgray] (\i.north east) -- +(45:5pt);
%% \node (c) [below=0pt of Concrete.south] {};
%% \scoped[on background layer]{\node [draw, fill=white, blur shadow, fit=(l) (Mandatory) (Optional) (Or) (Xor) (Abstract) (Concrete) (c), rounded corners] {};}
%% },
%% }{},
},
for tree={
parent anchor=children,
child anchor=parent,
l'+=4mm,
blur shadow,
rounded corners,
text height=2ex,
text depth=.5ex,
font=\sffamily,
},
},
}
\DeclareRobustCommand\mytikzdot{\tikz \fill[black] (1ex,1ex) circle (1ex);}
\DeclareRobustCommand\mytikzxor{\begin{tikzpicture}
\node[] (xor) {};
\draw [drawcol] (xor.south west) coordinate (A) -- (xor.north) coordinate (B) -- (xor.south east) coordinate (C) pic [draw=darkgray, angle radius=5pt] {angle};
\end{tikzpicture}
}
\DeclareRobustCommand\mytikzmandatory{\begin{tikzpicture}
\node[circle, fill=darkgray, minimum size=1.5ex,inner sep=0pt] (mandatory) {};
\draw [darkgray] (mandatory.north east) -- +(45:3pt);
\end{tikzpicture}
}
\DeclareRobustCommand\mytikzoptional{\begin{tikzpicture}
\node[circle, draw=darkgray, minimum size=1.5ex,inner sep=0pt] (mandatory) {};
\draw [darkgray] (mandatory.north east) -- +(45:3pt);
\end{tikzpicture}
}
\DeclareRobustCommand\mytikzor{\begin{tikzpicture}
\node[] (or) {};
\draw [drawcol] (or.south west) coordinate (A) -- (or.north) coordinate (B) -- (or.south east) coordinate (C) pic [fill=darkgray, angle radius=5pt] {angle};
\end{tikzpicture}
}