Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| metapost [2012/06/17 11:39] – typo sluka | metapost [2024/11/17 06:04] (current) – [Area Symbols] add link to https://colorcodes.io brucemutton | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ...is code to define what the labels and cave symbols in pdf and svg outputs look like. | ...is code to define what the labels and cave symbols in pdf and svg outputs look like. | ||
| - | >>>> | + | >>> |
| + | |||
| + | [[http:// | ||
| + | [[http:// | ||
| + | [[http:// | ||
| + | [[http:// | ||
| + | [[http:// | ||
| + | [[http:// | ||
| + | [[http:// | ||
| + | or: [[http:// | ||
| + | [[http:// | ||
| + | [[http:// | ||
| + | [[http:// | ||
| + | |||
| + | ==== Previewers ==== | ||
| + | |||
| + | [[http:// | ||
| + | [[http:// | ||
| If you are brave Marco has written more than I ever wanted to know here [[tbe: | If you are brave Marco has written more than I ever wanted to know here [[tbe: | ||
| + | |||
| + | ====How to create metapost for new symbols==== | ||
| + | Adapted from advice by Nikita Kozlov and Martin Sluka | ||
| + | - Create a new symbol with your favorite vector graphics editor, | ||
| + | - Save results to .eps format, and then | ||
| + | - Use [[http:// | ||
| + | - Adapt the code to work with Therion (Refer to [[http:// | ||
| + | - Compile a test map and admire your work. | ||
| + | A limitation is that pstoedit converts only to polylines. It does not create ' | ||
| + | Another way is to draw your symbol on graph paper and then create Metapost code for straight or smooth curved lines. | ||
| + | Both approaches will in due course require you to learn some Metapost!\\ | ||
| + | You may check the very basic tutorial of Metapost here: | ||
| + | |||
| + | |||
| + | ===Implementing redefined metapost examples (Bruce Mutton)=== | ||
| + | [[templates# | ||
| ====How to get Therions MetaPost code (and Tex code)==== | ====How to get Therions MetaPost code (and Tex code)==== | ||
| Line 40: | Line 74: | ||
| ---- | ---- | ||
| - | ====Symbol Sizing==== | + | ====Symbol Sizing |
| On Sun, Feb 7, 2010 Bruce wrote: | On Sun, Feb 7, 2010 Bruce wrote: | ||
| - | > Is u: (and v: w: for that matter) intended to correspond to a | + | > Is u (and v w for that matter) intended to correspond to a |
| > particular drawn entity size in the finished pdf, or are they just | > particular drawn entity size in the finished pdf, or are they just | ||
| > arbitrary variables for which one can calculate the value of, using | > arbitrary variables for which one can calculate the value of, using | ||
| Line 48: | Line 82: | ||
| > Bruce | > Bruce | ||
| - | **u** allows nonlinear scaling of symbols depending on scale. The macro initialize assigns a fixed value to ' | + | **u** allows nonlinear scaling of symbols depending on scale. The macro initialize assigns a fixed value to ' |
| - | **v** and **w** behave differently (v could be used e.g. for some area fills with decreasing distance among symbols for smaller scales but only up to a certain threshold, then bigger distance again; w is almost constant). Currently they are not (or perhaps only occasionaly) used in symbols design. | + | **v** and **w** behave differently (v could be used e.g. for some area fills with decreasing distance among symbols for smaller scales but only up to a certain threshold, then bigger distance again; w is almost constant). Currently they are not (or perhaps only occasionally) used in symbols design. |
| In the beginning we wanted to do some sort of optimization of values assigned to u, v, w but did not manage to do it so far. It would be useful if somebody could test alternative values (and alternative breaks for map scale in the initialize macro) for various scales and various styles of map drawing (lot of symbols vs. sparsely filled map). Good setup of these values could improve map appearance substantially. | In the beginning we wanted to do some sort of optimization of values assigned to u, v, w but did not manage to do it so far. It would be useful if somebody could test alternative values (and alternative breaks for map scale in the initialize macro) for various scales and various styles of map drawing (lot of symbols vs. sparsely filled map). Good setup of these values could improve map appearance substantially. | ||
| Line 59: | Line 93: | ||
| ---- | ---- | ||
| + | Refer to the section **New Map Symbols**, **Point Symbols** in The Therion Book. | ||
| + | |||
| + | If you want your custom point symbol to be able to be aligned, rotated or scaled by users according to options set in th2 drawing files, then your '' | ||
| + | |||
| + | * Symbol coordinates (0u, 0u) are the origin point for that symbol. | ||
| + | |||
| + | * Your symbols should generally be defined so that they fit within the size range -0.5u to +0.5u in both x and y axes, although you can use larger or smaller values in either dimension. | ||
| + | |||
| + | This image is a symbol that has been defined with maximum x and y coordinates, | ||
| + | |||
| + | {{: | ||
| + | |||
| + | |||
| + | |||
| + | The symbol alignment option relies on the definition of a U: variable, otherwise your symbol will cause an error and stop Therion if a user sets an alignment option other than '' | ||
| + | * U: is a scaling factor for alignment parameters, such as right, top or top-right. | ||
| + | U: defines the size of the x horizontal (left-right) and y vertical (up-down) offset when a symbol is aligned, so the x and y components of U: should be set to be around the maximum absolute value of x and y symbol coordinates, | ||
| + | |||
| + | * If a U: component is smaller than a maximum corresponding symbol coordinate, an aligned symbol will overlap the insertion point. | ||
| + | * If a U: component is larger than a maximum corresponding symbol coordinate, an aligned symbol will have a gap from the insertion point. | ||
| + | * If your symbol has its greatest dimension on a diagonal, then you should increase the U: components accordingly, | ||
| + | |||
| + | As one 'use case' for aligning symbols is to enable them to be placed ‘near’ to another symbol, and be always positioned appropriately at a variety of output scales, I am going to suggest that U: components for user friendly point symbols should always be just a little greater than half the symbol dimension. | ||
| + | |||
| + | When writing a new point symbol and testing that it aligns and rotates nicely, it can be a bit tricky to figure out where the origin, insertion point, and alignment loci are located. | ||
| + | |||
| + | Here it is inserted into an electric light symbol definition. | ||
| + | |||
| + | After writing the code, I realised that this symbol was in fact larger than 0.7u in the y direction, therefore the U: variable is not tall enough, the symbol is not centered around around its (0u,0u) coordinates (which might be OK if you want the space below the luminaire to be part of the ' | ||
| + | |||
| + | < | ||
| + | def p_u_electriclight (expr pos, | ||
| + | U:=(0.7u, 0.7u); | ||
| + | % Reduce size of the symbol. | ||
| + | interim defaultscale: | ||
| + | T:=identity rotated theta aligned al scaled defaultscale shifted pos; %corrected to rotate THEN align | ||
| + | | ||
| + | % % % SYMBOL PARAMETER INDICATOR (origin, insertion, alignment box, u box) | ||
| + | % Placing this code directly after T:= identity line will put the indicators under the symbol | ||
| + | % Placing this code immediately before enddef will put the indicators over top of the symbol | ||
| + | % Before use you need to correctly assign the parsed variable aliases in the next two rows from the def statement above | ||
| + | rotation:= theta; | ||
| + | pair alignment; alignment:= al; %set this to the last parsed variable (ie al) | ||
| + | | ||
| + | % show symbol origin, (0,0) red | ||
| + | thdraw fullcircle scaled 0.15u withpen PenD withcolor red; | ||
| + | % show symbol insertion point, (0,0) green | ||
| + | thdraw fullcircle shifted -(xpart alignment * xpart U, ypart alignment * ypart U) rotated -rotation withpen PenD withcolor green; | ||
| + | % show U alignment box light blue | ||
| + | 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.5[blue, | ||
| + | % show u box grey | ||
| + | thdraw unitsquare scaled u shifted (-0.5u, -0.5u) withpen PenD withcolor 0.2[black, | ||
| + | % % % | ||
| + | | ||
| + | pickup PenC; | ||
| + | thdraw fullcircle scaled 0.5u shifted (0.0u, 0.7u); | ||
| + | thdraw (-0.5u, -0.6u) -- (-0.5u, 0.0u); | ||
| + | thdraw (-0.5u, 0.0u) .. (-0.35u, 0.55u) .. (0.0u, 0.7u); | ||
| + | thdraw (0.0u, 0.7u) .. (0.35u, 0.55u) .. (0.5u, 0.0u); | ||
| + | thdraw (0.5u,0.0u) -- (0.5u, -0.6u); | ||
| + | thdraw (-0.7u, -0.6u) -- (0.7u, -0.6u); | ||
| + | enddef; | ||
| + | </ | ||
| + | |||
| + | |||
| + | Here is an example with the above point symbol that has been redefined with three different U: settings, and inserted with '' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | The smudgy line is intended to represent an object that the alignment is intended to avoid, ie a wall. You can see that U: = symbol dimension is OK, but U:= smaller than symbol dimension is probably what most users would want to avoid. | ||
| + | |||
| + | I'm going to suggest that the best values for U: components are between [U/u=1.0] to [U/u=1.2] | ||
| + | |||
| + | An here are some examples with a slightly improved U: variable, with the symbol aligned top-right and oriented 30 degrees, and the output rotated 15, 105, 195, 285 degrees. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | And one last example, using '' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Bruce | ||
| + | |||
| + | =====Setting pen thicknesses===== | ||
| + | |||
| + | 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: | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def minimumpen = 0.18pt enddef; | ||
| + | def PenA = pencircle scaled (minimumpen*1/ | ||
| + | def PenB = pencircle scaled (minimumpen*0.7/ | ||
| + | def PenC = pencircle scaled (minimumpen*0.5/ | ||
| + | def PenD = pencircle scaled (minimumpen) enddef; | ||
| + | def PenX = pencircle scaled (minimumpen*1.2/ | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | =====Adding custom styled labels at any point/ | ||
| + | |||
| + | Therion does not offer any way to add custom styled labels to inputs - labels are created by various dedicated point symbols. Although you can call some of the internal macros to produce labels, it can be difficult to work out exactly what macro names to call to get it to align correctly, and certain features, such as setting the scaling, require you to modify the TEX rather than the MetaPost. | ||
| + | |||
| + | This function simplifies it all. Add it once, and then any of your custom points can call it to add a label. | ||
| + | |||
| + | [[user: | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | vardef create_styled_label (expr plaintext, | ||
| + | save textsize, style, thetext; | ||
| + | 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: | ||
| + | if A = (-1,1): | ||
| + | p_label.ulft(thetext, | ||
| + | elseif A = (0,1): | ||
| + | p_label.top(thetext, | ||
| + | elseif A = (1,1): | ||
| + | p_label.urt(thetext, | ||
| + | elseif A = (-1,0): | ||
| + | p_label.lft(thetext, | ||
| + | elseif A = (1,0): | ||
| + | p_label.rt(thetext, | ||
| + | elseif A = (-1,-1): | ||
| + | p_label.llft(thetext, | ||
| + | elseif A = (0,-1): | ||
| + | p_label.bot(thetext, | ||
| + | elseif A = (1,-1): | ||
| + | p_label.lrt(thetext, | ||
| + | else: | ||
| + | p_label(thetext, | ||
| + | fi; | ||
| + | enddef; | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | Call it like this: | ||
| + | |||
| + | < | ||
| + | create_styled_label(text, | ||
| + | </ | ||
| + | |||
| + | Style meanings: | ||
| + | * 0 = basic label | ||
| + | * 1 = label with a dot marker | ||
| + | * 2 = semi circle up | ||
| + | * 3 = semi circle down | ||
| + | * 4 = semi circle up and semi circle down | ||
| + | * 5 = circle | ||
| + | * 6 = box | ||
| + | * 7 = basic label with extra offset | ||
| + | * 8 = supposed to be a filled label, but doesn' | ||
| + | |||
| + | There are also some constants like p_label_mode_label which can be used instead if you prefer (and you trust that they will never change). Search the Metapost debug output for these. | ||
| + | |||
| + | Each symbol can individually override its label styling by setting the "-attr labelstyle 6" option - the function will check for it, and use that other style if an option is selected. | ||
| + | |||
| + | 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===== | ||
| + | |||
| + | When defining a new symbol, you will normally want it to appear nicely in the legend. By default, Therion puts a single point in the centre for point symbols, and a wavy line for line symbols, and a filled rectangle for area symbols. Normally this is fine, but sometimes it does not show off all of the features that you would like to. With custom " | ||
| + | |||
| + | This is an example of how Therion calls it: | ||
| + | |||
| + | < | ||
| + | beginfig(164); | ||
| + | clean_legend_box; | ||
| + | p_u_foo_legend; | ||
| + | draw_legend_box; | ||
| + | endfig; | ||
| + | </ | ||
| + | |||
| + | When you define a new version of an existing symbol (such as p_anchor_MY), | ||
| + | |||
| + | < | ||
| + | beginfig(161); | ||
| + | clean_legend_box; | ||
| + | drawoptions(); | ||
| + | p_anchor((0.5, | ||
| + | draw_legend_box; | ||
| + | endfig; | ||
| + | </ | ||
| + | |||
| + | You can detect this default coordinate in your point/line symbol code, and respond differently. But it is entirely possible for a legitimate point in your survey to match " | ||
| + | |||
| + | There is no other way to ask "is this code running inside the legend" | ||
| + | |||
| + | However, you can rewrite the clean_legend_box macro to store a flag, which you can check in your point code to see if it is running inside one of those legend sections. Legends are always created as the last step, so even though that flag will get left forever, it will not be mistaken in non-legend code. | ||
| + | |||
| + | [[user: | ||
| + | |||
| + | < | ||
| + | boolean p_anchor_MY_inlegend; | ||
| + | p_anchor_MY_inlegend: | ||
| + | % store the original clean_legend_box | ||
| + | let p_anchor_MY_legend_box = clean_legend_box; | ||
| + | % redefine clean_legend_box to store the flag, then run the original | ||
| + | def clean_legend_box = | ||
| + | p_anchor_MY_inlegend: | ||
| + | p_anchor_MY_legend_box; | ||
| + | enddef; | ||
| + | def p_anchor_MY (expr P,R,S,A)= | ||
| + | if p_anchor_MY_inlegend: | ||
| + | % this is the legend - make sure the function works normally again | ||
| + | p_anchor_MY_inlegend: | ||
| + | % draw a pretty legend | ||
| + | p_anchor_MY((.7, | ||
| + | else: | ||
| + | % ... do the regular stuff | ||
| + | fi; | ||
| + | enddef; | ||
| + | </ | ||
| + | |||
| + | While this does run the risk that the Therion code may change so that the macro cannot be replaced in this way, for now it appear to be the most reliable way to create custom legend items for these symbols. Use it at your discretion (it is used in some of the examples below). | ||
| =====General Symbol Examples===== | =====General Symbol Examples===== | ||
| For example; centrelines, | For example; centrelines, | ||
| - | **View whole centerline | + | ====Point Symbols==== |
| + | ===Define a user point symbol | ||
| + | [[http:// | ||
| + | {{: | ||
| - | If you wish to view whole centerline for underground, just redefine symbol in layout: | + | def p_u_boss (expr pos,theta, |
| + | T:=identity aligned al rotated theta scaled sc shifted pos; | ||
| + | pickup PenD; | ||
| + | p := (0.08u, | ||
| + | q := (0.16u, | ||
| + | for i=0 upto 9: | ||
| + | | ||
| + | | ||
| + | endfor | ||
| + | p := fullcircle scaled 0.15u; | ||
| + | thdraw p; | ||
| + | enddef; | ||
| - | code mpost | + | ===Define an entrance symbol as a theta inside a diamond=== |
| - | let l_survey_cave | + | [[http:// |
| - | | + | {{: |
| + | |||
| + | def p_entrance_MY (expr pos, | ||
| + | U: | ||
| + | T:=identity aligned al rotated theta scaled sc shifted pos; | ||
| + | path p; | ||
| + | p = (-.3u, | ||
| + | thdraw p withpen PenA; | ||
| + | thdraw unitsquare scaled u shifted (-0.5u, | ||
| + | enddef; | ||
| + | |||
| + | |||
| + | ===Define a user point symbol for a single large irregular block=== | ||
| + | [[http:// | ||
| + | |||
| + | {{: | ||
| + | def p_u_block(expr pos, | ||
| + | T:=identity aligned al rotated theta scaled sc shifted pos; | ||
| + | path p q; | ||
| + | p := (2.3u, | ||
| + | pickup PenB; | ||
| + | thdraw p; | ||
| + | % The following line uses the code from Colour Dependant Visualization of Symbols by Bruce Mutton | ||
| + | if known colour_block_bg: | ||
| + | q := (-2.5u, | ||
| + | thdraw q; | ||
| + | thfill q withcolor(0.6, | ||
| + | pickup PenD; | ||
| + | path p; | ||
| + | p := (-2u, | ||
| + | thdraw p; | ||
| + | path p; | ||
| + | p := (0.6u, | ||
| + | thdraw p; | ||
| + | path p; | ||
| + | p := (2.1u, | ||
| + | thdraw p; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | |||
| + | ===Point - Artificial Electric Light=== | ||
| + | Bill Gee | ||
| + | # This code defines an artificial electric light. | ||
| + | # by Bill Gee May 2019 | ||
| + | def p_u_electriclight (expr pos, | ||
| + | U:=(0.3u, 0.3u); | ||
| + | % Reduce size of the symbol. | ||
| + | interim defaultscale: | ||
| + | T:=identity aligned al rotated theta scaled defaultscale shifted pos; | ||
| + | pickup PenC; | ||
| + | | ||
| + | thdraw fullcircle scaled 0.5u shifted (0.0u, 0.7u); | ||
| + | thdraw (-0.5u, -0.6u) -- (-0.5u, 0.0u); | ||
| + | thdraw (-0.5u, 0.0u) .. (-0.35u, 0.55u) .. (0.0u, 0.7u); | ||
| + | thdraw (0.0u, 0.7u) .. (0.35u, 0.55u) .. (0.5u, 0.0u); | ||
| + | thdraw (0.5u,0.0u) -- (0.5u, -0.6u); | ||
| + | thdraw (-0.7u, -0.6u) -- (0.7u, -0.6u); | ||
| + | | ||
| + | enddef; | ||
| ---- | ---- | ||
| - | **How to show area water in a different color (Martin Budaj)** | ||
| - | Add in layout: | + | ===Shell limestone=== |
| - | + | Point symbol for shell limestone: | |
| - | code metapost | + | |
| - | def a_water (expr p) = | + | |
| - | T:=identity; | + | |
| - | thfill p withcolor (0.1, 0.2, 0.8); | + | |
| - | enddef; | + | |
| - | endcode | + | |
| - | Colors are in order R, G, B --- 0=0 1=255. Color (0.1, 0.2, 0.8) means (25 51 204) in Photoshop - quite dark blue. Light blue could be for example (123 213 255) in Photoshop - it is (123/255, 213/255, 255/255) or (0.48, 0.84 1.0) for Metapost. | + | {{: |
| - | See also [[tips#RGB to Therion Colour Mapping Calculator|this spreadsheet]] to visualise and convert between colour formats. | + | def p_u_shell (expr pos, |
| + | T:=identity shifted pos; | ||
| + | pickup PenB; | ||
| + | numeric turns, radius; | ||
| + | path ss, cesta; | ||
| + | pair za, zb; | ||
| + | turns = 1.55; | ||
| + | radius = .3u; | ||
| + | za = ( xpart(origin)+0, | ||
| + | zb = ( xpart(origin)+.3u, | ||
| + | cesta := za--zb; | ||
| + | ss := (origin for t=1 upto 360 turns: -- dir t scaled t endfor) scaled (radius/ | ||
| + | thdraw ss withcolor (0.3); | ||
| + | thdraw (cesta cutbefore ss) withcolor (0.3); | ||
| + | enddef; | ||
| + | ===P-hangers that face the right way, and other anchor designs=== | ||
| - | **Green colored continuous centerline** | + | [[user: |
| + | |||
| + | The default " | ||
| + | |||
| + | 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: | ||
| + | | ||
| + | | ||
| + | * "-attr type ropedp" | ||
| + | * "-attr type fixed" shows a filled circle in either plan or elevation view. | ||
| + | * "-attr type natural" | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | |||
| + | % store the original clean_legend_box | ||
| + | boolean p_anchor_MY_inlegend; | ||
| + | p_anchor_MY_inlegend: | ||
| + | let p_anchor_MY_legend_box = clean_legend_box; | ||
| + | % redefine clean_legend_box to store the flag, then run the original | ||
| + | def clean_legend_box = | ||
| + | p_anchor_MY_inlegend: | ||
| + | p_anchor_MY_legend_box; | ||
| + | enddef; | ||
| + | |||
| + | % a P-hanger, fixed point or natural circle | ||
| + | def p_anchor_MY (expr P,R,S,A)= | ||
| + | if p_anchor_MY_inlegend: | ||
| + | % this is the legend - make sure the function works normally again | ||
| + | p_anchor_MY_inlegend: | ||
| + | % draw a pretty legend - show all possibilities | ||
| + | string ATTR_type; | ||
| + | ATTR_type: | ||
| + | p_anchor_MY((.2, | ||
| + | ATTR_type: | ||
| + | p_anchor_MY((.5, | ||
| + | ATTR_type: | ||
| + | p_anchor_MY((.7, | ||
| + | else: | ||
| + | begingroup; | ||
| + | save type, facing; | ||
| + | T:=identity aligned A rotated R scaled S shifted P; | ||
| + | string type; | ||
| + | if known ATTR_type: | ||
| + | type: | ||
| + | else: | ||
| + | type: | ||
| + | fi; | ||
| + | if (type = " | ||
| + | U: | ||
| + | PenCThick: | ||
| + | % fill with background colour, to remove any rope lines going through the point | ||
| + | % this does not respect opacity, but there is no other way to remove lines from other objects | ||
| + | % clipping currentpicture does not work, since ropes are always drawn last, then layered beneath point symbols | ||
| + | thunfill fullcircle scaled (0.4u-PenCThick); | ||
| + | thdraw fullcircle scaled (0.4u-PenCThick) withpen PenC; | ||
| + | else: | ||
| + | if (type = " | ||
| + | U: | ||
| + | thfill fullcircle scaled 0.4u; | ||
| + | else: | ||
| + | if (R > 0) and (R < 180): | ||
| + | facing: | ||
| + | else: | ||
| + | facing:=1 | ||
| + | fi; | ||
| + | if (type = " | ||
| + | T:=identity shifted (facing*-0.25u, | ||
| + | fi; | ||
| + | U: | ||
| + | % thick part sticking out of the rock | ||
| + | thdraw (0, | ||
| + | % thin part in the rock | ||
| + | thdraw (0, | ||
| + | % the loop should hang down the " | ||
| + | % stubs to hold the semicircle | ||
| + | thdraw (0, | ||
| + | thdraw (0, | ||
| + | % semicircle | ||
| + | thdraw halfcircle scaled .3u rotated (facing*-90) shifted (facing*.1u, | ||
| + | fi; | ||
| + | fi; | ||
| + | endgroup; | ||
| + | fi; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Use it with this line in your layout: | ||
| + | |||
| + | symbol-assign point anchor MY | ||
| + | |||
| + | and optionally to match the text with the symbols it will show in the legend | ||
| + | |||
| + | text en "point anchor" | ||
| + | |||
| + | ===Warning triangle=== | ||
| + | |||
| + | [[user: | ||
| + | |||
| + | Warning triangle with exclamation mark, and yellow background: | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | % a warning triangle | ||
| + | def p_u_warning (expr P,R,S,A)= | ||
| + | scale: | ||
| + | sin120: | ||
| + | cos120: | ||
| + | U: | ||
| + | T:=identity aligned A rotated R scaled S shifted P; | ||
| + | % yellow triangle | ||
| + | thfill (0, | ||
| + | % black triangle outline | ||
| + | thdraw (0, | ||
| + | thdraw (sin120*scale, | ||
| + | thdraw (sind(240)*scale, | ||
| + | % line of ! | ||
| + | thdraw (0, | ||
| + | thdraw (0, | ||
| + | % dot of ! | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Select this as point type " | ||
| + | |||
| + | text en "point u: | ||
| + | |||
| + | ===Magnetic effects=== | ||
| + | |||
| + | [[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: | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | % a spinning compass | ||
| + | def p_u_magnetism (expr P,R,S,A)= | ||
| + | begingroup; | ||
| + | save scale, cthick, pointheight, | ||
| + | scale: | ||
| + | cthick: | ||
| + | pointheight: | ||
| + | pointwidth: | ||
| + | cutheight: | ||
| + | cutwidth: | ||
| + | U: | ||
| + | T:=identity aligned A rotated (R-20) scaled S shifted P; | ||
| + | % a circle | ||
| + | thdraw fullcircle scaled 2scale withpen PenC; | ||
| + | % filled triangle | ||
| + | thfill (0, | ||
| + | % black triangle outline | ||
| + | % 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 (0, | ||
| + | % 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; | ||
| + | initsymbol(" | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Select this as point type " | ||
| + | |||
| + | text en "point u: | ||
| + | |||
| + | ===Rope lengths=== | ||
| + | |||
| + | [[user: | ||
| + | |||
| + | 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/ | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def p_u_ropelength (expr P,R,S,A)= | ||
| + | T:=identity shifted P; | ||
| + | U:=(0,0); | ||
| + | if known ATTR_text: | ||
| + | % approximate size (varies with proportional font) | ||
| + | U: | ||
| + | create_styled_label(ATTR_text, | ||
| + | fi; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | def p_u_ropelength_legend = | ||
| + | begingroup; | ||
| + | save ATTR_text; | ||
| + | string ATTR_text; | ||
| + | ATTR_text: | ||
| + | p_u_ropelength((.5, | ||
| + | endgroup; | ||
| + | enddef; | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Select this as point type " | ||
| + | |||
| + | text en "point u: | ||
| + | |||
| + | 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 | ||
| + | |||
| + | {{: | ||
| + | |||
| + | 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) | ||
| + | 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: | ||
| + | text en "point u: | ||
| + | |||
| + | Notes: | ||
| + | Use " | ||
| + | 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> < | ||
| + | |||
| + | From Benedikt Hallinger for Therion 6.0.3 | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | # Symbol to denote assigned survey. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | def p_u_mappe(expr pos, theta, sc, al) = | ||
| + | T:=identity aligned al rotated theta scaled sc shifted pos; | ||
| + | begingroup; | ||
| + | % Basic config | ||
| + | bordersmooth: | ||
| + | bordermargin: | ||
| + | basescale: | ||
| + | fillsize: | ||
| + | if known(ATTR_bordersmooth): | ||
| + | if known(ATTR_bordermargin): | ||
| + | if known(ATTR_basescale): | ||
| + | if known(ATTR_fillsize): | ||
| + | |||
| + | % GET LABEL TEXT: | ||
| + | string txt; | ||
| + | if known(ATTR_text): | ||
| + | txt := ATTR_text; | ||
| + | else: | ||
| + | txt := ATTR__survey; | ||
| + | fi; | ||
| + | |||
| + | |||
| + | % PREPARE LABEL: | ||
| + | lab: | ||
| + | pickup PenA; % border thickness | ||
| + | interim bboxmargin: | ||
| + | |||
| + | % 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, | ||
| + | endgroup; | ||
| + | enddef; | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ====Line Symbols==== | ||
| + | ===View whole centerline for underground=== | ||
| + | | ||
| + | |||
| + | If you wish to view whole centerline for underground, | ||
| + | |||
| + | code mpost | ||
| + | let l_survey_cave = l_survey_surface_SKBB; | ||
| + | endcode | ||
| + | ---- | ||
| + | ===Green colored continuous centerline=== | ||
| from [[http:// | from [[http:// | ||
| Line 95: | Line 868: | ||
| enddef; | enddef; | ||
| - | **Code to make unsurveyed wall lines light-weight and dashed**\\ | + | ===Make |
| A sample of how it looks is in the 'line rope' example below. | A sample of how it looks is in the 'line rope' example below. | ||
| Line 106: | Line 879: | ||
| enddef; | enddef; | ||
| endcode | endcode | ||
| + | ---- | ||
| + | ===Visualize cave centreline shot flags with colour for splay and duplicate, and dash for approximate shot flags=== | ||
| - | **Code | + | For version 5.3.12+ Dec2013 (Bruce Mutton) |
| + | code metapost #thin grey cave splays, yellow duplicates and dashed approximate legs | ||
| + | def l_survey_cave (expr P) = | ||
| + | % always draws full centreline, rather than short stubs like default cave centrelines | ||
| + | T: | ||
| + | pickup PenC; | ||
| + | if ATTR__shotflag_splay: | ||
| + | drawoptions(withcolor(0.5, | ||
| + | thdraw P; % grey & thin | ||
| + | drawoptions(); | ||
| + | else: % not splay but may have either or both duplicate and approx flags set | ||
| + | if ATTR__shotflag_duplicate: | ||
| + | drawoptions(withcolor (1,1,0)); % differentiate duplicate with colour yellow | ||
| + | fi; | ||
| + | |||
| + | if ATTR__shotflag_approx: | ||
| + | thdraw P dashed evenly scaled optical_zoom; | ||
| + | else: | ||
| + | thdraw P; | ||
| + | fi; | ||
| + | thdrawoptions(); | ||
| + | fi; | ||
| + | enddef; | ||
| + | endcode | ||
| + | |||
| + | I was trying | ||
| + | initsymbol(" | ||
| + | |||
| + | def l_survey_cave_duplicate_legend = | ||
| + | l_survey_cave_duplicate(((.2, | ||
| + | enddef; | ||
| + | |||
| + | ---- | ||
| + | ===Define | ||
| Draws dashes with v shaped tick marks outside the passage like we tend to do in New Zealand...\\ | Draws dashes with v shaped tick marks outside the passage like we tend to do in New Zealand...\\ | ||
| A sample of how it looks is in the 'line rope' example below. | A sample of how it looks is in the 'line rope' example below. | ||
| Line 136: | Line 944: | ||
| - | **Code to define | + | ===Define |
| code metapost | code metapost | ||
| Line 160: | Line 968: | ||
| endcode | endcode | ||
| | | ||
| - | **Code to define | + | ===Define |
| This is just Therions default SKBB ceiling step, reflected so that it matches the UIS convention with the tick marks pointing away from the void space. | This is just Therions default SKBB ceiling step, reflected so that it matches the UIS convention with the tick marks pointing away from the void space. | ||
| Line 184: | Line 992: | ||
| endcode | endcode | ||
| - | **Code to define | + | ===Define |
| This is just Therions default SKBB ceiling meander, with the symbols reflected so that it matches the UIS convention with the tick marks pointing away from the void space. | This is just Therions default SKBB ceiling meander, with the symbols reflected so that it matches the UIS convention with the tick marks pointing away from the void space. | ||
| Line 218: | Line 1026: | ||
| endcode | endcode | ||
| | | ||
| + | ===Draw a plank walk and (rope) handrail=== | ||
| + | [[http:// | ||
| - | ---- | + | {{: |
| - | ---- | + | |
| - | =====Cave Symbol Size and Density Examples===== | + | def l_u_plankwalk |
| - | **Modification MetaPost code for NSS (Philip Schuchardt)** | + | cas := 0; |
| + | dlzka := arclength P; | ||
| + | mojrok := adjust_step(dlzka, | ||
| + | pickup PenD; | ||
| + | forever: | ||
| + | t := arctime cas of P; | ||
| + | thdraw ((point t of P) + 0.5 * u * unitvector(thdir(P, | ||
| + | ((point t of P) - 0.5 * u * unitvector(thdir(P, | ||
| + | cas := cas + mojrok; | ||
| + | exitif cas > dlzka + (mojrok/ | ||
| + | endfor; | ||
| + | pickup PenC; | ||
| + | %thdraw P; | ||
| + | %draw path withcolor (0.5, 0 ,0) | ||
| + | | ||
| + | |||
| + | def l_u_handrail (expr P) = T: | ||
| + | pair zz[]; | ||
| + | for t = 0 upto length P - 1: | ||
| + | zz1 := point t of P; | ||
| + | zz2 := point t+1 of P; | ||
| + | zz3 := 0.5[zz1, | ||
| + | zz4 := 0.25[zz1, | ||
| + | zz5 := 0.75[zz1, | ||
| + | pickup PenA; | ||
| + | thdraw zz1 -- zz2 withcolor(.67, | ||
| + | thdraw zz1 shifted (0,1.6u) .. zz4 shifted (0,1.2u) .. zz3 shifted (0,1.6u) .. zz5 shifted (0,1.3u) .. zz2 shifted (0,1.6u) withcolor(.67, | ||
| + | pickup pencircle scaled 1pt; | ||
| + | thdraw zz1 shifted (0,-1.2u) -- zz1 shifted (0,2u) withcolor(.67, | ||
| + | thdraw zz3 -- zz3 shifted (0,2u) withcolor(.67, | ||
| + | endfor; | ||
| + | thdraw zz2 shifted (0,-6u) -- zz2 shifted (0,2u) withcolor(.67, | ||
| + | | ||
| + | |||
| + | ===Define a doline=== | ||
| + | [[http:// | ||
| + | |||
| + | {{: | ||
| + | |||
| + | def l_u_doline (expr P) = | ||
| + | T: | ||
| + | laenge:= arclength P; | ||
| + | symsize: | ||
| + | triangle_width: | ||
| + | cur: | ||
| + | pickup PenC; | ||
| + | forever: | ||
| + | t1 := arctime (cur) of P; | ||
| + | t := arctime (cur + triangle_width/ | ||
| + | t2 := arctime (cur + triangle_width) of P; | ||
| + | thfill (subpath (t1,t2) of P) -- | ||
| + | ((point t of P) + symsize/2 * unitvector(thdir(P, | ||
| + | cycle; | ||
| + | thdraw (point t2 of P) --((point t of P) + symsize/2 * unitvector(thdir(P, | ||
| + | (point t1 of P) withcolor (0.5, 0, 0); | ||
| + | cur := cur + symsize; | ||
| + | exitif cur > laenge - (1*symsize/ | ||
| + | t1:=arctime (cur) of P; | ||
| + | endfor; | ||
| + | enddef; | ||
| + | |||
| + | ===Define Line Handrail=== | ||
| + | Andrew Atkinson | ||
| + | |||
| + | {{: | ||
| + | |||
| + | def l_u_rail (expr P) = | ||
| + | T: | ||
| + | cas := 0; | ||
| + | dlzka := arclength P; | ||
| + | mojkrok: | ||
| + | pickup PenC; | ||
| + | forever: | ||
| + | t0 := arctime (cas) of P; | ||
| + | t1 := arctime (cas + mojkrok*2/ | ||
| + | t := arctime (cas + mojkrok/2) of P; | ||
| + | t4 := arctime (cas + mojkrok*3/ | ||
| + | t5 := arctime (cas + mojkrok) of P; | ||
| + | thdraw (subpath (t0,t1) of P); | ||
| + | thdraw (subpath (t4,t5) of P); | ||
| + | drawdot | ||
| + | | ||
| + | #mark_ (P, | ||
| + | #mark_ (P, | ||
| + | #f := (P, | ||
| + | #draw f; | ||
| + | cas := cas + mojkrok; | ||
| + | exitif cas > dlzka - (2*mojkrok/ | ||
| + | endfor; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | |||
| + | ===Strata=== | ||
| + | Line symbol for strata for cross sections. It works exactly as line section symbol but you should use -clip off option: | ||
| + | |||
| + | def l_u_strata (expr P) = | ||
| + | T: | ||
| + | path Q; Q = punked P; | ||
| + | for t = 0 upto length P - 1: | ||
| + | pair zz[]; | ||
| + | zz1 := point t of P; | ||
| + | zz2 := point t+1 of P; | ||
| + | zz3 := postcontrol t of P; | ||
| + | zz4 := precontrol t+1 of P; | ||
| + | linecap_prev: | ||
| + | linecap: | ||
| + | if (length(zz3-1/ | ||
| + | | ||
| + | zz5 = whatever[zz1, | ||
| + | (zz3-zz5) = whatever * (zz1-zz2) rotated 90; | ||
| + | pickup pencircle scaled 1 mm; | ||
| + | draw zz1--zz5 dashed evenly; | ||
| + | pickup PenA; | ||
| + | draw zz1--zz5 withcolor background; | ||
| + | zz6 = whatever[zz1, | ||
| + | (zz4-zz6) = whatever * (zz1-zz2) rotated 90; | ||
| + | pickup pencircle scaled 1 mm; | ||
| + | draw zz2--zz6 dashed evenly; | ||
| + | pickup PenA; | ||
| + | draw zz2--zz6 withcolor background; | ||
| + | else: | ||
| + | pickup pencircle scaled 1 mm; | ||
| + | draw zz1--zz2 dashed evenly; | ||
| + | pickup PenA; | ||
| + | draw zz1--zz2 withcolor background; | ||
| + | fi; | ||
| + | linecap: | ||
| + | endfor; | ||
| + | enddef; | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===Fault=== | ||
| + | Line symbol for fault. It works exactly as line section symbol but you should use -clip off option: | ||
| + | |||
| + | def l_u_fault (expr P) = | ||
| + | T: | ||
| + | path Q; Q = punked P; | ||
| + | pickup PenA; | ||
| + | for t = 0 upto length P - 1: | ||
| + | pair zz[]; | ||
| + | zz1 := point t of P; | ||
| + | zz2 := point t+1 of P; | ||
| + | zz3 := postcontrol t of P; | ||
| + | zz4 := precontrol t+1 of P; | ||
| + | if (length(zz3-1/ | ||
| + | | ||
| + | zz5 = whatever[zz1, | ||
| + | (zz3-zz5) = whatever * (zz1-zz2) rotated 90; | ||
| + | draw zz1--zz5 dashed evenly; | ||
| + | zz6 = whatever[zz1, | ||
| + | (zz4-zz6) = whatever * (zz1-zz2) rotated 90; | ||
| + | draw zz2--zz6 dashed evenly; | ||
| + | else: | ||
| + | draw zz1--zz2 dashed evenly; | ||
| + | fi; | ||
| + | endfor; | ||
| + | enddef; | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===Pit lines that look different in elevation view=== | ||
| + | |||
| + | [[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 [[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 " | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def l_pit_MY (expr P)= | ||
| + | if ATTR__elevation: | ||
| + | l_border_temporary_SKBB(P); | ||
| + | else: | ||
| + | l_pit_UIS(P); | ||
| + | fi; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | Use it with this line in your layout: | ||
| + | |||
| + | symbol-assign line pit MY | ||
| + | |||
| + | ===Simplified rope lines=== | ||
| + | |||
| + | [[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 [[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 [[# | ||
| + | |||
| + | This can become annoying while editing lines since you may delete the linepoint where you set the options, so you may just want to redefine rope lines to use your own symbol, which does not try to be clever. Unfortunately, | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | |||
| + | % store the original clean_legend_box | ||
| + | boolean l_rope_MY_inlegend; | ||
| + | l_rope_MY_inlegend: | ||
| + | let l_rope_MY_legend_box = clean_legend_box; | ||
| + | % redefine clean_legend_box to store the flag, then run the original | ||
| + | def clean_legend_box = | ||
| + | l_rope_MY_inlegend: | ||
| + | l_rope_MY_legend_box; | ||
| + | enddef; | ||
| + | |||
| + | def l_rope(expr P, show_anchors, | ||
| + | T: | ||
| + | pickup PenB; | ||
| + | if l_rope_MY_inlegend: | ||
| + | % drawing the legend - this gets run twice, since Therion draws two ropes, one for each parameter | ||
| + | if show_rebelays: | ||
| + | thdraw ((.35,.9) -- (.4,.85) -- (.4,.5) .. controls (.4,.4) and (.45,.4) .. (.5,.5) -- (.55,.45) -- (.55,.1)) inscale; | ||
| + | thdraw ((.4,.85) -- (.45,.9)) inscale; | ||
| + | thdraw ((.55,.45) -- (.6,.5)) inscale; | ||
| + | thfill fullcircle scaled .15u shifted ((.35,.9) inscale); | ||
| + | thfill fullcircle scaled .15u shifted ((.45,.9) inscale); | ||
| + | thfill fullcircle scaled .15u shifted ((.5,.5) inscale); | ||
| + | thfill fullcircle scaled .15u shifted ((.6,.5) inscale); | ||
| + | fi; | ||
| + | else: | ||
| + | begingroup; | ||
| + | save type; | ||
| + | string type; | ||
| + | if known ATTR_type: | ||
| + | type: | ||
| + | else: | ||
| + | type: | ||
| + | fi; | ||
| + | if type = " | ||
| + | thdraw P withcolor (0.7, 0.7, 0.7); | ||
| + | else: | ||
| + | thdraw P; | ||
| + | fi; | ||
| + | endgroup; | ||
| + | fi; | ||
| + | enddef; | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | Rope lines default to using the standard colour (black, unless you change it with " | ||
| + | |||
| + | * -attr type primary | ||
| + | | ||
| + | |||
| + | This allows you to have ropes with two different colours, useful if ropes are optional or follow an uncommon optional route. | ||
| + | |||
| + | ===Deviations=== | ||
| + | |||
| + | [[user: | ||
| + | |||
| + | 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, | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def l_u_deviation (expr P) = | ||
| + | begingroup; | ||
| + | save ellipse; | ||
| + | T: | ||
| + | pickup PenC; | ||
| + | path ellipse; | ||
| + | ellipse: | ||
| + | thdraw P cutafter ellipse; | ||
| + | draw ellipse; | ||
| + | endgroup; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | def l_u_deviation_legend = | ||
| + | l_u_deviation(((.1, | ||
| + | enddef; | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Select this as line type " | ||
| + | |||
| + | < | ||
| + | text en "line u: | ||
| + | </ | ||
| + | |||
| + | ===Shuttering, | ||
| + | |||
| + | [[user: | ||
| + | |||
| + | This symbol is designed for use in mine surveys, where passages may have the ceiling or walls made up from wooden boards holding back debris (deads). Often these boards are a series of flat boards then stronger timbers, which is what the dashed line is supposed to represent. | ||
| + | |||
| + | This symbol is an example of how to draw two parallel lines when given only a single path to work from. It could be done simply by sampling down the length of the path, and adding a new path with a point rotated a chosen distance perpendicular to the original path's direction. However, that will fail to follow sharper corners in the original path properly, and will instead create a weird loop. To avoid this, a separate semi-circular path is created slightly to the side at each sample point, and if it intersects the original path, a corner is nearby, and the sample point is not added to the new path - the points that do not create intersections are used instead. This technique is inspired heavily by the approach used by Therion' | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def l_u_shuttering (expr P)= | ||
| + | begingroup; | ||
| + | save pathlength, athick, cthick, linegap, testdiameter, | ||
| + | T: | ||
| + | % main wall line | ||
| + | thdraw P withpen PenA; | ||
| + | % work out a parallel path | ||
| + | % the easy way is to sample direction every few units, and add a parallel point into a new path | ||
| + | % however, this causes weird loops at sharp corners, so check if a sharp corner is coming up within | ||
| + | % the length of the gap between lines, and ignore that point if so | ||
| + | pathlength: | ||
| + | % gap between the main line and dashed line | ||
| + | if known ATTR_linegap: | ||
| + | linegap: | ||
| + | else: | ||
| + | linegap: | ||
| + | fi; | ||
| + | % how tightly should the dashed line follow curves and corners - higher numbers take more time to process | ||
| + | if known ATTR_accuracy: | ||
| + | accuracy: | ||
| + | else: | ||
| + | accuracy: | ||
| + | fi; | ||
| + | athick: | ||
| + | cthick: | ||
| + | testdiameter: | ||
| + | path testpath; | ||
| + | testpath: | ||
| + | pair newpoint; | ||
| + | path innerpath; | ||
| + | pair intersections; | ||
| + | curlength: | ||
| + | forever: | ||
| + | samplepoint: | ||
| + | % every now and then along the line, place a semicircle, rotated to face away from the line, offset by the thickness of the line, | ||
| + | % with a radius the same as the gap between the lines - if its ends touch the main line's centre, the corner is too sharp to use | ||
| + | % this point | ||
| + | intersections: | ||
| + | % if there are no intersections, | ||
| + | % where the intersection happened >=0 | ||
| + | % enable for debugging | ||
| + | %if (xpart intersections) = -1: | ||
| + | % thdraw testpath rotated (angle thdir(P, | ||
| + | %else: | ||
| + | % thdraw testpath rotated (angle thdir(P, | ||
| + | %fi; | ||
| + | if (xpart intersections) = -1: | ||
| + | newpoint: | ||
| + | % enable for debugging | ||
| + | %thdraw newpoint withcolor (0,0,100) withpen PenC; | ||
| + | if known innerpath: | ||
| + | innerpath: | ||
| + | else: | ||
| + | innerpath: | ||
| + | fi; | ||
| + | fi; | ||
| + | exitif curlength = pathlength; | ||
| + | % move in small steps, to take account of tight backwards curves, and to get points near a corner | ||
| + | curlength: | ||
| + | if curlength > pathlength: | ||
| + | curlength: | ||
| + | fi; | ||
| + | endfor; | ||
| + | if known innerpath: | ||
| + | if cycle P: | ||
| + | innerpath: | ||
| + | fi; | ||
| + | string dashes; | ||
| + | if known ATTR_dashes: | ||
| + | dashes: | ||
| + | else: | ||
| + | dashes: | ||
| + | fi; | ||
| + | picture chosenpattern; | ||
| + | if dashes = " | ||
| + | chosenpattern: | ||
| + | elseif dashes = " | ||
| + | chosenpattern: | ||
| + | elseif dashes = " | ||
| + | chosenpattern: | ||
| + | elseif dashes = " | ||
| + | chosenpattern: | ||
| + | else: | ||
| + | chosenpattern: | ||
| + | fi; | ||
| + | thdraw innerpath dashed chosenpattern withpen PenC; | ||
| + | fi; | ||
| + | endgroup; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Select this as line type " | ||
| + | |||
| + | text en "line u: | ||
| + | |||
| + | Each line will need the " | ||
| + | |||
| + | * -attr linegap 0.125 = the gap between the outer wall and inner dashed line - too big and the inner line will curve significantly at corners | ||
| + | * -attr accuracy 4 = how tightly should the dashed line follow curves and corners - higher numbers take more time to process | ||
| + | * -attr dashes dashdotdot | ||
| + | * -attr dashes dashdashdotdot = exactly what it says | ||
| + | * -attr dashes dashdot | ||
| + | * -attr dashes dotted | ||
| + | * -attr dashes dashed | ||
| + | |||
| + | ===Trees=== | ||
| + | |||
| + | [[user: | ||
| + | |||
| + | 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. | ||
| + | |||
| + | The trunk/ | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def l_u_treetrunk(expr P)= | ||
| + | T: | ||
| + | pickup PenC; | ||
| + | draw P; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | def l_u_treetrunk_legend = | ||
| + | l_u_treetrunk(((.4, | ||
| + | l_u_treetrunk(((.6, | ||
| + | l_u_treetrunk(((.65, | ||
| + | enddef; | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | The bushy part, which is automatically bulged out: | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def l_u_bush (expr P)= | ||
| + | begingroup; | ||
| + | save pathlength, bulges, bulgesper, bulgesize, newpoint, newdirection, | ||
| + | T: | ||
| + | pathlength: | ||
| + | if known ATTR_bulges: | ||
| + | bulges: | ||
| + | else: | ||
| + | bulges: | ||
| + | fi; | ||
| + | if known ATTR_bulgesper: | ||
| + | if ATTR_bulgesper = " | ||
| + | bulges: | ||
| + | fi; | ||
| + | fi; | ||
| + | if known ATTR_bulgesize: | ||
| + | bulgesize: | ||
| + | else: | ||
| + | bulgesize: | ||
| + | fi; | ||
| + | pair newpoint; | ||
| + | pair newdirection; | ||
| + | path bulgedpath; | ||
| + | steps:=3; % number of samples per bulge | ||
| + | % precompute various numbers to avoid arithmetic overflows with large numbers of bulges | ||
| + | pathfactor: | ||
| + | slopefactor: | ||
| + | extradirection: | ||
| + | curincrement: | ||
| + | forever: | ||
| + | samplepoint: | ||
| + | sinefactor: | ||
| + | newpoint: | ||
| + | newdirection: | ||
| + | % enable for debugging | ||
| + | %thdraw (point samplepoint of P) withcolor (100,0,0) withpen PenC; | ||
| + | %thdraw newpoint--(newpoint shifted (bulgesize*unitvector(newdirection))) withcolor (0,0,100) withpen PenC; | ||
| + | if known bulgedpath: | ||
| + | if ((curincrement mod steps) = 0): | ||
| + | % this is a corner where one bulge ends and another starts, two points are needed so that the direction vectors can control curves | ||
| + | %thdraw newpoint--(newpoint shifted (bulgesize*unitvector(thdir(P, | ||
| + | bulgedpath: | ||
| + | if curincrement <> steps * bulges: | ||
| + | % don't add one in the final increment, since --cycle then has two identical point vectors | ||
| + | bulgedpath: | ||
| + | fi; | ||
| + | else: | ||
| + | bulgedpath: | ||
| + | fi; | ||
| + | else: | ||
| + | % first point in the path | ||
| + | bulgedpath: | ||
| + | fi; | ||
| + | exitif curincrement = steps * bulges; | ||
| + | curincrement: | ||
| + | endfor; | ||
| + | if cycle P: | ||
| + | bulgedpath: | ||
| + | fi; | ||
| + | thdraw bulgedpath withpen PenC; | ||
| + | endgroup; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | def l_u_bush_legend = | ||
| + | begingroup; | ||
| + | save ATTR_bulgesize; | ||
| + | string ATTR_bulgesize; | ||
| + | ATTR_bulgesize: | ||
| + | l_u_bush(((.6, | ||
| + | endgroup; | ||
| + | enddef; | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Select these as line type " | ||
| + | |||
| + | text en "line u: | ||
| + | text en "line u: | ||
| + | |||
| + | Use as many treetrunk and bush lines as needed to make the perfect tree for your tastes. The bush lines have several "-attr setting value" options which can be used to control just how bulgy they are. | ||
| + | |||
| + | * -attr bulges 10 = the number of bulges | ||
| + | * -attr bulgesper line = (default) the number of bulges should be spread over the whole line | ||
| + | * -attr bulgesper tenu = the number of bulges should be used per approx 10u of the line's length (so the bulge length remains fairly constant, and longer lines get more bulges | ||
| + | * -attr bulgesize 1 = how much each bulge extends away from the line, in number of " | ||
| + | |||
| + | ===Shoring=== | ||
| + | |||
| + | [[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 [[riggingtopos|rigging]], | ||
| + | |||
| + | < | ||
| + | code metapost | ||
| + | def l_u_shoring (expr P)= | ||
| + | begingroup; | ||
| + | save scale; | ||
| + | T: | ||
| + | string scale; | ||
| + | if known ATTR_scale: | ||
| + | scale: | ||
| + | else: | ||
| + | scale: | ||
| + | fi; | ||
| + | if scale = " | ||
| + | elseif scale = " | ||
| + | elseif scale = " | ||
| + | elseif scale = " | ||
| + | elseif scale = " | ||
| + | fi; | ||
| + | thdraw P; | ||
| + | endgroup; | ||
| + | enddef; | ||
| + | initsymbol(" | ||
| + | def l_u_shoring_legend = | ||
| + | l_u_shoring(((.1, | ||
| + | l_u_shoring(((.9, | ||
| + | enddef; | ||
| + | endcode | ||
| + | </ | ||
| + | |||
| + | {{ :: | ||
| + | |||
| + | Select this as line type " | ||
| + | |||
| + | 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==== | ||
| + | ===Show area water in a different color=== | ||
| + | Martin Budaj | ||
| + | |||
| + | Add in layout: | ||
| + | |||
| + | code metapost | ||
| + | def a_water (expr p) = | ||
| + | T: | ||
| + | thfill p withcolor (0.1, 0.2, 0.8); | ||
| + | enddef; | ||
| + | endcode | ||
| + | |||
| + | Colors are in order R, G, B --- 0=0 1=255. Color (0.1, 0.2, 0.8) means (25 51 204) in Photoshop - quite dark blue. Light blue could be for example (123 213 255) in Photoshop - it is (123/255, 213/255, 255/255) or (0.48, 0.84 1.0) for Metapost. | ||
| + | |||
| + | See also [[https:// | ||
| + | |||
| + | ---- | ||
| + | ===Modification MetaPost code for NSS (Philip Schuchardt)=== | ||
| This is how you overload metapost symbols: | This is how you overload metapost symbols: | ||
| Line 334: | Line 1811: | ||
| ---- | ---- | ||
| - | **Modification of fill densities | + | ===Modification of fill densities=== |
| + | Stacho Mudrák | ||
| code metapost | code metapost | ||
| Line 379: | Line 1857: | ||
| ---- | ---- | ||
| - | **POINT BLOCK +size adjust (symbolsize) Stefan Oswald** | + | ===POINT BLOCK +size adjust (symbolsize)=== |
| + | Stefan Oswald | ||
| code metapost | code metapost | ||
| Line 395: | Line 1874: | ||
| ---- | ---- | ||
| - | **AREA BLOCK + density adjust (distance) Stefan Oswald** | + | ===AREA BLOCK + density adjust (distance)=== |
| + | Stefan Oswald | ||
| code metapost | code metapost | ||
| Line 424: | Line 1904: | ||
| endcode | endcode | ||
| - | **Code to make area AUT sand more spaced out and more random**\\ | + | ===Make |
| A sample of how it looks is in the 'area point colour water' example below. | A sample of how it looks is in the 'area point colour water' example below. | ||
| Line 453: | Line 1933: | ||
| enddef; | enddef; | ||
| endcode | endcode | ||
| + | |||
| + | ---- | ||
| + | ===Area blocks with colored rock-borders only (not filled)=== | ||
| + | Martin Budaj | ||
| + | |||
| + | | ||
| + | |||
| + | code metapost | ||
| + | def a_blocks (expr p) = | ||
| + | | ||
| + | | ||
| + | path q, qq; q = bbox p; | ||
| + | | ||
| + | uu := max(u, (xpart urcorner q - xpart llcorner q)/100, (ypart urcorner q - ypart llcorner q)/100); | ||
| + | | ||
| + | for i = xpart llcorner q step 2uu until xpart urcorner q: | ||
| + | for j = ypart llcorner q step 2uu until ypart urcorner q: | ||
| + | qq := punked (((-.5uu, | ||
| + | randomized (uu/2)) | ||
| + | rotated uniformdeviate(360) | ||
| + | shifted ((i,j) randomized 1.6uu); | ||
| + | if xpart (p intersectiontimes qq) < 0: | ||
| + | thdraw qq; | ||
| + | fi; | ||
| + | | ||
| + | | ||
| + | ); | ||
| + | clip tmp_pic to p; | ||
| + | draw tmp_pic; | ||
| + | | ||
| + | This is modified a_blocks_SKBB definition with " | ||
| + | |||
| + | == Another solution == | ||
| + | Another solution is to leave " | ||
| + | |||
| + | clip tmp_pic to p; | ||
| + | draw tmp_pic; | ||
| + | |||
| + | to | ||
| + | |||
| + | clip tmp_pic to p; | ||
| + | drawoptions(); | ||
| + | draw tmp_pic; | ||
| + | |||
| + | at the end of the macro definition. This approach preserves filling the blocks with a background colour. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===Customisable Area Blocks with Different Number of Sides=== | ||
| + | Andrew Atkinson | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Blocks shown as produced by default settings, at about half scale. | ||
| + | |||
| + | The grid is made of horizontal and vertical grids, but due to the way the starting regular polygon is derived the starting point is always top middle, this makes no randomness makes the squares come out at 45° | ||
| + | |||
| + | Various things could be improved. | ||
| + | |||
| + | The settings can no be overridden by using < | ||
| + | on each area, therefore having different types and density of blocks in different areas. | ||
| + | |||
| + | overlap <'' | ||
| + | Do the blocks overlap the border, if false an attempt is made to shink the block until it is inside or out\\ | ||
| + | Default false\\ | ||
| + | |||
| + | separation <'' | ||
| + | Proportion to the size of separation of centres of the blocks as set out in a rectangular grid\\ | ||
| + | Default 0.7\\ | ||
| + | |||
| + | block_random <'' | ||
| + | Max each point of the base block can be moved. Too big and they can intersect themselves\\ | ||
| + | Default 0.7\ | ||
| + | |||
| + | base_rotation <'' | ||
| + | Rotation from 0 of base block, can be used to set all blocks to the same angle, not relavant if random rotation is set to 360\\ | ||
| + | Default 0\\ | ||
| + | |||
| + | random_rotation <'' | ||
| + | Rotation either side of base rotation eg 20 will be plus or minus 10 each side\\ | ||
| + | Default 360\\ | ||
| + | |||
| + | min_scale <'' | ||
| + | Minimum multiplier used for the base shape\\ | ||
| + | Default 0.7\\ | ||
| + | |||
| + | max_scale <'' | ||
| + | Added to the minimum multiplier to get the maximum scale\\ | ||
| + | Default 0.6\\ | ||
| + | |||
| + | aspect <'' | ||
| + | How much longer the block is than it is wide, before randomising\\ | ||
| + | Default 1.5\\ | ||
| + | |||
| + | shift_random <'' | ||
| + | Max random amount block can be moved from the original grid\\ | ||
| + | Deafult 0.75\\ | ||
| + | |||
| + | shapes <'' | ||
| + | Set the ratio of different sided block, triangle, square, pentagon, hexagon. Must be single digits\\ | ||
| + | Default 1,3,4,2 | ||
| + | |||
| + | |||
| + | **Code for blocks** | ||
| + | < | ||
| + | initsymbol (" | ||
| + | |||
| + | def a_blocks_BCA (expr p) = | ||
| + | | ||
| + | |||
| + | %Derived from one of the built in blocks symbols | ||
| + | %No error checking on the attr so can break badly | ||
| + | % Andrew Atkinson 2019 | ||
| + | |||
| + | %Do the blocks overlap the border, if false an attempt is made to shink the block until it is inside or out | ||
| + | boolean overlap; | ||
| + | overlap:= | ||
| + | if known ATTR_overlap: | ||
| + | else: false fi; | ||
| + | |||
| + | % Proportion to the size of separation of centres of the blocks as set out in a rectangular grid | ||
| + | %FIXME: Really need to check if it is number and not zero in for some cases | ||
| + | separation: | ||
| + | if known ATTR_separation: | ||
| + | else: 0.7 fi; | ||
| + | |||
| + | % Max each point of the base block can be moved. Too big and they can intersect themselves | ||
| + | block_random: | ||
| + | if known ATTR_block_random: | ||
| + | else: 0.7 | ||
| + | fi; | ||
| + | |||
| + | % Rotation from 0 of base block, can be used to set all blocks to the same angle | ||
| + | base_rotation: | ||
| + | if known ATTR_base_rotation: | ||
| + | else: 0 | ||
| + | fi; | ||
| + | |||
| + | % Rotation either side of base rotation eg 20 will be plus or minus 10 each side | ||
| + | |||
| + | random_rotation: | ||
| + | if known ATTR_random_rotation: | ||
| + | else: 360 | ||
| + | fi; | ||
| + | |||
| + | % Minimum multiplier used for the base shape | ||
| + | |||
| + | min_scale_factor: | ||
| + | if known ATTR_min_size: | ||
| + | else: 0.7 | ||
| + | fi; | ||
| + | |||
| + | % Added to the minimum multiplier to get the maximum scale | ||
| + | add_scale_factor: | ||
| + | if known ATTR_max_size: | ||
| + | else: 0.6 | ||
| + | fi; | ||
| + | |||
| + | % How much longer the block is than it is wide, before randomising | ||
| + | aspect:= | ||
| + | if known ATTR_aspect: | ||
| + | else: 1.5 | ||
| + | fi; | ||
| + | |||
| + | % Max random amount block can be moved from the original grid | ||
| + | shift_random: | ||
| + | if known ATTR_shift_random: | ||
| + | else: 0.75 | ||
| + | fi; | ||
| + | |||
| + | % Set the propotions of different sided block | ||
| + | if known ATTR_shapes: | ||
| + | b_tri: | ||
| + | b_quad: | ||
| + | b_pent: | ||
| + | b_hex: | ||
| + | else: | ||
| + | b_tri:=1; | ||
| + | b_quad:=3; | ||
| + | b_pent:=4; | ||
| + | b_hex:=2; | ||
| + | fi; | ||
| + | |||
| + | pickup PenC; | ||
| + | path q, qq; q = bbox p; | ||
| + | pair outside; | ||
| + | outside:= ulcorner q + up; | ||
| + | picture tmp_pic; | ||
| + | uu := max(u, (xpart urcorner q - xpart llcorner q)/100, (ypart urcorner q - ypart | ||
| + | iu := uu * aspect; | ||
| + | blocks := b_tri+b_quad + b_pent + b_hex; | ||
| + | tmp_pic := image( | ||
| + | for i = xpart llcorner q step separation * aspect * uu until xpart urcorner q: | ||
| + | for j = ypart llcorner q step separation*uu until ypart urcorner q: | ||
| + | pick_sides := uniformdeviate(blocks); | ||
| + | |||
| + | % This is probably a better way to impliment the different sided blocks calculates the vertices of polygons | ||
| + | %for (i = 0; i < n; i++) { | ||
| + | % printf(" | ||
| + | %} | ||
| + | |||
| + | if pick_sides < b_tri: | ||
| + | qq := punked (((.5iu, | ||
| + | randomized (block_random * uu)) | ||
| + | scaled (uniformdeviate(add_scale_factor)+min_scale_factor) | ||
| + | | ||
| + | shifted ((i,j) randomized (shift_random * uu)); | ||
| + | elseif pick_sides < b_tri + b_quad: | ||
| + | qq := punked (((0.5iu, | ||
| + | randomized (block_random * uu)) | ||
| + | scaled (uniformdeviate(add_scale_factor)+min_scale_factor) | ||
| + | | ||
| + | shifted ((i,j) randomized (shift_random * uu)); | ||
| + | | ||
| + | qq := punked (((0.5iu, | ||
| + | randomized (block_random * uu)) | ||
| + | scaled (uniformdeviate(add_scale_factor)+min_scale_factor) | ||
| + | | ||
| + | shifted ((i,j) randomized (shift_random * uu)); | ||
| + | else: | ||
| + | qq := punked (((0.5iu, | ||
| + | randomized (block_random * uu)) | ||
| + | scaled (uniformdeviate(add_scale_factor)+min_scale_factor) | ||
| + | rotated (base_rotation + random_rotation / 2 - uniformdeviate(random_rotation) ) | ||
| + | shifted ((i,j) randomized (shift_random * uu)); | ||
| + | fi; | ||
| + | if not overlap: | ||
| + | forever: % Repeatedly reduces the size of the image, as this is done round zero it also moves it to the zero location, until it fits in the area | ||
| + | | ||
| + | qq:= qq scaled (0.99 ); | ||
| + | endfor; | ||
| + | fi | ||
| + | if pointinside((i, | ||
| + | | ||
| + | | ||
| + | fi; | ||
| + | endfor; | ||
| + | | ||
| + | ); | ||
| + | % clip tmp_pic to p; %this appears not to be needed as the pointinside removes any outside the area | ||
| + | | ||
| + | draw tmp_pic; | ||
| + | enddef; | ||
| + | </ | ||
| + | |||
| + | The base_rotation is an attempt to produce bedding plane breakdown, it could do with more time but this is possible | ||
| + | |||
| + | {{: | ||
| + | |||
| + | using the settings | ||
| + | < | ||
| + | area blocks -attr shapes 1,2,4,7 -attr seperation 0.5 -attr block_random 0.7 -attr base_rotation 20 -attr random_rotation 5 -attr min_scale 0.5 -attr aspect 7 | ||
| + | </ | ||
| + | |||
| + | |||
| + | ---- | ||
| + | ---- | ||
| + | |||
| + | ===Transparent area=== | ||
| + | |||
| + | Q: Is there an additionally possibility to make this definition so that the area will be a bit transparent? | ||
| + | |||
| + | A: Try this code: | ||
| + | |||
| + | def a_u_lgrey(expr P) = | ||
| + | T: | ||
| + | thfill P withcolor (0.7, 0.7, 0.7) withalpha 0.5; | ||
| + | enddef; | ||
| + | |||
| ---- | ---- | ||
| ---- | ---- | ||
| - | =====Label and Text Examples===== | + | ====Label and Text Examples==== |
| - | **To make the debug station names smaller | + | ===To make the debug station names smaller=== |
| + | Stacho Mudrak | ||
| Currently, there is no easy way to do this, but it is possible. You just need to | Currently, there is no easy way to do this, but it is possible. You just need to | ||
| Line 503: | Line 2253: | ||
| ... and this line tells metapost to use font size 4 for station names.\\ | ... and this line tells metapost to use font size 4 for station names.\\ | ||
| \\ | \\ | ||
| - | **I want my north arrow to have a label, like "Norte Geografico" | ||
| - | | ||
| - | def s_northarrow_SKBB (expr rot) = | + | ===Altitude Point=== |
| - | T:=identity scaled 0.7 rotated -rot; | + | |
| - | begingroup | + | |
| - | interim defaultscale: | + | |
| - | label(btex Norte Geografico etex, (0, | + | |
| - | endgroup; | + | |
| - | thdraw (-.5cm, | + | |
| - | thfill (-.5cm, | + | |
| - | enddef; | + | |
| - | + | ||
| - | + | ||
| - | **Altitude Point**\\ | + | |
| {{: | {{: | ||
| from [[http:// | from [[http:// | ||
| // distributed under the GNU General Public License.// | // distributed under the GNU General Public License.// | ||
| + | |||
| + | This label requires to specify the position of text relative to point with help of -altitude. In this case -altitude bottom-right | ||
| def p_altitude(expr pos)= | def p_altitude(expr pos)= | ||
| Line 572: | Line 2311: | ||
| enddef; | enddef; | ||
| | | ||
| - | **To make 'point height' | + | ===Make |
| + | Martin Budaj | ||
| You just need to add following to your layout: | You just need to add following to your layout: | ||
| Line 583: | Line 2323: | ||
| | | ||
| | | ||
| - | **Conditional Printing of Text Labels**\\ | + | ===Conditional Printing of Text Labels=== |
| [[http:// | [[http:// | ||
| Line 594: | Line 2334: | ||
| =====Special Symbol Examples===== | =====Special Symbol Examples===== | ||
| Examples of North arrows, scale-bars, gridlines etc\\ | Examples of North arrows, scale-bars, gridlines etc\\ | ||
| + | ====North Arrows==== | ||
| + | ===I want my north arrow to have a label, like "Norte Geografico" | ||
| + | Carlos Grohmann & Martin Budaj | ||
| + | def s_northarrow_SKBB (expr rot) = | ||
| + | T:=identity scaled 0.7 rotated -rot; | ||
| + | begingroup | ||
| + | interim defaultscale: | ||
| + | label(btex Norte Geografico etex, (0,-1cm)); | ||
| + | endgroup; | ||
| + | thdraw (-.5cm, | ||
| + | thfill (-.5cm, | ||
| + | enddef; | ||
| + | |||
| + | ---- | ||
| - | **Northarrow 1** \\ | + | ===Northarrow 1=== |
| {{: | {{: | ||
| from [[http:// | from [[http:// | ||
| Line 618: | Line 2372: | ||
| enddef; | enddef; | ||
| - | **Northarrow 2** \\ | + | ===Northarrow 2=== |
| {{: | {{: | ||
| from [[http:// | from [[http:// | ||
| Line 638: | Line 2392: | ||
| endgroup; | endgroup; | ||
| enddef; | enddef; | ||
| + | | ||
| + | ===Northarrow 3=== | ||
| + | {{: | ||
| + | from Stacho Mudrák for version 5.3.x... | ||
| + | |||
| + | // distributed under the GNU General Public License.// | ||
| + | def s_northarrow_3 (expr rot) = | ||
| + | T: | ||
| + | picture tmp_pic; | ||
| + | tmp_pic = image ( | ||
| + | begingroup | ||
| + | interim defaultscale: | ||
| + | label.top(" | ||
| + | endgroup; | ||
| + | thdraw (-.4cm, | ||
| + | thfill (-.4cm, | ||
| + | thfill (.4cm, | ||
| + | thfill (.4cm, | ||
| + | thfill (-.4cm, | ||
| + | ); | ||
| + | draw tmp_pic scaled 0.5 rotatedaround(origin, | ||
| + | enddef; | ||
| + | |||
| + | ===Northarrow 4=== | ||
| + | {{: | ||
| + | {{[[metapost|: | ||
| + | |||
| + | from Dirk Peinelt for 5.3.16... | ||
| + | |||
| + | I combine this compass rose with a creation date in the map-header (/ | ||
| + | |||
| + | Martin Sluka: There is simple way to add actual date into Metapost code. I add modified variation after original code.\\ | ||
| + | |||
| + | If the CS is not set, the declination is Zero, and so based on the declination, | ||
| + | |||
| + | North grid/true rotate the whole plan with the north arrow. (meridianal Convergence) | ||
| + | |||
| + | def s_northarrow (expr rot) = | ||
| + | valscal=1.2; | ||
| + | decl: | ||
| + | T: | ||
| + | picture tmp_pic; | ||
| + | tmp_pic = image ( | ||
| + | pickup pencircle scaled .3; | ||
| + | thfill fullcircle scaled 4cm withcolor 1white; | ||
| + | thdraw fullcircle scaled 3.1cm; | ||
| + | thdraw fullcircle scaled 4.05cm; | ||
| + | pickup pencircle scaled .1; | ||
| + | thdraw fullcircle scaled 3cm; | ||
| + | thdraw fullcircle scaled 4cm; | ||
| + | pickup pencircle scaled .2; | ||
| + | thdraw (dir(45)*2.025cm)--(dir(45)*3.7cm); | ||
| + | thdraw (dir(135)*2.025cm)--(dir(135)*3.7cm); | ||
| + | thdraw (dir(225)*2.025cm)--(dir(225)*3.7cm); | ||
| + | thdraw (dir(315)*2.025cm)--(dir(315)*3.7cm); | ||
| + | pickup pencircle scaled .1; | ||
| + | for whereto=0 step 15 until 345: | ||
| + | thdraw dir(whereto)*.65cm--dir(whereto)*.9cm; | ||
| + | thdraw dir(whereto)*1.4cm--dir(whereto)*1.5cm; | ||
| + | endfor; | ||
| + | for whereto=0 step 5 until 355: | ||
| + | thdraw dir(whereto)*.65cm--dir(whereto)*.8cm; | ||
| + | thdraw dir(whereto)*1.45cm--dir(whereto)*1.5cm; | ||
| + | endfor; | ||
| + | for whereto=0 step 1 until 359: | ||
| + | thdraw dir(whereto)*1.94cm--dir(whereto)*2cm; | ||
| + | endfor; | ||
| + | pickup pencircle scaled 1; | ||
| + | thdraw fullcircle scaled 1cm; | ||
| + | thdraw fullcircle scaled 1.1cm; | ||
| + | thdraw fullcircle scaled 1.3cm withpen pencircle scaled .3; | ||
| + | vald=90-decl; | ||
| + | texrot=0-decl; | ||
| + | drawarrow(dir(vald)*-2cm--dir(vald)*2cm) withpen pencircle scaled .2; | ||
| + | if (MagDecl <> 0): thdraw image(label.top(btex $mg$ etex, (0,0)) scaled .5 rotated texrot;) shifted (dir(vald)*2.04cm); | ||
| + | thfill (1.06cm, | ||
| + | thfill (-.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (-.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (-.2cm, | ||
| + | thfill (-.2cm, | ||
| + | pickup pencircle scaled .2; | ||
| + | thdraw (-.2cm, | ||
| + | thfill fullcircle scaled .56cm withcolor 1white; | ||
| + | pickup pencircle scaled .1; | ||
| + | thdraw (.28cm, | ||
| + | pickup pencircle scaled .4; | ||
| + | thdraw (.2cm, | ||
| + | if (MagDecl = 0): label.bot(btex $Nmag$ etex, (0,2.6cm)); else: label.bot(btex $N$ etex, (0,2.6cm)); fi; | ||
| + | label.lft(btex $E$ etex, (2.6cm,0)); | ||
| + | label.rt(btex $W$ etex, (-2.6cm, | ||
| + | label.top(btex $S$ etex, (0, | ||
| + | ); | ||
| + | thdraw tmp_pic scaled valscal rotatedaround(origin, | ||
| + | enddef; | ||
| + | |||
| + | ===Northarrow 4a=== | ||
| + | {{: | ||
| + | With actual date\\ | ||
| + | If you want to use another font, check, please, one which include character " | ||
| + | |||
| + | def s_northarrow (expr rot) = | ||
| + | valscal=1.2; | ||
| + | decl: | ||
| + | T: | ||
| + | picture tmp_pic; | ||
| + | tmp_pic = image ( | ||
| + | pickup pencircle scaled .3; | ||
| + | thfill fullcircle scaled 4cm withcolor 1white; | ||
| + | thdraw fullcircle scaled 3.1cm; | ||
| + | thdraw fullcircle scaled 4.05cm; | ||
| + | pickup pencircle scaled .1; | ||
| + | thdraw fullcircle scaled 3cm; | ||
| + | thdraw fullcircle scaled 4cm; | ||
| + | pickup pencircle scaled .2; | ||
| + | thdraw (dir(45)*2.025cm)--(dir(45)*3.7cm); | ||
| + | thdraw (dir(135)*2.025cm)--(dir(135)*3.7cm); | ||
| + | thdraw (dir(225)*2.025cm)--(dir(225)*3.7cm); | ||
| + | thdraw (dir(315)*2.025cm)--(dir(315)*3.7cm); | ||
| + | pickup pencircle scaled .1; | ||
| + | for whereto=0 step 15 until 345: | ||
| + | thdraw dir(whereto)*.65cm--dir(whereto)*.9cm; | ||
| + | thdraw dir(whereto)*1.4cm--dir(whereto)*1.5cm; | ||
| + | endfor; | ||
| + | for whereto=0 step 5 until 355: | ||
| + | thdraw dir(whereto)*.65cm--dir(whereto)*.8cm; | ||
| + | thdraw dir(whereto)*1.45cm--dir(whereto)*1.5cm; | ||
| + | endfor; | ||
| + | for whereto=0 step 1 until 359: | ||
| + | thdraw dir(whereto)*1.94cm--dir(whereto)*2cm; | ||
| + | endfor; | ||
| + | pickup pencircle scaled 1; | ||
| + | thdraw fullcircle scaled 1cm; | ||
| + | thdraw fullcircle scaled 1.1cm; | ||
| + | thdraw fullcircle scaled 1.3cm withpen pencircle scaled .3; | ||
| + | vald=90-decl; | ||
| + | texrot=0-decl; | ||
| + | drawarrow(dir(vald)*-2cm--dir(vald)*2cm) withpen pencircle scaled .2; | ||
| + | if (MagDecl <> 0): | ||
| + | string z; | ||
| + | z = ("mg " & (decimal day) & ". " & (decimal month) & ". " & (decimal year)); | ||
| + | thdraw image(label.urt( z infont " | ||
| + | fi; | ||
| + | thfill (1.06cm, | ||
| + | thfill (-.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (-.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (.2cm, | ||
| + | thfill (-.2cm, | ||
| + | thfill (-.2cm, | ||
| + | pickup pencircle scaled .2; | ||
| + | thdraw (-.2cm, | ||
| + | thfill fullcircle scaled .56cm withcolor 1white; | ||
| + | pickup pencircle scaled .1; | ||
| + | thdraw (.28cm, | ||
| + | pickup pencircle scaled .4; | ||
| + | thdraw (.2cm, | ||
| + | if (MagDecl = 0): label.bot(btex $Nmag$ etex, (0,2.6cm)); else: label.bot(btex $N$ etex, (0,2.6cm)); fi; | ||
| + | label.lft(btex $E$ etex, (2.6cm,0)); | ||
| + | label.rt(btex $W$ etex, (-2.6cm, | ||
| + | label.top(btex $S$ etex, (0, | ||
| + | ); | ||
| + | thdraw tmp_pic scaled valscal rotatedaround(origin, | ||
| + | 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 < | ||
| + | It can also optionally display the meridian grid convergence, | ||
| + | |||
| + | {{: | ||
| + | |||
| + | // 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 | ||
| + | thdraw (-.5cm, -1cm)--(0, 1.5cm)--(.5cm, | ||
| + | thfill (-.5cm, -1cm)--(0, 1.5cm)--(0, -.5cm)--cycle; | ||
| + | endgroup; | ||
| + | | ||
| + | begingroup | ||
| + | thfill ((-.6cm, -.35cm)--(-.6cm, | ||
| + | thdraw | ||
| + | interim defaultscale: | ||
| + | newinternal string dirText; dirText: | ||
| + | | ||
| + | if known northArrowShowGridConvergence: | ||
| + | label(dirText, | ||
| + | label(" | ||
| + | else: | ||
| + | | ||
| + | fi | ||
| + | endgroup; | ||
| + | | ||
| + | enddef; | ||
| + | endcode | ||
| + | ===Shaded Compass Rose pointing to the magnetic North=== | ||
| + | from Juraj Halama for version 5.5.3 | ||
| + | |||
| + | {{: | ||
| + | |||
| + | // 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/ | ||
| + | endfor; | ||
| + | % arrows | ||
| + | path halfarrow; | ||
| + | halfarrow = (+.3cm, | ||
| + | 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, | ||
| + | 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, | ||
| + | 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(" | ||
| + | label.lft(thTEX(" | ||
| + | label.rt (thTEX(" | ||
| + | label.top(thTEX(" | ||
| + | % 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; | ||
| + | |||
| - | **Scalebar 1**\\ | + | ====Scalebars==== |
| + | ===Scalebar 1=== | ||
| {{: | {{: | ||
| from [[http:// | from [[http:// | ||
| Line 669: | Line 2698: | ||
| enddef; | enddef; | ||
| - | **Scalebar 2**\\ | + | ===Scalebar 2=== |
| {{: | {{: | ||
| from [[http:// | from [[http:// | ||
| Line 699: | Line 2728: | ||
| enddef; | enddef; | ||
| - | **Scalebar Bar length | + | ===Scalebar 2b=== |
| + | By B. Hallinger; This is the same scalebar from above, except that it subdivides the first block. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | code metapost | ||
| + | def s_scalebar (expr l, units, txt) = | ||
| + | % l = value of scale-bar length | ||
| + | % units = ?? | ||
| + | % txt = string representing units | ||
| + | begingroup | ||
| + | interim warningcheck: | ||
| + | tmpl:=l / Scale * cm * units / 2; | ||
| + | % tmpl = half plotted | ||
| + | tmpx:=l / Scale * cm * units / 5; | ||
| + | tmph:=5bp; % bar height | ||
| + | endgroup; | ||
| + | pickup PenC; | ||
| + | draw (-tmpl, | ||
| + | p: | ||
| + | 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: | ||
| + | for i:=-2.5 step 2/5 until -0.75: | ||
| + | fill p shifted (i * tmpx,0) withcolor black; | ||
| + | endfor; | ||
| + | |||
| + | % Label of scale: Scalebar top, values below | ||
| + | begingroup | ||
| + | interim labeloffset: | ||
| + | for i:=0 step (l/5) until (l-1): | ||
| + | tmpx:=tmpl * (i * 2 / l - 1); | ||
| + | label.bot(thTEX(decimal (i)), | ||
| + | endfor; | ||
| + | label.bot(thTEX(decimal (l) & "\thinspace" | ||
| + | label.top(thTEX(" | ||
| + | endgroup; | ||
| + | |||
| + | enddef; | ||
| + | endcode | ||
| + | |||
| + | |||
| + | ===Scalebar Bar length adjustment=== | ||
| from Andrew Atkinson | from Andrew Atkinson | ||
| Line 716: | Line 2790: | ||
| draw (tmpl-0.25*u/ | draw (tmpl-0.25*u/ | ||
| - | **Code to change | + | ===Scalebar 3=== |
| + | {{: | ||
| + | |||
| + | layout LayoutScalebar3 # Scalebar by Chris Hayes | ||
| + | code metapost | ||
| + | def s_scalebar (expr l, units, txt) = | ||
| + | begingroup | ||
| + | interim warningcheck: | ||
| + | tmp05: | ||
| + | tmp10: | ||
| + | tmp20: | ||
| + | tmp40: | ||
| + | tmp60: | ||
| + | tmp80: | ||
| + | tmp100: | ||
| + | scal05: | ||
| + | scal10: | ||
| + | scal20: | ||
| + | scal40: | ||
| + | scal60: | ||
| + | scal80: | ||
| + | brht:= 5bp; | ||
| + | lblht:= 8bp; | ||
| + | endgroup; | ||
| + | pickup PenC; | ||
| + | draw (0, | ||
| + | draw (tmp05, | ||
| + | draw (tmp10, | ||
| + | draw (tmp20, | ||
| + | draw (tmp40, | ||
| + | draw (tmp60, | ||
| + | draw (tmp80, | ||
| + | fill (tmp05, | ||
| + | fill (tmp20, | ||
| + | fill (tmp60, | ||
| + | begingroup | ||
| + | label.top(thTEX(decimal (l) & " | ||
| + | label.top(thTEX(decimal (scal80)), | ||
| + | label.top(thTEX(decimal (scal60)), | ||
| + | label.top(thTEX(decimal (scal40)), | ||
| + | label.top(thTEX(decimal (scal20)), | ||
| + | label.top(thTEX(decimal (scal10)), | ||
| + | label.top(thTEX(decimal (scal05)), | ||
| + | label.top(thTEX(decimal (0)), | ||
| + | endgroup | ||
| + | enddef; | ||
| + | endcode | ||
| + | endlayout LayoutScalebar3 | ||
| + | |||
| + | ===Vertical scalebar=== | ||
| + | {{: | ||
| + | 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: | ||
| + | % interim defaultscale: | ||
| + | label.rt(thTEX(" | ||
| + | for i := 1 step 1 until l / 5: | ||
| + | if (i mod 10) = 0: | ||
| + | label.rt(thTEX(" | ||
| + | else: | ||
| + | if i * 5 = l: | ||
| + | label.rt(thTEX(" | ||
| + | else: | ||
| + | label.rt(thTEX(" | ||
| + | fi | ||
| + | fi; | ||
| + | endfor; | ||
| + | if (l mod 5) <> 0: | ||
| + | label.rt(thTEX(" | ||
| + | fi; | ||
| + | endgroup | ||
| + | enddef; | ||
| + | |||
| + | endcode | ||
| + | |||
| + | code tex-map | ||
| + | |||
| + | \def\maplayout{ | ||
| + | \legendbox{102.5}{100.4}{NW} | ||
| + | { | ||
| + | \scalebar | ||
| + | } | ||
| + | } | ||
| + | endcode | ||
| + | |||
| + | endlayout | ||
| + | ====Gridlines==== | ||
| + | ===Change | ||
| from Stacho Mudrak (mostly) and Bruce Mutton 2007 | from Stacho Mudrak (mostly) and Bruce Mutton 2007 | ||
| Line 726: | 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, |
| 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, |
| enddef; | enddef; | ||
| endcode | endcode | ||
| Line 821: | Line 3020: | ||
| thclean Path; | thclean Path; | ||
| pickup PenD; | pickup PenD; | ||
| - | if known colour_sump_bg: | + | if known colour_sump_bg: |
| 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 836: | Line 3035: | ||
| T: | T: | ||
| pickup pensquare scaled (1.0*u/10); | pickup pensquare scaled (1.0*u/10); | ||
| - | if known colour_rope: | + | if known colour_rope: |
| fi; | fi; | ||
| pickup PenC; | pickup PenC; | ||
| Line 912: | 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===== |
| - | ---- | + | |
| - | ===== Other MetaPost Stuff===== | + | Juraj Halama 2020 for Therion 5.5.3\\ |
| - | | + | {{:metapost: |
| - | [[templates# | + | |
| + | 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, | ||
| + | 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, | ||
| + | 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: | ||
| + | text sk "point u: | ||
| - | ---- | ||
| - | ---- | ||