My goal is to draw a complex system architecture.
Some approaches to do it are here How to draw a layered architecture using Latex?
This approach https://tex.stackexchange.com/a/102669/44348 seems to be very interesting, so one can make following modifications in that example:
- Add shadow options
\usetikzlibrary{shadows}
- Add a way to cut shadows from a node, please, see here remove drop shadow from one node
- Make
nodes in empty cells=false
- Add
|[no shadows]|
to the cell that is going to be merged just to make a shape, anchor and name of this cell and prevent a mistake e.c.t.
I've some problems with:
Adding the pictures, like database Display Database Instance Relationship with TikZ, for example
in the cells
(stack-5-6) (stack-6-6)
with the name to make an arrow in future.Creating an arbitrary block of nodes with the border and shadow, for example
- we don't have a border and shadow near the cell
(stack-3-4)
, - we can't set a color of the matrix' body, because it'will be over the blocks with background.
A way of adding pictures is described here Nodes and matrix of nodes but I can't adopt it well.
A way of creating blocks as backround layers is described here http://www.texample.net/tikz/examples/kalman-filter/ but I can't have right borders and shadows. There is a problem to use
fit
option ofbackground
to get a good solution.- we don't have a border and shadow near the cell
The MWE is
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds,shadows,positioning,fit,matrix,shapes.geometric} % add shadows #1
% a way to cut shadows in a cell #2
%https://tex.stackexchange.com/questions/129318/remove-drop-shadow-from-one-node
\makeatletter
\tikzset{no shadows/.code=\let\tikz@preactions\pgfutil@empty}
\makeatother
\tikzstyle{background}=[rectangle,
fill=red!10,
inner sep=0.2cm]
%rounded corners=5mm] % it would be great to use rounded corners...
\tikzstyle{backgroundN}=[rectangle, % to cut the background's node
fill=white,
inner sep=0.3cm]
%rounded corners=5mm] % it would be great to use rounded corners...
\tikzstyle{backgroundNN}=[rectangle, % to create the background's node
fill=red!10,
inner sep=0.2cm]
%rounded corners=5mm] % it would be great to use rounded corners...
\definecolor{mybluei}{RGB}{124,156,205}
\definecolor{myblueii}{RGB}{73,121,193}
\definecolor{mygreen}{RGB}{202,217,126}
\definecolor{mypink}{RGB}{233,198,235}
\newcommand\widernode[5][widebox]{
\node[
#1,
fit={(#2) (#3)},
label=center:{\sffamily\bfseries\color{black}#4}] (#5) {};
}
\begin{document}
\begin{tikzpicture}[node distance=2pt,outer sep=0pt, % just do nothing after modification
boxstyle/.style={
draw=white,
fill=#1,
rounded corners, drop shadow, %to get a shadow in below a node
font={\sffamily\bfseries\color{white}},
align=center,
minimum height=30pt
},
box/.style={
boxstyle=#1,
text width=2.5cm},
box/.default=mybluei,
title/.style={font={\sffamily\bfseries\color{black}}},
widebox/.style={draw=white,inner sep=0pt, rounded corners,fill=#1,drop shadow},
widebox/.default=mybluei,
mylabel/.style={font={\sffamily\bfseries\color{black}}},
]
\matrix (stack) [draw=black,% boxstyle=mybluei!40,%will overpaint blocks with background
column sep=10pt, row sep=10pt, inner sep=4mm,%
matrix of nodes,
nodes={box, outer sep=0pt, anchor=center, inner sep=3pt},%
nodes in empty cells=false,% #3
row 1/.style={nodes={fill=none,draw=none,minimum height=3mm}},
]
{
|[no shadows]|& & & &|[no shadows]|&|[no shadows]| \\ % #5
RCP main & Authoring & Browsing & Publishing & Search&|[no shadows]|\\
Rich Text &|[no shadows]| &|[no shadows]| &{XML\\ Export/Import} & MSP Export&|[no shadows]|\\
Common & |[no shadows]|&|[no shadows]| & |[no shadows]|&|[no shadows]| &\node[rotate=10] {Hello};\\
|[box=mypink]| Jtidy & |[no shadows]|&|[no shadows]| &|[box=mygreen]| GEF &|box=mygreen]| ICU4J & \\
|[no shadows]|& && &|[no shadows]|&\\};
\widernode[]{stack-1-1}{stack-1-5}{EPF Composer}{EPF} %#5
\widernode{stack-3-2}{stack-3-3}{Library Management}{LMg}
\widernode{stack-4-2}{stack-4-3}{UMA}{UMA}
\widernode{stack-4-4}{stack-4-5}{Export/Import}{ExImp}
\widernode[widebox=mygreen]{stack-5-2}{stack-5-3}{EMF}{EMF}
\widernode[widebox=mygreen]{stack-6-1}{stack-6-5}{RCP Runtime}{RCPrun}
\widernode{stack-2-6}{stack-3-6}{\begin{tikzpicture}
\node[align=center] (a) {Normal text\\works};
\end{tikzpicture}}{NTWorks}
\node [fit={(stack.south west)(stack.south east)},boxstyle=myblueii,draw=black,inner sep=0pt,below=3pt of stack.south,anchor=north,label={[mylabel]center:Java Runtime}] (JavaR) {};
% smth to create an arbitrary block with a border and shadow
\begin{pgfonlayer}{background}
\node [background,
fit=(stack-2-1) (stack-4-1)(stack-4-5),draw, drop shadow,
] {};
\node [backgroundN,
fit=(stack-3-5) ] {};
\node [backgroundNN,draw, drop shadow,
fit=(stack-3-5) ] {};
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
The output AS-IS:
The output TO-BE: