Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/dpv/CrowDPV.m4

raw
1 .PS
2 # CrowDPV.m4
3 #`Illustrates shadebox and custom crowfoot line termination'
4 gen_init(svg_font(sans-serif,11bp__))
5
6 # Custom macros --------------------------
7
8 # `crowline(linespec,wid,ht)'
9 define(`crowline',
10 `line `$1'
11 M4_E: last line.end
12 crow_wd = ifelse(`$2',,`(arrowwid*8/5)',`$2')
13 crow_ht = ifelse(`$3',,`(1.5*crow_wd)',`$3')
14 M4_P: vperp(last line); M4_P: (M4_P.x*crow_wd,M4_P.y*crow_wd)
15 M4_X: crow_ht/lin_leng(last line) between M4_E and last line.start
16 ifdpic(
17 `spline 0.4 from M4_E+M4_P to M4_X+M4_P then to M4_X-M4_P then to M4_E-M4_P',
18 `spline from M4_E+(M4_P.x,M4_P.y) to M4_X+(M4_P.x,M4_P.y) \
19 then to M4_X-(M4_P.x,M4_P.y) then to M4_E-(M4_P.x,M4_P.y)') ')
20
21 define(`custombox',
22 ``$1': shadebox(box `$2',3)
23 "`$1'" at last box.n above
24 boxtext(shift(shift($@)))')
25
26 define boxtext {
27 for i=1 to $+ do { move to last box.nw+(3pt__,-(2+i*11)pt__);
28 exec sprintf("\"$%g\" ljust",i) }
29 }
30
31 # ----------------------------
32
33 boxwid = boxwid*1.15
34 boxsep = boxwid/2
35
36 custombox(Class,ht boxht*1.7,
37 `classkey, class_type, class_desc')
38
39 custombox(Product,ht Class.ht with .nw at Class.ne+(boxsep,0),
40 `classkey, prodkey, prod_name, pkg_type')
41
42 custombox(Sales,ht boxht*2.75 with .nw at Product.ne+(boxsep*2,13pt__),
43 `perkey, classkey, prodkey, storekey, promokey, quantity, dollars')
44
45 custombox(Period,ht Sales.ht with .nw at Sales.ne+(boxsep*2,0),
46 `perkey, date, day, week, month, qtr, year')
47
48 custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*3/2),
49 `perkey, date, day, week, month, qtr, year')
50
51 custombox(Store,ht boxht*3.2 with .sw at (Product.w,Market.s),
52 `storekey, mktkey, store_type, store_name, street, city, state, zip')
53
54 custombox(Promotion,ht Market.ht with .sw at (Period.w,Market.s),
55 `promokey, promo_type, promo_desc, value, start_date, end_date')
56
57 move to Class.ne+(0,-10pt__); crowline(to (Product.w,Here))
58
59 move to Product.ne+(0,-10pt__); crowline(to (Sales.w,Here))
60 move to last line.start+(0,-crow_wd*2.5); crowline(to (Sales.w,Here))
61 T: last line.c+(0,-crow_wd*2.5)
62
63 move to Period.nw+(0,-10pt__); crowline(to (Sales.e,Here),,1.75*crow_wd)
64 Q: (last line.c,0.35 between Sales.se and Sales.ne)
65
66 move to Market.ne+(0,-10pt__); crowline(to (Store.w,Here))
67 move to Store.ne+(0,-10pt__); line to (T,Here) then to T
68 crowline(to (Sales.w,Here))
69
70 move to Promotion.nw+(0,-10pt__); line to (Q,Here) then to Q
71 crowline(to (Sales.e,Here),,1.75*crow_wd)
72
73 command "</g>" # end font
74 .PE