Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
metapost [2019/11/30 23:14] – [Line Symbols] tarquinwj | metapost [2020/03/01 22:58] – [Adding custom styled labels at any point/linepoint] tarquinwj | ||
---|---|---|---|
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 " | 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 " | ||
+ | |||
+ | [[user: | ||
< | < | ||
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: | + | [[user: |
< | < | ||
code metapost | code metapost | ||
vardef create_styled_label (expr plaintext, | vardef create_styled_label (expr plaintext, | ||
- | save textsize, style; | + | save textsize, style, thetext; |
string textsize; | string textsize; | ||
if S = 0.5: | if S = 0.5: | ||
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 " | ||
+ | |||
+ | Use " | ||
+ | |||
+ | 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' | ||
+ | |||
+ | < | ||
+ | code metapost | ||
+ | vardef create_styled_label (expr plaintext, | ||
+ | save textsize, style, thetext, sufx, athick; | ||
+ | string textsize; | ||
+ | if S = 0.5: | ||
+ | textsize: | ||
+ | elseif S = 0.7: | ||
+ | textsize: | ||
+ | elseif S = 1.4: | ||
+ | textsize: | ||
+ | elseif S = 2: | ||
+ | textsize: | ||
+ | else: % normal is 1 | ||
+ | textsize: | ||
+ | fi; | ||
+ | if known ATTR_labelstyle: | ||
+ | style: | ||
+ | else: | ||
+ | style: | ||
+ | fi; | ||
+ | picture thetext; | ||
+ | thetext: | ||
+ | % store the alignment suffix as a string, it will be turned back into a suffix with scantokens | ||
+ | string sufx; | ||
+ | if A = (-1,1): | ||
+ | sufx: | ||
+ | elseif A = (0,1): | ||
+ | sufx: | ||
+ | elseif A = (1,1): | ||
+ | sufx: | ||
+ | elseif A = (-1,0): | ||
+ | sufx: | ||
+ | elseif A = (1,0): | ||
+ | sufx: | ||
+ | elseif A = (-1,-1): | ||
+ | sufx: | ||
+ | elseif A = (0,-1): | ||
+ | sufx: | ||
+ | elseif A = (1,-1): | ||
+ | sufx: | ||
+ | else: | ||
+ | sufx: | ||
+ | fi; | ||
+ | if style >= 100: | ||
+ | % create the label, passing the alignment as a suffix | ||
+ | lab: | ||
+ | % process_label looks for a variable called " | ||
+ | process_label(P, | ||
+ | % define all the different ornamentations that you want | ||
+ | if style = 100: | ||
+ | pickup PenA; | ||
+ | athick: | ||
+ | % make bounding box measurements temporarily be larger than the object being measured | ||
+ | % " | ||
+ | % sure it gets reset to default correctly afterwards | ||
+ | interim bboxmargin: | ||
+ | % 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, | ||
+ | fi; | ||
+ | enddef; | ||
+ | endcode | ||
+ | </ | ||
=====Replacing legend drawings for existing symbols===== | =====Replacing legend drawings for existing symbols===== | ||
Line 436: | Line 512: | ||
The default " | The default " | ||
- | 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 |
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: | + | [[user: |
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: | + | |
- | | + | save scale, cthick, pointheight, |
- | pointheight: | + | |
- | pointwidth: | + | |
- | U: | + | pointheight: |
- | T:=identity aligned A rotated (R-20) scaled S shifted P; | + | pointwidth: |
- | % a circle | + | |
- | thdraw fullcircle scaled 2scale withpen PenC withcolor black; | + | cutwidth: |
- | % filled triangle | + | |
- | thfill (0, | + | T:=identity aligned A rotated (R-20) scaled S shifted P; |
- | % black triangle outline | + | % a circle |
- | | + | thdraw fullcircle scaled 2scale withpen PenC; |
- | thdraw | + | % filled triangle |
- | % spin arcs, a full circle is path 0-8, anticlockwise, | + | thfill (0, |
- | 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/ | ||
+ | thfill | ||
+ | % spin arcs, a full circle is path 0-8, anticlockwise, | ||
+ | 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(" | initsymbol(" | ||
Line 609: | Line 692: | ||
[[user: | [[user: | ||
- | 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/ | + | A common way to show rope lengths (at least in the UK) on [[riggingtopos|Rigging topos]] |
< | < | ||
Line 987: | Line 1070: | ||
[[user: | [[user: | ||
- | 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 | + | 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 |
< | < | ||
Line 1010: | Line 1093: | ||
[[user: | [[user: | ||
- | 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 | + | 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 |
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 [[# | 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 [[# | ||
Line 1054: | Line 1137: | ||
[[user: | [[user: | ||
- | For rigging | + | For [[riggingtopos|Rigging |
< | < | ||
Line 1207: | Line 1290: | ||
[[user: | [[user: | ||
- | Trees are often found in the entrances to caves, and sometimes a survey deserves to show the trees. This is particularly common with rigging | + | 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 |
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 1392: | ||
{{ :: | {{ :: | ||
- | Select these as line type " | + | Select these as line type " |
text en "line u: | text en "line u: | ||
Line 1325: | Line 1408: | ||
[[user: | [[user: | ||
- | 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 " | + | 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 " |
< | < | ||
Line 1361: | Line 1444: | ||
text en "line u: | text en "line u: | ||
+ | |||
+ | ===Centreline that is only visible when not in a scrap=== | ||
+ | |||
+ | [[user: | ||
+ | |||
+ | 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# | ||
+ | |||
+ | < | ||
+ | code metapost | ||
+ | def l_survey_cave_MY(expr P) = | ||
+ | if ATTR__scrap_centerline: | ||
+ | l_survey_cave_SKBB(P); | ||
+ | fi; | ||
+ | enddef; | ||
+ | initsymbol(" | ||
+ | endcode | ||
+ | </ | ||
+ | |||
+ | You may notice the misleadingly named " | ||
+ | |||
+ | 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, | ||
+ | |||
+ | ===Break line=== | ||
+ | |||
+ | [[user: | ||
+ | |||
+ | 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 " | ||
+ | |||
+ | code metapost | ||
+ | def l_u_break(expr P)= | ||
+ | begingroup; | ||
+ | save mainpath, parallel, orientation, | ||
+ | T: | ||
+ | gapsize: | ||
+ | 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 orientation = " | ||
+ | direction: | ||
+ | parallel: | ||
+ | else: | ||
+ | direction: | ||
+ | parallel: | ||
+ | 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(" | ||
+ | def l_u_break_legend = | ||
+ | l_wall_bedrock(((0, | ||
+ | l_wall_bedrock(((.7, | ||
+ | l_u_break(((.6, | ||
+ | enddef; | ||
+ | endcode | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Select this as line type " | ||
+ | |||
+ | Use it with this line in your layout: | ||
+ | |||
+ | text en "line u: | ||
+ | |||
+ | 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, | ||
+ | |||
+ | You cannot use "color fill_l_u_break;" | ||
+ | |||
+ | code metapost | ||
+ | rgbcolor fill_l_u_break; | ||
+ | fill_l_u_break: | ||
+ | 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" | ||
====Area Symbols==== | ====Area Symbols==== | ||
===Show area water in a different color=== | ===Show area water in a different color=== |