metapost

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
metapost [2019/11/30 23:14] – [Line Symbols] tarquinwjmetapost [2022/06/27 15:41] (current) – Update for a TeX change tarquinwj
Line 143: Line 143:
       % show U alignment box light blue       % show U alignment box light blue
           q:= (xpart U, -ypart U) -- (xpart U, ypart U) -- (-xpart U, ypart U) -- (-xpart U, -ypart U) -- cycle;           q:= (xpart U, -ypart U) -- (xpart U, ypart U) -- (-xpart U, ypart U) -- (-xpart U, -ypart U) -- cycle;
-          thdraw q shifted -(xpart alignment * xpart U, ypart alignment * ypart U) rotated -rotation withpen PenD withcolor 0.5blue+0.5white;+          thdraw q shifted -(xpart alignment * xpart U, ypart alignment * ypart U) rotated -rotation withpen PenD withcolor 0.5[blue,white];
       % show u box grey       % show u box grey
-          thdraw unitsquare scaled u shifted (-0.5u, -0.5u) withpen PenD withcolor 0.1black+0.5white;+          thdraw unitsquare scaled u shifted (-0.5u, -0.5u) withpen PenD withcolor 0.2[black,white];
       % % %       % % %
        
Line 180: Line 180:
  
 This can be used to set a minimum pen thickness, so that all other pens take their sizes relative to that pen thickness. This can be useful for publications that mandate a specific pen width, which can be harder to control with scaling. (This can be done by setting the "u" value, but that causes all symbols to be scaled too.) This can be used to set a minimum pen thickness, so that all other pens take their sizes relative to that pen thickness. This can be useful for publications that mandate a specific pen width, which can be harder to control with scaling. (This can be done by setting the "u" value, but that causes all symbols to be scaled too.)
 +
 +[[user:tarquinwj|Tarquin 2019]]
  
 <code> <code>
Line 198: Line 200:
 This function simplifies it all. Add it once, and then any of your custom points can call it to add a label. This function simplifies it all. Add it once, and then any of your custom points can call it to add a label.
  
-[[user:tarquinwj|Tarquin 2019]]+[[user:tarquinwj|Tarquin 2019-2020]]
  
 <code> <code>
 code metapost code metapost
   vardef create_styled_label (expr plaintext,P,R,S,A,defaultstyle)=   vardef create_styled_label (expr plaintext,P,R,S,A,defaultstyle)=
-    save textsize, style;+    save textsize, style, thetext;
     string textsize;     string textsize;
     if S = 0.5:     if S = 0.5:
Line 222: Line 224:
     fi;     fi;
     picture thetext;     picture thetext;
-    thetext:=thTEX("\thframed {" & textsize & plaintext & "}");+    thetext:=thTEX("\thframed {" & textsize & " \thfb " & plaintext & "}");
     if A = (-1,1):     if A = (-1,1):
       p_label.ulft(thetext,P,R,style);       p_label.ulft(thetext,P,R,style);
