<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0mm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-NZ link="#467886" vlink="#96607D" style='word-wrap:break-word'><div class=WordSection1><div><div><p class=MsoNormal>- Is it possible to modifiy in metapost the line which is dessined into 2 <b>points</b> map-connection ?: <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I took what maybe a simpler approach to that Tarquin describes, minimally altering the default metapost, but adding a clear start and end point to the map-connection line.<o:p></o:p></p><p class=MsoNormal><img width=321 height=213 style='width:3.3472in;height:2.2222in' id="Picture_x0020_1" src="cid:image001.png@01DC39B6.DA45C970"><o:p></o:p></p><p class=MsoNormal>What I discovered when attempting this was that arrow heads are intimately connected, in the default metapost, to map-connection lines.<o:p></o:p></p><p class=MsoNormal>The example below is complicated by a change we made to refine the alignment of arrow heads when the incoming line is curved.<o:p></o:p></p><p class=MsoNormal>If you want I could dig out the code prior to the arrow head change, but you can probably extract that from your own installation.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Bruce<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>#ARROW and MAP-CONNECTION REDEFINITIONS<o:p></o:p></p><p class=MsoNormal>#--------------------------<o:p></o:p></p><p class=MsoNormal>#Edited Bruce Mutton Apr2018 Redefinition of map-connection line and arrow heads<o:p></o:p></p><p class=MsoNormal>code metapost<o:p></o:p></p><p class=MsoNormal>% Q = 0 -- none (no arrows)<o:p></o:p></p><p class=MsoNormal>% 1 -- end (default)<o:p></o:p></p><p class=MsoNormal>% 2 -- begin<o:p></o:p></p><p class=MsoNormal>% 3 -- both<o:p></o:p></p><p class=MsoNormal>def l_arrow (expr P, Q) =<o:p></o:p></p><p class=MsoNormal>% Arrow heads rotated so that line path intersects middle of back of arrowhead. Johnny Willis 3Jun2023<o:p></o:p></p><p class=MsoNormal> T:=identity;<o:p></o:p></p><p class=MsoNormal> pickup PenC;<o:p></o:p></p><p class=MsoNormal> path Pcircle_s, Pcircle_e, ah_start, ah_end, p, P_mod, errcheck;<o:p></o:p></p><p class=MsoNormal> pair sp, ep, int_start, int_end;<o:p></o:p></p><p class=MsoNormal> numeric alength, c_diam;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> ep = point 0 of P;<o:p></o:p></p><p class=MsoNormal> sp = point infinity of P;<o:p></o:p></p><p class=MsoNormal> alength = 0.5u;<o:p></o:p></p><p class=MsoNormal> c_diam = 2*alength;<o:p></o:p></p><p class=MsoNormal> Pcircle_s = fullcircle scaled c_diam shifted sp;<o:p></o:p></p><p class=MsoNormal> Pcircle_e = fullcircle scaled c_diam shifted ep;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> p := (-0.1u,-alength)--(-0,0)--(.1u,-alength)--cycle;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> errcheck = (ep) -- (sp);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>if arclength(errcheck) < alength: %if end points P shorter than arrow head, don't trim P<o:p></o:p></p><p class=MsoNormal> int_end = ep;<o:p></o:p></p><p class=MsoNormal> int_start = sp;<o:p></o:p></p><p class=MsoNormal> ah_end = (sp) -- (ep);<o:p></o:p></p><p class=MsoNormal> ah_start = (ep) -- (sp);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>else: %set up for trimming P at back of arrowheads<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> int_end = Pcircle_e intersectionpoint P;<o:p></o:p></p><p class=MsoNormal> int_start = Pcircle_s intersectionpoint P;<o:p></o:p></p><p class=MsoNormal> ah_end = (int_end) -- (ep);<o:p></o:p></p><p class=MsoNormal> ah_start = (int_start) -- (sp);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>fi;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>if Q = 0: % -head none<o:p></o:p></p><p class=MsoNormal> P_mod = P;<o:p></o:p></p><p class=MsoNormal>fi;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>if Q = 1: %arrow at end of line -head end<o:p></o:p></p><p class=MsoNormal> draw p rotated (angle(thdir(ah_end,0))-90) shifted (point 0 of P);<o:p></o:p></p><p class=MsoNormal> fill p rotated (angle(thdir(ah_end,0))-90) shifted (point 0 of P);<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> P_mod = P cutbefore int_end;<o:p></o:p></p><p class=MsoNormal>fi;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>if Q = 2: %arrow at start of line -head begin<o:p></o:p></p><p class=MsoNormal> draw p rotated (angle(thdir(ah_start,0))-90) shifted (point infinity of P);<o:p></o:p></p><p class=MsoNormal> fill p rotated (angle(thdir(ah_start,0))-90) shifted (point infinity of P);<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> P_mod = P cutafter int_start;<o:p></o:p></p><p class=MsoNormal>fi;<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>if Q = 3: %arrow at both ends of line -head both<o:p></o:p></p><p class=MsoNormal> draw p rotated (angle(thdir(ah_start,0))-90) shifted (point infinity of P);<o:p></o:p></p><p class=MsoNormal> fill p rotated (angle(thdir(ah_start,0))-90) shifted (point infinity of P);<o:p></o:p></p><p class=MsoNormal> draw p rotated (angle(thdir(ah_end,0))-90) shifted (point 0 of P);<o:p></o:p></p><p class=MsoNormal> fill p rotated (angle(thdir(ah_end,0))-90) shifted (point 0 of P);<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> P_mod = (P cutbefore int_end) cutafter int_start;<o:p></o:p></p><p class=MsoNormal>fi;<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> thdraw P_mod;<o:p></o:p></p><p class=MsoNormal>enddef;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>def l_mapconnection (expr P) =<o:p></o:p></p><p class=MsoNormal> thdrawoptions(dashed dashpattern(on 1bp off 2bp on 1bp off 2bp) <o:p></o:p></p><p class=MsoNormal> scaled (2 * optical_zoom) withpen PenA);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> %draw map-connection line with arrowhead at end<o:p></o:p></p><p class=MsoNormal> l_arrow(P,1); %How to double or triple arrowhead size with this call?<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> %draw dot at start of map-connection line<o:p></o:p></p><p class=MsoNormal> thdraw point infinity of P withpen pencircle scaled 0.3u; <o:p></o:p></p><p class=MsoNormal> %Why infinity and not 0 for start?? <o:p></o:p></p><p class=MsoNormal> %If point before arrow head, then point does not render in legend but does on map?? <o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> thdrawoptions();<o:p></o:p></p><p class=MsoNormal>enddef;<o:p></o:p></p><p class=MsoNormal>endcode<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal># and if necessary in some other layout…<o:p></o:p></p><p class=MsoNormal>symbol-colour line map-connection [54 7 60] #purple<o:p></o:p></p><p class=MsoNormal>symbol-show line map-connection<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>#And then in th-config but outside of a layout…<o:p></o:p></p><p class=MsoNormal>text en "line map-connection" "passage offset connection"<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>#END<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>