Updating documentation and examples with new core namespaces
[shapes.git] / examples / doc / blockdraw-connections-primitive.shape
blob93439a2f3f40e0d3809b37644abe816e5793468c
1 /** This file is part of Shapes.
2  **
3  ** Shapes is free software: you can redistribute it and/or modify
4  ** it under the terms of the GNU General Public License as published by
5  ** the Free Software Foundation, either version 3 of the License, or
6  ** any later version.
7  **
8  ** Shapes is distributed in the hope that it will be useful,
9  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  ** GNU General Public License for more details.
12  **
13  ** You should have received a copy of the GNU General Public License
14  ** along with Shapes.  If not, see <http://www.gnu.org/licenses/>.
15  **
16  ** Copyright 2008, 2014 Henrik Tidefelt
17  **/
19 ##needs ..Applications..Blockdraw
21 ##lookin ..Shapes
22 ##lookin ..Applications..Blockdraw
24 ##unit dx = 8cm
25 ##unit dy = 3cm
27 p0: (~1cm,0.5cm)
28 p1: (1cm,2cm)
30 dynamic @p0 identity p0
31 dynamic @p1 identity p1
33 helper: \ pth →
35 Text..@font:Text..Font..COURIER
37 (( @width:4bp & @stroking:Traits..RGB..RED | [spot @p0] & [spot @p1] )
38  & [putlabelAbove (Text..newText << `@p0´) @p0 0]
39  & [putlabelBelow (Text..newText << `@p1´) @p1 0]
40  & [[shift @p0+(1cm,~0.5cm)] [Layout..shiftoff_wlm (Text..newText << [Debug..sourceof pth]) Layout..to_bot]])
43 dynShift: \ pos → ( @p0:[[shift pos] p0] & @p1:[[shift pos] p1] )
45 [dynShift (1dx,0dy)] | { IO..•page << [helper [Debug..locate [hhconnect IO..•page @p0 @p1 0 ~5mm]]] }
46 [dynShift (2dx,0dy)] | { IO..•page << [helper [Debug..locate [hhconnect IO..•page @p0 @p1 0.5 0mm]]] }
47 [dynShift (3dx,0dy)] | { IO..•page << [helper [Debug..locate [hhconnect IO..•page @p0 @p1 1 5mm]]] }
49 [dynShift (1.5dx,~1dy)] | { IO..•page << [helper [Debug..locate [vhconnect IO..•page @p0 @p1]]] }
50 [dynShift (2.5dx,~1dy)] | { IO..•page << [helper [Debug..locate [hvconnect IO..•page @p0 @p1]]] }
52 [dynShift (1dx,~2dy)] | { IO..•page << [helper [Debug..locate [vvconnect IO..•page @p0 @p1 0 ~5mm]]] }
53 [dynShift (2dx,~2dy)] | { IO..•page << [helper [Debug..locate [vvconnect IO..•page @p0 @p1 0.5 0mm]]] }
54 [dynShift (3dx,~2dy)] | { IO..•page << [helper [Debug..locate [vvconnect IO..•page @p0 @p1 1 5mm]]] }