From 5a50e4897794b109c63f39155a19d1263b842d31 Mon Sep 17 00:00:00 2001 From: Aada Date: Sun, 16 Jun 2024 21:14:11 +0200 Subject: Add drawing --- shapes.tex | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 shapes.tex (limited to 'shapes.tex') diff --git a/shapes.tex b/shapes.tex new file mode 100644 index 0000000..1471807 --- /dev/null +++ b/shapes.tex @@ -0,0 +1,171 @@ +\makeatletter + +\pgfdeclareshape{stop}{% + \savedanchor{\upperrightcorner}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=0.5\pgf@xa + \pgf@y=0.5\pgf@ya + } + \savedanchor{\lowerleftcorner}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=-0.5\pgf@ya + } + + \anchor{center}{\pgfpointorigin} + % \anchor{center}{\centerpoint} + \anchor{north east}{% + \upperrightcorner% + } + \anchor{north}{% + \upperrightcorner% + \pgf@x=0pt + } + \anchor{south east}{% + \upperrightcorner% + \pgf@y=-\pgf@y + } + \anchor{south west}{% + \lowerleftcorner% + } + \anchor{south}{% + \lowerleftcorner% + \pgf@x=0pt + } + \anchor{north west}{% + \upperrightcorner% + \pgf@x=-\pgf@x + } + \anchor{west}{% + \lowerleftcorner% + \pgf@y=0pt + } + \anchor{east}{% + \upperrightcorner% + \pgf@y=0pt + } + + \savedanchor{\outerfirstcentersecond}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + % \divide\pgf@xa by 3 + % \divide\pgf@xa by 2 + \pgf@x=-.5\pgf@xa + \advance\pgf@x by .5\pgf@ya + \pgf@y=\pgf@ya + } + + \anchor{one half}{ + \outerfirstcentersecond + \pgf@y=0pt + } + \anchor{two half}{ + \outerfirstcentersecond + \pgf@x=-\pgf@x + \pgf@y=0pt + } + + \anchor{north one half}{ + \outerfirstcentersecond + } + \anchor{north two half}{ + \outerfirstcentersecond + \pgf@x=-\pgf@x + } + \anchor{south one half}{ + \outerfirstcentersecond + \pgf@y=-\pgf@y + } + \anchor{south two half}{ + \outerfirstcentersecond + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + + \savedanchor{\outerfirstquarter}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@y=\pgf@ya + \pgf@x=-.5\pgf@xa % We are at (shape.north west) now + \advance\pgf@x by .5\pgf@ya % We are at (shape.north one half) now + \advance\pgf@x by \pgf@ya + } + + \anchor{two quarter}{ + \outerfirstquarter + \pgf@y=0pt + } + \anchor{three quarter}{ + \outerfirstquarter + \pgf@x=-\pgf@x + \pgf@y=0pt + } + + \anchor{north two quarter}{ + \outerfirstquarter + } + \anchor{south two quarter}{ + \outerfirstquarter + \pgf@y=-\pgf@y + } + \anchor{north three quarter}{ + \outerfirstquarter + \pgf@x=-\pgf@x + } + \anchor{south three quarter}{ + \outerfirstquarter + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + + + \savedanchor{\outertop}{ + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=0pt + \pgf@y=1\pgf@ya + } + + \anchor{north center}{ + \outertop + } + + \anchor{south center}{ + \outertop + \pgf@y=-\pgf@y + } + + \backgroundpath{ + \pgfpathrectanglecorners{\lowerleftcorner}{\upperrightcorner} + } +} + +\makeatother + +\tikzset{ + stop/.style={ + shape=stop, + color=black!30, + draw, + fill=yellow!30, + rounded corners=1cm, + minimum height=2cm, + }, + stop1/.style={ + stop, + minimum width=2cm, + }, + stop2/.style={ + stop, + minimum width=4cm, + }, + stop3/.style={ + stop, + minimum width=6cm, + }, + stop4/.style={ + stop, + minimum width=8cm, + }, +} -- cgit v1.2.3