Line 269: Line 271:
 For an example of code making use of this function, see [[#Rope lengths]] below. For an example of code making use of this function, see [[#Rope lengths]] below.
  
 +If you want to add custom label styles, you need to call "thelabel.suffix(thetext,position)" with the right alignment suffix, save the return value in a variable called "lab", then call "process_label(position,rotation)". After that, you can check "bbox lab" to get the bounding box of the text label as a path which can be used to draw the decoration. You can temporarily ("interim") set the internal "bboxmargin" variable to make the bounding box larger than the text, to create some padding between the text and your ornamentation. You should use "begingroup+endroup" within a "def" when using the "interim" operator to make sure it gets reset correctly afterwards, or use a vardef instead of a def.
 +
 +Use "rotatedaround (position,rotation)" when drawing the ornamentation to make sure it gets rotated and aligned the same as the label. Note that this applies the rotation around the point position, so alignment and rotation at the same time is weird. This is the same with regular labels though - known Therion bug - so at least this is consistent with Therion itself.
 +
 +Since this will require setting the suffix correctly for both the regular label styles and the custom label styles, there ends up being a lot of duplicated code. It is easier to store the suffix name as a string which can then be extracted with scantokens when calling the appropriate macro, which is what the example code below does. The custom decorations are specified using a style number starting from 100, so as not to clash with the numbers used for Therion's internal label styles.
 +
 +<code>
 +code metapost
 +  vardef create_styled_label (expr plaintext,P,R,S,A,defaultstyle)=
 +    save textsize, style, thetext, sufx, athick;
 +    string textsize;
 +    if S = 0.5:
 +      textsize:="\thtinysize";
 +    elseif S = 0.7:
 +      textsize:="\thsmallsize";
 +    elseif S = 1.4:
 +      textsize:="\thlargesize";
 +    elseif S = 2:
 +      textsize:="\thhugesize";
 +    else: % normal is 1
 +      textsize:="\thnormalsize";
 +    fi;
 +    if known ATTR_labelstyle:
 +      style:=scantokens(ATTR_labelstyle);
 +    else:
 +      style:=defaultstyle;
 +    fi;
 +    picture thetext;
 +    thetext:=thTEX("\thframed {" & textsize & plaintext & "}");
 +    % store the alignment suffix as a string, it will be turned back into a suffix with scantokens
 +    string sufx;
 +    if A = (-1,1):
 +      sufx:="ulft";
 +    elseif A = (0,1):
 +      sufx:="top";
 +    elseif A = (1,1):
 +      sufx:="urt";
 +    elseif A = (-1,0):
 +      sufx:="lft";
 +    elseif A = (1,0):
 +      sufx:="rt";
 +    elseif A = (-1,-1):
 +      sufx:="llft";
 +    elseif A = (0,-1):
 +      sufx:="bot";
 +    elseif A = (1,-1):
 +      sufx:="lrt";
 +    else:
 +      sufx:="";
 +    fi;
 +    if style >= 100:
 +      % create the label, passing the alignment as a suffix
 +      lab:=thelabel.scantokens(sufx)(thetext,P);
 +      % process_label looks for a variable called "lab"
 +      process_label(P,R);
 +      % define all the different ornamentations that you want
 +      if style = 100:
 +        pickup PenA;
 +        athick:=(xpart (lrcorner PenA)) - (xpart (llcorner PenA));
 +        % make bounding box measurements temporarily be larger than the object being measured
 +        % "interim" modifies internal variable, must be inside vardef or def+begingroup to make
 +        % sure it gets reset to default correctly afterwards
 +        interim bboxmargin:=5athick;
 +        % rounded rectangle
 +        % rotating around P is undesirable when alignment is also used, but this is what regular labels do
 +        draw ((bbox lab) smoothed 5athick) rotatedaround (P,R) dashed evenly;
 +      fi;
 +    else:
 +      % create the label, passing the alignment as a suffix
 +      p_label.scantokens(sufx)(thetext,P,R,style);
 +    fi;
 +  enddef;
 +endcode
 +</code>
 =====Replacing legend drawings for existing symbols===== =====Replacing legend drawings for existing symbols=====
  
Line 436: Line 512:
 The default "anchor" symbol takes up a lot of space. It also resists rotation. This produces a P-hanger icon instead. It respects rotation, so that if the "orientation" arrow points to the right, the P-hanger will point in the chosen direction. In addition, it selects the correct direction to face, so that the loop of the hanger always points down the page. It intentionally has a thinner line pointing into the rock, so that it appears to pierce the wall of the cave (just like a real P-hanger). The default "anchor" symbol takes up a lot of space. It also resists rotation. This produces a P-hanger icon instead. It respects rotation, so that if the "orientation" arrow points to the right, the P-hanger will point in the chosen direction. In addition, it selects the correct direction to face, so that the loop of the hanger always points down the page. It intentionally has a thinner line pointing into the rock, so that it appears to pierce the wall of the cave (just like a real P-hanger).
  
-In elevation view, by default it switches to being a filled circle, a standard symbol for a fixed position hanger, which can be placed on the linepoints of a basic rope line.+In elevation view, by default it switches to being a filled circle, a standard symbol for a fixed position hanger on [[riggingtopos|Rigging topos]], which can be placed on the linepoints of a basic rope line.
  
 By using the "-attr type" option, you can control which type of anchor it will show: By using the "-attr type" option, you can control which type of anchor it will show:
Line 570: Line 646:
 ===Magnetic effects=== ===Magnetic effects===
  
-[[user:tarquinwj|Tarquin 2019]]+[[user:tarquinwj|Tarquin 2019-2020]]
  
 Certain rocks can cause a compass to give the wrong reading. This icon can be used to show areas where this happens (ie. where the survey may be unreliable as a result); a spinning compass: Certain rocks can cause a compass to give the wrong reading. This icon can be used to show areas where this happens (ie. where the survey may be unreliable as a result); a spinning compass:
Line 578: Line 654:
   % a spinning compass   % a spinning compass
   def p_u_magnetism (expr P,R,S,A)=   def p_u_magnetism (expr P,R,S,A)=
-    scale:=0.5u; +    begingroup; 
-    halfline:=(0.5u/20S); %half thickness of PenC - pen thicknesses do not scale with S +      save scale, cthick, pointheight, pointwidth, cutheight, cutwidth; 
-    pointheight:=scale*.9; +      scale:=0.5u; 
-    pointwidth:=scale*.4; +      cthick:=(xpart (lrcorner PenC)) (xpart (llcorner PenC)); 
-    U:=(scale,scale); +      pointheight:=scale*.9; 
-    T:=identity aligned A rotated (R-20) scaled S shifted P; +      pointwidth:=scale*.4; 
-    % a circle +      cutheight:=pointheight - (cthick / sind(angle(pointheight,pointwidth))); 
-    thdraw fullcircle scaled 2scale withpen PenC withcolor black+      cutwidth:=pointwidth - (cthick / sind(angle(pointwidth,pointheight))); 
-    % filled triangle +      U:=(scale,scale); 
-    thfill (0,pointheight)--(pointwidth,0)--(-pointwidth,0)--cycle withcolor black+      T:=identity aligned A rotated (R-20) scaled S shifted P; 
-    % black triangle outline +      % a circle 
-    thdraw (0,-pointheight+halfline)--(pointwidth-halfline,0) withpen PenC withcolor black; +      thdraw fullcircle scaled 2scale withpen PenC; 
-    thdraw (0,-pointheight+halfline)--(-pointwidth+halfline,0) withpen PenC withcolor black+      % filled triangle 
-    % spin arcs, a full circle is path 0-8, anticlockwise, starting from the right +      thfill (0,pointheight)--(pointwidth,0)--(-pointwidth,0)--cycle; 
-    thdraw subpath (2.4,3.5) of fullcircle scaled 1.5scale withpen PenC withcolor black+      % black triangle outline 
-    thdraw subpath (6.4,7.5) of fullcircle scaled 1.5scale withpen PenC withcolor black;+      % this can be drawn with mitred pens, but it still ends up needing calculations to get the centre position of the pen thickness 
 +      % therefore it is easier to just use a filled path 
 +      % pointheight/2 is used to stop the thin unpainted gap between shapes 
 +      thfill (0,-pointheight)--(pointwidth,0)--(0,pointheight/2)--(cutwidth,0)--(0,-cutheight)--(-cutwidth,0)--(0,pointheight/2)--(-pointwidth,0)--cycle
 +      % spin arcs, a full circle is path 0-8, anticlockwise, starting from the right 
 +      thdraw subpath (2.4,3.5) of fullcircle scaled 1.5scale withpen PenC; 
 +      thdraw subpath (6.4,7.5) of fullcircle scaled 1.5scale withpen PenC
 +    endgroup;
   enddef;   enddef;
   initsymbol("p_u_magnetism");   initsymbol("p_u_magnetism");
Line 609: Line 692:
 [[user:tarquinwj|Tarquin 2019]] [[user:tarquinwj|Tarquin 2019]]
  
-A common way to show rope lengths (at least in the UK) is with a number inside a circle. This point relies on you also including the code for [[#Adding custom styled labels at any point/linepoint]]:+A common way to show rope lengths (at least in the UK) on [[riggingtopos|Rigging topos]] is with a number inside a circle. This point relies on you also including the code for [[#Adding custom styled labels at any point/linepoint]]:
  
 <code> <code>
Line 641: Line 724:
  
 To set the text of the label, use "-attr text 17" in its options. You can also override the styling by using "-attr labelstyle 0" for each point. To set the text of the label, use "-attr text 17" in its options. You can also override the styling by using "-attr labelstyle 0" for each point.
 +
 +===Walking and climbing man in scale on the map===
 +
 +From Juraj Halama for Therion 5.5.3
 +
 +{{:metapost:cavers.png?112| }}
 +
 + picture u_man_c_pic;
 + u_man_c_pic := image (
 +   draw (0cm, -0cm) -- (-8cm, 27cm) -- (-36cm, 55cm) -- (-50cm, 99cm) withpen pencircle scaled 16cm;
 +   draw (27cm, 48cm) -- (0, 64cm) -- (-29cm, 61cm) -- (-38cm, 102cm)  withpen pencircle scaled 16cm;
 +   draw (-65cm, 48cm) -- (-75cm, 75cm) -- (-53cm, 106cm) -- (0, 106cm) withpen pencircle scaled 14cm;
 +   draw (-44cm, 130cm) withpen pencircle scaled 27cm withcolor black;
 + ) shifted (20cm, -67cm);
 +  
 + picture u_man_w_pic;
 + u_man_w_pic := image (
 +   draw (0, 0) -- (7.5cm, 36cm) -- (0cm, 69cm) -- (9cm, 99cm) withpen pencircle scaled 16cm;
 +   draw (42cm, 9cm) -- (37.5cm, 42cm) -- (13.5cm, 69cm) -- (30cm, 102cm) withpen pencircle scaled 16cm;
 +   draw (21.5cm, 100.5cm) -- (6.6cm, 69cm) withpen pencircle scaled 16cm;
 +   draw (-24cm, 75cm) -- (-13.5cm, 102cm) -- (9cm, 112.5cm) -- (30cm, 108cm) -- (51cm, 87cm) -- (75cm, 93cm) withpen pencircle scaled 14cm;
 +   draw (30cm, 132cm) withpen pencircle scaled 27cm withcolor black;
 + ) shifted (-20cm, -70cm);
 +  
 + def p_u_man_c (expr P, R, S, A) =
 +   U := (60cm, 85cm) scaled (0.01 / Scale);
 +   T:=identity aligned A rotated R scaled S shifted P;
 +   thdraw u_man_c_pic scaled (0.01 / Scale);
 + enddef;
 +  
 + def p_u_man_w (expr P, R, S, A) =
 +   U := (60cm, 80cm) scaled (0.01 / Scale);
 +   T:=identity aligned A rotated R scaled S shifted P;
 +   thdraw u_man_w_pic scaled (0.01 / Scale);
 + enddef;
 +  
 + def p_u_man_c_legend =
 +   draw u_man_c_pic scaled (u / 175cm) shifted ((.5, .5) inscale);
 + enddef;
 +  
 + def p_u_man_w_legend =
 +   draw u_man_w_pic scaled (u / 175cm) shifted ((.5, .5) inscale);
 + enddef;
 +  
 + text en "point u:man_w" "caver (walking)"
 + text en "point u:man_c" "caver (climbing)"
 +
 +Notes:
 +Use "-align top" for proper alignment of the walking man when his point is on the groung.
 +Climbing one has center where the rope should go on the harness...
 +The scale on the map and in the legend is matching just for 1:500...
 +
 +===Region names symbol===
 +In the Hirlatz cave we use this symbol to tell the name of the adjacent (preview) maps.
 +It is quite customizable and especially shows a way how to do label boxes.
 +By default it prints the current surveys name in a white-filled box with rounded corners.
 +You can adjust it per symbol by giving "-attr <var> <val>" options at the symbol in xtherion; see the code header for the available options.
 +
 +From Benedikt Hallinger for Therion 6.0.3
 +
 +{{ ::metapost:therion-u_mappe.png?nolink |}}
 +
 +    # Symbol to denote assigned survey.
 +    #   Option "-attr text <string>" shows given text; otherwise current survey is shown.
 +    #   Option "-attr bordersmooth <num>" overrides edge smoothness (0 for sharp edges)
 +    #   Option "-attr bordermargin <num>" overrides margin text/border
 +    #   Option "-attr basescale <num>" overrides basic text sizing factor (default text size)
 +    #   Option "-attr fillsize <s_pct>" fills with page background color; s_pct is percent of bbox size
 +    def p_u_mappe(expr pos, theta, sc, al) =
 +      T:=identity aligned al rotated theta scaled sc shifted pos;
 +      begingroup;
 +        % Basic config
 +        bordersmooth:=4;         % smoothness of box corners  (0=90° edges)
 +        bordermargin:=5.0bp;     % padding border->text
 +        basescale:=1.0;          % basic scaling of default-sized text
 +        fillsize:=-1.0;           % proportional size of label filling (percent)
 +        if known(ATTR_bordersmooth): bordersmooth:=scantokens(ATTR_bordersmooth); fi;
 +        if known(ATTR_bordermargin): bordermargin:=scantokens(ATTR_bordermargin); fi;
 +        if known(ATTR_basescale):    basescale:=scantokens(ATTR_basescale);       fi;
 +        if known(ATTR_fillsize):     fillsize:=scantokens(ATTR_fillsize);         fi;
 +      
 +        % GET LABEL TEXT:
 +        string txt;
 +        if known(ATTR_text):
 +            txt := ATTR_text;
 +        else:
 +                txt := ATTR__survey;
 +        fi;
 +        
 +        
 +        % PREPARE LABEL:
 +        lab:=thelabel(txt, (0.0,0.0));
 +        pickup PenA;                       % border thickness
 +        interim bboxmargin:=bordermargin;  % padding border->text
 +        
 +        % PREPARE BOX and DRAW BOX BACKGROUND:
 +        % q is the box as drawed, but we fill the place first before drawing
 +        q:=((bbox lab) smoothed bordersmooth) aligned al scaled (sc * basescale) rotated theta shifted pos;
 +        if (fillsize <> -1.0):
 +            % draw extending filled box around symbol
 +            if known(MapBackground):
 +                % from therion versions newer than 6.0.3+3551531+dev (23.11.2021) we use page background
 +                thfill ((bbox lab) smoothed bordersmooth) scaled (sc * basescale * fillsize) withcolor MapBackground;
 +            else:
 +                thfill ((bbox lab) smoothed bordersmooth) scaled (sc * basescale * fillsize) withcolor label_fill_color;
 +            fi;
 +        fi;
 +        % the following will draw the actual visible interiour-filling of the box
 +        thfill ((bbox lab) smoothed bordersmooth) scaled (sc * basescale) withcolor label_fill_color;
 +        
 +        % DRAW BOX
 +        draw q;
 +        
 +        % DRAW LABEL TEXT
 +        lab:=lab aligned al;
 +        lab:=lab scaled (sc * basescale);
 +        lab:=lab rotated theta;
 +        lab:=lab shifted pos;
 +        process_label(pos, 0.001);   % for some weird reason "0.0" does not work here and puts the label to map-center at scrap-rotation.
 +      endgroup;
 +    enddef;
 +
 +
 +
 +
 ====Line Symbols==== ====Line Symbols====
 ===View whole centerline for underground=== ===View whole centerline for underground===
Line 928: Line 1136:
           zz3 := postcontrol t of P;           zz3 := postcontrol t of P;
           zz4 := precontrol t+1 of P;           zz4 := precontrol t+1 of P;
 +          linecap_prev:=linecap;
           linecap:=0;           linecap:=0;
           if (length(zz3-1/3[zz1,zz2]) > 0.1pt) or           if (length(zz3-1/3[zz1,zz2]) > 0.1pt) or
Line 949: Line 1158:
             draw zz1--zz2 withcolor background;             draw zz1--zz2 withcolor background;
           fi;           fi;
 +          linecap:=linecap_prev;   % to prevent problems with dots of other symbols
         endfor;         endfor;
       enddef;       enddef;
Line 987: Line 1197:
 [[user:tarquinwj|Tarquin 2019]] [[user:tarquinwj|Tarquin 2019]]
  
-Pits use the same appearance in both plan and elevation views. However, it may be desirable for a pit edge to be drawn as a pitch in plan view, but a ledge in elevation view. This is common with rigging topos, for example, where the plan uses a pit symbol, but the same same drop in the elevation view will normally be shown with a different symbol, such as a dashed line, to indicate that a traverse may be required along a ledge. It is still a pitch, so it should use the same semantic "l_pit" symbol, even though the rendering should be different. This example shows how to show a pit symbol in plan view, but replace it with a dashed ledge line (borrowed from a temporary border) in elevation view:+Pits use the same appearance in both plan and elevation views. However, it may be desirable for a pit edge to be drawn as a pitch in plan view, but a ledge in elevation view. This is common with [[riggingtopos|Rigging topos]], for example, where the plan uses a pit symbol, but the same same drop in the elevation view will normally be shown with a different symbol, such as a dashed line, to indicate that a traverse may be required along a ledge. It is still a pitch, so it should use the same semantic "l_pit" symbol, even though the rendering should be different. This example shows how to show a pit symbol in plan view, but replace it with a dashed ledge line (borrowed from a temporary border) in elevation view:
  
 <code> <code>
Line 1010: Line 1220:
 [[user:tarquinwj|Tarquin 2019]] [[user:tarquinwj|Tarquin 2019]]
  
-The default Therion rope symbol is very pretty, doing fancy rebelays and anchors. This works well for simple cases, but when trying to draw rigging topos, it tries to add anchors and rebelays in places where you were just trying to draw Y-hang knots, and it sometimes fails to draw lines because it decides that they were too short.+The default Therion rope symbol is very pretty, doing fancy rebelays and anchors. This works well for simple cases, but when trying to draw [[riggingtopos|Rigging topos]], it tries to add anchors and rebelays in places where you were just trying to draw Y-hang knots, and it sometimes fails to draw lines because it decides that they were too short.
  
 It is possible to disable the anchors and rebelays by adding two options to a linepoint (not the line itself), and hoping that you never accidentally remove that particular linepoint. These options apply to the whole line rather than an individual linepoint, so you cannot fine control the use of rebelays and linepoints. It is best to just disable them, use the usual Bézier curve controls, and [[#P-hangers that face the right way, and other anchor designs|manually add anchors]]. It is possible to disable the anchors and rebelays by adding two options to a linepoint (not the line itself), and hoping that you never accidentally remove that particular linepoint. These options apply to the whole line rather than an individual linepoint, so you cannot fine control the use of rebelays and linepoints. It is best to just disable them, use the usual Bézier curve controls, and [[#P-hangers that face the right way, and other anchor designs|manually add anchors]].
Line 1044: Line 1254:
       fi;       fi;
     else:     else:
-      thdraw P;+      begingroup; 
 +        save type; 
 +        string type; 
 +        if known ATTR_type: 
 +          type:=ATTR_type; 
 +        else: 
 +          type:="primary"; 
 +        fi; 
 +        if type = "secondary": 
 +          thdraw P withcolor (0.7, 0.7, 0.7); 
 +        else: 
 +          thdraw P; 
 +        fi; 
 +      endgroup;
     fi;     fi;
   enddef;   enddef;
 endcode endcode
 </code> </code>
 +
 +Rope lines default to using the standard colour (black, unless you change it with "symbol-color"). Optionally use it with the following -attr setting "value" options on the line:
 +
 +  * -attr type primary   = (default) use the default colour (black)
 +  * -attr type secondary = draws in grey
 +
 +This allows you to have ropes with two different colours, useful if ropes are optional or follow an uncommon optional route.
  
 ===Deviations=== ===Deviations===
Line 1054: Line 1284:
 [[user:tarquinwj|Tarquin 2019]] [[user:tarquinwj|Tarquin 2019]]
  
-For rigging topos, one of the most easily recognised symbols used in the UK is a rope reaching from a wall towards the main rope, with a small oval around it, pulling the rope to the side. This symbol shows an example of cutoffafter, used to allow the deviation's rope to share a linepoint with the main rope, but without showing the deviation rope inside the oval (a reverse clipping effect in MetaPost!).+For [[riggingtopos|Rigging topos]], one of the most easily recognised symbols used in the UK is a rope reaching from a wall towards the main rope, with a small oval around it, pulling the rope to the side. This symbol shows an example of cutoffafter, used to allow the deviation's rope to share a linepoint with the main rope, but without showing the deviation rope inside the oval (a reverse clipping effect in MetaPost!).
  
 <code> <code>
Line 1207: Line 1437:
 [[user:tarquinwj|Tarquin 2019]] [[user:tarquinwj|Tarquin 2019]]
  
-Trees are often found in the entrances to caves, and sometimes a survey deserves to show the trees. This is particularly common with rigging topos for surface shafts, where a tree may be used as a rope belay, but it also may be in particularly large entrances which contain forests. A tree may be created as a single point symbol, but this then makes it difficult to scale the heights and widths perfectly, and even harder to attach other lines (like ropes or tethers) to the sides of them. It also means that when trying to draw a particularly distinctive tree which must be used as a belay, it is not possible to show it in a recognisable way.+Trees are often found in the entrances to caves, and sometimes a survey deserves to show the trees. This is particularly common with [[riggingtopos|Rigging topos]] for surface shafts, where a tree may be used as a rope belay, but it also may be in particularly large entrances which contain forests. A tree may be created as a single point symbol, but this then makes it difficult to scale the heights and widths perfectly, and even harder to attach other lines (like ropes or tethers) to the sides of them. It also means that when trying to draw a particularly distinctive tree which must be used as a belay, it is not possible to show it in a recognisable way.
  
 This is therefore a pair of symbols. The first is for the sides of the tree trunk (which could also be used to create jagged shapes for conifers), and the second is for the bushy leaves at the top of a deciduous tree. The sides of the tree can therefore be curved or branched as needed, with linepoints added for attaching rope lines, the surface lines, and the bushy part of the tree to. For plans, the bushy part alone would normally work, as a closed, circular line. This is therefore a pair of symbols. The first is for the sides of the tree trunk (which could also be used to create jagged shapes for conifers), and the second is for the bushy leaves at the top of a deciduous tree. The sides of the tree can therefore be curved or branched as needed, with linepoints added for attaching rope lines, the surface lines, and the bushy part of the tree to. For plans, the bushy part alone would normally work, as a closed, circular line.
Line 1309: Line 1539:
 {{ ::tree.png?nolink |}} {{ ::tree.png?nolink |}}
  
-Select these as line type "u" with "-subtype treetrunk" and "-subtype treetrunk" in their options. Remember to set "-clip off" on the lines if they are going to be used outside of the cave walls. Use it with these lines in your layout:+Select these as line type "u" with "-subtype treetrunk" and "-subtype bush" in their options. Remember to set "-clip off" on the lines if they are going to be used outside of the cave walls. Use it with these lines in your layout:
  
   text en "line u:treetrunk" "tree"   text en "line u:treetrunk" "tree"
Line 1325: Line 1555:
 [[user:tarquinwj|Tarquin 2019]] [[user:tarquinwj|Tarquin 2019]]
  
-Metal bars and wooden beams are a common part of chokes, and are not normally drawn on a survey (though sometimes that are drawn, for particularly special cases). However, sometimes they are also used for rigging, and that is where they become important. Therion does not do anything with the "-scale" option on lines (it is silently ignored), but sometimes it is needed for a line symbol, and this is one of those cases - some shoring deserves a thick line, some does not. This symbol is therefore an example of how to provide an equivalent "-attr scale xs" option which can be used in the symbol code. The values it supports are the same as a regular -scale option (xs, s, m, l, xl).+Metal bars and wooden beams are a common part of chokes, and are not normally drawn on a survey (though sometimes that are drawn, for particularly special cases). However, sometimes they are also used for [[riggingtopos|rigging]], and that is where they become important. Therion does not do anything with the "-scale" option on lines (it is silently ignored), but sometimes it is needed for a line symbol, and this is one of those cases - some shoring deserves a thick line, some does not. This symbol is therefore an example of how to provide an equivalent "-attr scale xs" option which can be used in the symbol code. The values it supports are the same as a regular -scale option (xs, s, m, l, xl).
  
 <code> <code>
Line 1361: Line 1591:
  
   text en "line u:shoring" "shoring/bars"   text en "line u:shoring" "shoring/bars"
 +
 +===Centreline that is only visible when not in a scrap===
 +
 +[[user:tarquinwj|Tarquin 2019]]
 +
 +Sometimes, you might want to show a centreline for a section of the cave where you do not have any wall data, if you are using [[tips#Showing centreline for parts of a cave, and passage walls for others|a map made up from surveys and other maps]]. However, you might not want to show the walls within your regular scraps where you have wall data, since they are distracting and meaningless for viewers. There is no setting for this, since "symbol-hide group centreline" affects all centrelines at once, so it must be done through MetaPost:
 +
 +<code>
 +code metapost
 +  def l_survey_cave_MY(expr P) =
 +    if ATTR__scrap_centerline:
 +      l_survey_cave_SKBB(P);
 +    fi;
 +  enddef;
 +  initsymbol("l_survey_cave_MY");
 +endcode
 +</code>
 +
 +You may notice the misleadingly named "ATTR__scrap_centerline", which does not mean "centreline within a scrap". Instead, it means "a virtual scrap automatically created, made up entirely of centreline", which is what Therion creates when you ask it to include survey data within a map.
 +
 +Use it with this line in your layout:
 +
 +  symbol-assign line survey:cave MY
 +
 +You can use a similar approach for l_survey_surface_MY (surface survey legs), p_station_temporary_MY, p_station_natural_MY, p_station_painted_MY and p_station_fixed_MY (survey stations) if you needed to show those outside too.
 +
 +===Break line===
 +
 +[[user:tarquinwj|Tarquin 2019]]
 +
 +When a section of are omitted or shortened, typically used with [[riggingtopos|rigging topos]], the common approach is to show a double line wherever the passage has been omitted. Usually, it is drawn at an angle of about 45 degrees. This can either be used on a single scrap with a double line over the passage to show that it is much longer than shown, or it is used to end the scrap, then a second double line is used to start the next scrap; this second version is normally used when the passage on either side of the break is of different dimensions.
 +
 +This code is an example of how to extend a line beyond the defined ends, using additional points. It also shows how to cope with the fact that (as of the time of writing) Therion does not offer a variable that allows you to read the "map-bg" colour. It also shows how to cope with Therion trying to recognise keywords inside "code metapost" sections.
 +
 +  code metapost
 +    def l_u_break(expr P)=
 +      begingroup;
 +        save mainpath, parallel, orientation, direction, gapsize;
 +        T:=identity;
 +        gapsize:=u/3;
 +        path mainpath;
 +        %make the ends stick out beyond the passage
 +        mainpath:=( (point 0 of P) + u * unitvector( thdir(P, 0) rotated 180 ) / 2 )
 +                  -- P --
 +                  ( (point (length P) of P) + u * unitvector( thdir(P, arclength P) ) / 2 );
 +        path parallel;
 +        string orientation;
 +        orientation:=if known ATTR_orientation: ATTR_orientation; else: "horizontal"; fi;
 +        if orientation = "vertical":
 +          direction:=if (xpart (point 0 of mainpath)) > (xpart (point (length mainpath) of mainpath)): 1; else: -1; fi;
 +          parallel:=mainpath shifted (0, direction * gapsize);
 +        else:
 +          direction:=if (ypart (point 0 of mainpath)) > (ypart (point (length mainpath) of mainpath)): -1; else: 1; fi;
 +          parallel:=mainpath shifted (direction * gapsize, 0);
 +        fi;
 +        if known fill_l_u_break:
 +          thfill (mainpath -- (reverse parallel) -- cycle) withcolor fill_l_u_break;
 +        else:
 +          thunfill (mainpath -- (reverse parallel) -- cycle);
 +        fi;
 +        pickup PenC;
 +        thdraw mainpath;
 +        thdraw parallel;
 +      endgroup;
 +    enddef;
 +    initsymbol("l_u_break");
 +    def l_u_break_legend =
 +      l_wall_bedrock(((0,.2) .. controls (.3,.2) and (.4,.4) .. (.6,.4)) inscale);
 +      l_wall_bedrock(((.7,.6) .. controls (.4,.6) and (.3,.4) .. (0,.4)) inscale);
 +      l_u_break(((.6,.4) -- (.7,.6)) inscale);
 +    enddef;
 +  endcode
 +
 +{{ :passagebreak.png?nolink |}}
 +
 +Select this as line type "u" with "-subtype break" in its options. You will also need to define it with "-clip off" in its options to allow the ends of the line to show up outside the walls. Typically, you will also need to use "-place top" in its options to allow it to be placed over the top of any walls, so that it can blank out the wall in between the double lines (either that or you need to ensure that it appears before any wall lines in its scrap, but this can make maintenance harder).
 +
 +Use it with this line in your layout:
 +
 +  text en "line u:break" "passage omitted/offset"
 +
 +By default, it will pick up the colour of the scrap background, to put between the double lines. However, it normally looks better with the map-bg colour between them. Unfortunately, Therion does not appear to expose this colour to MetaPost code (it is created in raw Tex). So you will need to do it manually. If you do not specify map-bg, it is white; "(1, 1, 1)" in MetaPost. If you have set it to a colour like "70", this is "(.7, .7, .7)" in MetaPost. If you have set it to a colour like "[70 35 50]", this is "(.7, .35, .5)" in MetaPost. The code will check for a variable called fill_l_u_break, and will try to use it as a fill colour if it exists.
 +
 +You cannot use "color fill_l_u_break;" in a "code metapost" section, because Therion will try to treat the keyword "color" as a Therion command instead of a MetaPost keyword. You can either write ";color fill_l_u_break;" with a leading semicolon which MetaPost will ignore, or use the synonym "rgbcolor fill_l_u_break;" which Metpost understands but Therion will not recognise.
 +
 +  code metapost
 +    rgbcolor fill_l_u_break;
 +    fill_l_u_break:=(1,1,1);
 +  endcode
 +
 +By default, the break line is set up for use along a horizontal passage. This follows the usual style used in the UK; two parallel lines, separated by a horizontal gap, with the tops and bottoms horizontally aligned (no matter whether the lines are drawn vertically or tilted at 45 degrees or more). If you are using it on a vertical section of cave, you can set the "-attr orientation vertical" option on the line. This will cause it to leave a vertical gap between the lines, and to align them horizontally compared with each other. This makes only a tiny difference when tilted at 45 degrees, but it looks better, and matches the normal style used in rigging topos.
 ====Area Symbols====  ====Area Symbols==== 
 ===Show area water in a different color=== ===Show area water in a different color===
Line 1875: Line 2196:
  
 A: Try this code: A: Try this code:
- 
-      def_transparent_rgb(tr_lgrey, 0.73, 0.71, 0.75); 
  
       def a_u_lgrey(expr P) =       def a_u_lgrey(expr P) =
         T:=identity;         T:=identity;
-        thfill P withtransparentcolor tr_lgrey;+        thfill P withcolor (0.7, 0.7, 0.7) withalpha 0.5;
       enddef;       enddef;
  
-There are a few predefined transparent colors, the most interesting of them is tr_bg (current scrap background). Standard opacity value (defined in the layout section) is applied. M. Budaj 
  
 ---- ----
Line 2243: Line 2561:
               thdraw tmp_pic scaled valscal rotatedaround(origin, -rot);               thdraw tmp_pic scaled valscal rotatedaround(origin, -rot);
   enddef;   enddef;
 +  
 +  
 +===Northarrow 5===
 +from Benedikt Hallinger for version 5.4.
 +This arrow is borrowed from an older wiki entry and was enhanced with the label box.
 +
 +It will display the north reference based on the `north <grid|true>` layout option ("ge.N" for true north and "gi.N" for grid-north).
 +It can also optionally display the meridian grid convergence, to enable just define the metapost variable `northArrowShowGridConvergence` in your layout.
 +
 +{{:metapost:northarrows-5.jpg|}}
 +
 +// distributed under the GNU General Public License.//
 +
 +  code metapost
 +    def s_northarrow (expr rot) =
 +      T:=identity scaled 1.0 rotated -rot;  % scale your north arrow here
 +      begingroup  % Arrow
 +        thdraw (-.5cm, -1cm)--(0, 1.5cm)--(.5cm, -1cm)--(0, -.5cm)--cycle;
 +        thfill (-.5cm, -1cm)--(0, 1.5cm)--(0, -.5cm)--cycle;
 +      endgroup;
 +      
 +      begingroup  % Text Label with box
 +        thfill ((-.6cm, -.35cm)--(-.6cm, .35cm)--(.6cm, .35cm)--(.6cm,-.35cm)--cycle) withcolor (1.0, 1.0, 1.0);
 +        thdraw  (-.6cm, -.35cm)--(-.6cm, .35cm)--(.6cm, .35cm)--(.6cm,-.35cm)--cycle;
 +        interim defaultscale:=1;
 +        newinternal string dirText; dirText:="ge.N";  if NorthDir="grid": dirText:="gi.N"; fi
 +        
 +        if known northArrowShowGridConvergence:
 +            label(dirText, (0, 0.12cm)) scaled 1.0 rotated -rot;
 +            label("GC=" & decimal GridConv & "°", (0, -0.30cm)) scaled 0.7 rotated -rot;
 +        else:
 +             label(dirText, (0, 0)) scaled 1.0 rotated -rot;
 +        fi
 +      endgroup;
 +      
 +    enddef;
 +  endcode
 +===Shaded Compass Rose pointing to the magnetic North===
 +from Juraj Halama for version 5.5.3
 +
 +{{:metapost:shadowed_rose.png?200|}}
 +
 +// distributed under the GNU General Public License.//
 +
 +  def s_northarrow (expr rot) =
 +    scale_value = 0.5;
 +    decl := MagDecl; 
 +    T := identity;
 +  
 +    picture tmp_pic;
 +    tmp_pic = image (
 +        pickup pencircle scaled 1;
 +        thdraw fullcircle scaled 4cm;
 +        thdraw fullcircle scaled 2.75cm;
 +        pickup pencircle scaled .5;
 +        thdraw fullcircle scaled 3.75cm;
 +        for whereto=11.25 step 22.5 until 360:
 +          thdraw dir(whereto)*2.75/2cm--dir(whereto)*3.75/2cm;
 +        endfor;
 +  % arrows
 +        path halfarrow;
 +        halfarrow = (+.3cm,.3cm)--(0,2cm)--(0,0)--cycle;
 +        for whereto = 45 step 90 until 315:
 +  %          thfill halfarrow scaled .85 rotated whereto withcolor .30;
 +          pickup pencircle scaled 1;
 +          for halfarrowgrad = 1 step -.05 until 0:
 +            thdraw ((halfarrowgrad*.3cm, halfarrowgrad*.3cm)--(0,2cm)) scaled .85 rotatedaround ((0, 0),whereto) withcolor .75halfarrowgrad;
 +          endfor;  
 +          pickup pencircle scaled .5;
 +          thdraw halfarrow scaled .85 rotated whereto;;
 +          thfill halfarrow xscaled -1 scaled .85 rotated whereto withcolor white;
 +          thdraw halfarrow xscaled -1 scaled .85 rotated whereto;;
 +        endfor;  
 +        for whereto = 0 step 90 until 270:
 +  %          thfill halfarrow scaled 1.15 rotated whereto withcolor .30;
 +          pickup pencircle scaled 1;
 +          for halfarrowgrad = 1 step -.05 until 0:
 +            thdraw ((halfarrowgrad*.3cm, halfarrowgrad*.3cm)--(0,2cm)) scaled 1.15 rotatedaround ((0, 0),whereto) withcolor .75halfarrowgrad;
 +          endfor;  
 +          pickup pencircle scaled .5;
 +          thdraw halfarrow scaled 1.15 rotated whereto;;
 +          thfill halfarrow xscaled -1 scaled 1.15 rotated whereto withcolor white;
 +          thdraw halfarrow xscaled -1 scaled 1.15 rotated whereto;;
 +        endfor;  
 +  % central circles
 +        thfill fullcircle scaled .56cm withcolor 1white;
 +        pickup pencircle scaled .5;
 +        thdraw fullcircle scaled .56cm;
 +        thfill fullcircle scaled .3cm withcolor .30;
 +  % characters
 +        label.bot(thTEX("\bf{}N") scaled 1.5, (0,2.9cm));
 +        label.lft(thTEX("\bf{}E") scaled 1.5, (2.9cm,0));
 +        label.rt (thTEX("\bf{}W") scaled 1.5, (-2.95cm,0));
 +        label.top(thTEX("\bf{}S") scaled 1.5, (0,-2.9cm));
 +  % space among characters
 +        pickup pencircle scaled .5;
 +        thdraw (dir(45)*2cm)--(dir(45)*2.5cm);
 +        thdraw (dir(135)*2cm)--(dir(135)*2.5cm);
 +        thdraw (dir(225)*2cm)--(dir(225)*2.5cm);
 +        thdraw (dir(315)*2cm)--(dir(315)*2.5cm);
 +    );
 +    
 +    thdraw tmp_pic scaled scale_value rotatedaround (origin, - rot);
 +  enddef;
 +
  
 ====Scalebars==== ====Scalebars====
Line 2304: Line 2727:
       endgroup;       endgroup;
     enddef;     enddef;
 +
 +===Scalebar 2b===
 +By B. Hallinger; This is the same scalebar from above, except that it subdivides the first block.
 +
 +{{:metapost:s_scalebar-2b.png}}
 +
 +  code metapost
 +    def s_scalebar (expr l, units, txt) =
 +    % l = value of scale-bar length
 +    % units = ??
 +    % txt = string representing units
 +      begingroup
 +        interim warningcheck:=0;
 +        tmpl:=l / Scale * cm * units / 2;
 +        % tmpl = half plotted length of scale bar from central top insertion point  
 +        tmpx:=l / Scale * cm * units / 5;
 +        tmph:=5bp; % bar height
 +      endgroup;
 +      pickup PenC;
 +      draw (-tmpl,0)--(tmpl,0)--(tmpl,-tmph)--(-tmpl,-tmph)--cycle;
 +      p:=(0,0)--(tmpx,0)--(tmpx,-tmph)--(0,-tmph)--cycle;
 +      for i:=-0.5 step 2 until 2:   % start drawing at the third block (leave space for smaller divisions)
 +        fill p shifted (i * tmpx,0);
 +      endfor;
 +      
 +      % Draw first part with subdivided blocks
 +      p:=(0,0)--(tmpx/5,0)--(tmpx/5,-tmph)--(0,-tmph)--cycle;  % define width of segment (tmpx is length of a normal bar segment)
 +      for i:=-2.5 step 2/5 until -0.75:                        % Startpos, segments, count-index
 +        fill p shifted (i * tmpx,0) withcolor black;
 +      endfor;
 +      
 +      % Label of scale: Scalebar top, values below
 +      begingroup
 +        interim labeloffset:=3.5bp;
 +        for i:=0 step (l/5) until (l-1):
 +          tmpx:=tmpl * (i * 2 / l - 1);
 +          label.bot(thTEX(decimal (i)),(tmpx,-tmph));
 +        endfor;
 +        label.bot(thTEX(decimal (l) & "\thinspace" & txt),(tmpl,-tmph));
 +        label.top(thTEX("Ma\char25 stab 1 : " & decimal round(Scale*100)),(0,0));
 +      endgroup;
 +      
 +    enddef;
 +  endcode
 +
  
 ===Scalebar Bar length adjustment=== ===Scalebar Bar length adjustment===
Line 2370: Line 2838:
  endcode  endcode
   endlayout LayoutScalebar3   endlayout LayoutScalebar3
 +  
 +===Vertical scalebar===
 +{{:metapost:vajsablova_500.png|Vajsablova aven, Slovakia}}
 +by Juraj Halama for version 5.5.3...
 +
 +// distributed under the GNU General Public License.//
 +
 +  layout mapa_ext_500
 +  
 +    scale-bar 170 m 
 +    % layout for map
 +    copy mapa   
 +    overlap 0 cm
 +    
 +    code metapost
 +      
 +      def s_scalebar (expr l, units, txt) = 
 +        begingroup
 +          tmpw = 3.0 bp;
 +          tmp5m = 5 / Scale * units * cm;
 +          tmpl = l / Scale * units * cm;
 +        endgroup;
 +        p := (0, 0) -- (tmpw, 0) -- (tmpw, - tmp5m) -- (0, - tmp5m) -- cycle; 
 +        pickup PenD;
 +        for i := 0 step 1 until (l - 1) / 5:
 +          if (i mod 2) <> 0:
 +            unfill p shifted - (0, i * tmp5m);
 +          else:
 +            fill p shifted - (0, i * tmp5m);
 +          fi;
 +          draw p shifted - (0, i * tmp5m);
 +        endfor;    
 +        pickup PenA
 +        %  draw (-tmpw, 0) -- (tmpw, 0);
 +        %  draw (-tmpw, -tmpl) -- (0, -tmpl);
 +        fill (-2tmpw, tmpw) -- (-2tmpw, -tmpw) -- (0, 0) -- cycle;
 +        fill (-2tmpw, -tmpl + tmpw) -- (-2tmpw, -tmpl + -tmpw) -- (0, -tmpl) -- cycle;
 +        if ((l mod 10) > 5) or ((l mod 10) = 0):
 +          draw (0, - tmpl) -- (tmpw, - tmpl) withcolor black;
 +        else:  
 +          draw (0, - tmpl) -- (tmpw, - tmpl) withcolor white;
 +        fi;       
 +        begingroup
 +          interim labeloffset:=3.5bp + tmpw;
 +          %    interim defaultscale:=0.5;
 +          label.rt(thTEX("\size[12]" & "0{\thinspace}m"),(0, 0));
 +          for i := 1 step 1 until l / 5:
 +            if (i mod 10) = 0:
 +              label.rt(thTEX("\size[12]" & "-\thinspace" & decimal (i * 5)),(0, - i * tmp5m));
 +            else:
 +              if i * 5 = l:
 +                label.rt(thTEX("\size[12]" & "-\thinspace" & decimal (i * 5)),(0, - i * tmp5m));
 +              else:  
 +                label.rt(thTEX("\size[8]" & "-\thinspace" & decimal (i * 5)),(0, - i * tmp5m));
 +              fi  
 +            fi;  
 +          endfor;
 +          if (l mod 5) <> 0:
 +            label.rt(thTEX("\size[12]" & "-\thinspace" & decimal (l)),(0, - tmpl));
 +          fi;
 +        endgroup
 +      enddef;
 +                         
 +    endcode
 +  
 +    code tex-map
 +  
 +      \def\maplayout{
 +        \legendbox{102.5}{100.4}{NW}
 +        {
 +        \scalebar
 +        }  
 +      }
 +    endcode  
 +    
 +  endlayout
 ====Gridlines==== ====Gridlines====
 ===Change grid symbols from cross hairs to continuous lines=== ===Change grid symbols from cross hairs to continuous lines===
Line 2381: Line 2925:
       ) -- (       ) -- (
         if xpos > 0: 0 else: xsize/2 fi, 0         if xpos > 0: 0 else: xsize/2 fi, 0
-      ) withcolor 0.1black+0.5white;+      ) withcolor 0.2[black,white];
       draw (       draw (
         0, if ypos < 0: 0 else: -ysize/2 fi         0, if ypos < 0: 0 else: -ysize/2 fi
       ) -- (       ) -- (
         0, if ypos > 0: 0 else: ysize/2 fi         0, if ypos > 0: 0 else: ysize/2 fi
-      ) withcolor 0.1black+0.5white;+      ) withcolor 0.2[black,white];
     enddef;     enddef;
     endcode     endcode
Line 2476: Line 3020:
       thclean Path;       thclean Path;
       pickup PenD;       pickup PenD;
-      if known colour_sump_bg:  thfill Path withcolor colour_sump_bg; else: thfill Path withcolor 0.7white; fi;+      if known colour_sump_bg:  thfill Path withcolor colour_sump_bg; else: thfill Path withcolor 0.7[white,black]; fi;
       thfill Path withpattern pattern_sump;         thfill Path withpattern pattern_sump;  
       %%thdraw Path;  %outline, not needed as area drawn is defined by line border anyway       %%thdraw Path;  %outline, not needed as area drawn is defined by line border anyway
Line 2491: Line 3035:
     T:=identity;     T:=identity;
     pickup pensquare scaled (1.0*u/10);     pickup pensquare scaled (1.0*u/10);
-    if known colour_rope: thdraw P withcolor colour_rope; else: thdraw P withcolor 0.1black+0.5white;+    if known colour_rope: thdraw P withcolor colour_rope; else: thdraw P withcolor 0.2[white,black];
     fi;     fi;
     pickup PenC;     pickup PenC;
Line 2567: Line 3111:
 Comment it out when you want black and white. Comment it out when you want black and white.
  
----- +=====Symbols for plan and extended elevation===== 
-----+ 
 +Juraj Halama 2020 for Therion 5.5.3\\ 
 + 
 +{{:metapost:symbol_plan.png?112|symbol plan}}{{:metapost:symbol_extended.png?88|symbol extended}} 
 + 
 +It is not a regular point due to its size, but all the features of points are working... 
 + 
 +  def p_u_symbol_plan (expr pos,theta,sc,al) = 
 +    U := (-3.25u, 3.25u); 
 +    T := identity aligned al rotated theta scaled sc shifted pos; 
 +    pickup PenB; 
 +    q := ((-3.26u, -.95u) -- (1.74u, -.95u) -- (2.8u, .82u) -- (-1.49u, .82u) -- cycle); 
 +    thfill q withcolor .85; 
 +    thdraw q; 
 +    q := ((-.175u, .5u) -- (0u, 0u) -- (.175u, .5u) .. (0u, .45u) .. cycle); 
 +    thfill q withcolor .5green; 
 +    thdraw q withcolor .5green; 
 +    thdraw (0u, 0u) -- (0u, 2.31u) withcolor .5green;  
 +  enddef; 
 + 
 +  def p_u_symbol_extend (expr pos,theta,sc,al) = 
 +    U := (-2.5u, 2.5u); 
 +    T := identity aligned al rotated theta scaled sc shifted pos; 
 +    pickup PenB; 
 +    q := ((-2.346u, -2.480u) -- (-.48u, -2.116u) -- (-.48u, 1.573u) -- (-2.346u, 1.354u) -- cycle); 
 +    thfill q withcolor .85; 
 +    q := ((-1.551u, -2.878u) -- (1.438u, -.766u) -- (1.438u, 2.388u) -- (-1.551u, 1.118u) -- cycle); 
 +    thfill q withcolor .75; 
 +    thdraw q; 
 +    thdraw (-.48u, -2.116u) -- (-.48u, 1.573u) dashed evenly; 
 +    q := ((.446u, -1.461u) -- (2.120u, -1.094u) -- (2.120u, 2.184u) -- (.446u, 1.965u) -- cycle); 
 +    thfill q withcolor .85; 
 +    thdraw (.446u, -1.461u) -- (.446u, 1.965u) dashed evenly; 
 +    q := ((-.175u, .5u) -- (0u, 0u) -- (.175u, .5u) .. (0u, .45u) .. cycle) rotated -90; 
 +    thfill q withcolor .5green; 
 +    thdraw q withcolor .5green; 
 +    thdraw (0u, 0u) -- (2.31u, 0u) withcolor .5green;  
 +  enddef; 
 + 
 +...and do not forget to remove it from legend: 
 + 
 +  text sk "point u:symbol_plan" "" 
 +  text sk "point u:symbol_extend" "" 
  
  • metapost.1575152097.txt.gz
  • Last modified: 4 years ago
  • by tarquinwj