[Therion] Redefining map-connection

Bruce Mutton bruce at tomo.co.nz
Wed Mar 28 10:27:15 CEST 2018


Hi, I'm looking for a little metapost guidance.

 

I want to redefine the map-connection line, making the line thicker, dashed,
with a dot at the start and larger arrowhead at the end.  Also a nicer
generic arrowhead shape.

As the default Therion metapost uses a standard arrow definition for 'line
arrow' and for 'line map-connection' I would like to maintain that
efficiency, except I would like the map-connection arrows heads to be two or
three times larger than the standard arrow head.

So far, with the slightly modified standard Therion code below, I have
achieved all of that except for the difference in arrowhead sizes.



Compare this with the original



 

I expect I could do it by duplicating the l_arrow definition (and call it
l_arrowbig for example) , but this seems inefficient.  Could I modify the
size of the arrowhead with the statement that calls   l_arrow(P,1); ?

 

Although I'm thinking possibly that is not the best idea, as scaling l_arrow
will affect the whole line as well as the arrowhead I expect.

Comments?

 

Bruce

 

#ARROW and MAP-CONNECTION REDEFINITIONS

#--------------------------

code metapost

% Q = 0 -- no arrows

%     1 -- end

%     2 -- begin

%     3 -- both

def l_arrow (expr P, Q) =

  T:=identity;

  pickup PenB;

  thdraw P;

  p := (-.1u,-.5u)--(0,0)--(.1u,-.5u)--cycle; 

  %          0.25 changed to .5 and close end to get nicer arrowhead

  if odd Q:

    thfilldraw p rotated (angle(thdir(P,0))+90) 

                             shifted (point 0 of P);

  fi;

  if Q>1:

    thfilldraw p rotated (angle(thdir(P,length P))-90) 

                 shifted (point infinity of P);

  fi;

enddef;

 

def l_mapconnection (expr P) =

  thdrawoptions(dashed dashpattern(on 1bp off 2bp on 1bp off 2bp) 

                scaled (2 * optical_zoom) withpen PenB);

 

  %draw map-connection line with arrowhead at end

  l_arrow(P,1); %How to double or triple arrowhead size with this call?

  

  %draw dot at start of map-connection line

  thdraw point infinity of P withpen pencircle scaled 0.3u; 

  %Why infinity and not 0 for start??  

  %If point before arrow head, then point does not render in legend but does
on map?? 

  

  thdrawoptions();

enddef;

endcode

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180328/0e3e0904/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5595 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180328/0e3e0904/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 5519 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180328/0e3e0904/attachment-0001.png>


More information about the Therion mailing list