From ec22b275c331536a5443e91533bb821c7426132f Mon Sep 17 00:00:00 2001 From: Aada Date: Fri, 19 Jul 2024 19:12:58 +0200 Subject: Introduce simple shapes --- shape_simple.tex | 94 ++++++++++++++++++++++++++++++++++ shapes_simple.tex | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 241 insertions(+) create mode 100644 shape_simple.tex create mode 100644 shapes_simple.tex diff --git a/shape_simple.tex b/shape_simple.tex new file mode 100644 index 0000000..518eb5e --- /dev/null +++ b/shape_simple.tex @@ -0,0 +1,94 @@ +\documentclass[tikz]{standalone} + +\usetikzlibrary{positioning} + +\input{shapes_simple.tex} + +\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, + }, + stop5/.style={ + stop, + minimum width=10cm, + }, + stop6/.style={ + stop, + minimum width=12cm, + }, + stop7/.style={ + stop, + minimum width=14cm, + }, + stop8/.style={ + stop, + minimum width=16cm, + }, + stop9/.style={ + stop, + minimum width=18cm, + }, + stop10/.style={ + stop, + minimum width=20cm, + }, +} + +\begin{document} +\begin{tikzpicture} + \node[stop1, name=one] {};%{Stop\vrule width 1pt height 2cm}; + \node[stop2, name=two, below=4.5cm of one.west, anchor=west] {}; + \node[stop3, name=three, below=4.5cm of two.west, anchor=west] {}; + \node[stop4, name=four, below=4.5cm of three.west, anchor=west] {}; + \node[stop5, name=five, below=4.5cm of four.west, anchor=west] {}; + \node[stop6, name=six, below=4.5cm of five.west, anchor=west] {}; + \node[stop9, name=nine, below=4.5cm of six.west, anchor=west] {}; + \node[stop10, name=ten, below=4.5cm of nine.west, anchor=west] {}; + % \draw[gray, thin] + % (one.center) -- (two.one half) -- (three.one half) -- (four.one half) + % (two.two half) -- (three.center) -- (four.two quarter) + % (three.two half) -- (four.three quarter) + % ; + \foreach\shape in {one,two,three,four,five,six,nine,ten} { + \foreach\anchor/\placement in {% + one/above, + two/above, + three/above, + four/above, + five/above, + six/above, + seven/above, + eight/above, + nine/above, + ten/above, + % + south/below, + north/above, + west/below left, + east/below right, + center/above% + } \draw[shift=(\shape.\anchor)] plot[mark=x] coordinates{(0, 0)} node[\placement] {\tiny\texttt{(\shape.\anchor)}}; + } +\end{tikzpicture} +\end{document} diff --git a/shapes_simple.tex b/shapes_simple.tex new file mode 100644 index 0000000..88aa921 --- /dev/null +++ b/shapes_simple.tex @@ -0,0 +1,147 @@ +\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{\one}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 0.5\pgf@ya + } + \anchor{one}{\one} + + \savedanchor{\two}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 1.5\pgf@ya + } + \anchor{two}{\two} + + \savedanchor{\three}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 2.5\pgf@ya + } + \anchor{three}{\three} + + \savedanchor{\four}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 3.5\pgf@ya + } + \anchor{four}{\four} + + + \savedanchor{\five}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 4.5\pgf@ya + } + \anchor{five}{\five} + + \savedanchor{\six}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 5.5\pgf@ya + } + \anchor{six}{\six} + + \savedanchor{\seven}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 6.5\pgf@ya + } + \anchor{seven}{\seven} + + \savedanchor{\eight}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 7.5\pgf@ya + } + \anchor{eight}{\eight} + + \savedanchor{\nine}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 8.5\pgf@ya + } + \anchor{nine}{\nine} + + \savedanchor{\ten}{ + \setlength{\pgf@xa}{\pgfshapeminwidth} + \setlength{\pgf@ya}{\pgfshapeminheight} + \pgf@x=-0.5\pgf@xa + \pgf@y=0pt + \advance\pgf@x by 9.5\pgf@ya + } + \anchor{ten}{\ten} + + \backgroundpath{ + \pgfpathrectanglecorners{\lowerleftcorner}{\upperrightcorner} + } +} + +\makeatother + -- cgit v1.2.3