Thank you very much!
indeed i was really close. Time to go to bed, hopefully my eyes can find
the bed :)
It is also already mentioned correctly at the therion book. However,
maybe it would be good to add footnote at page 35 so this is made more
obvious.
The working code below, in case someone tries to google it.
Attached also screenshots:
- in the legend the current survey name is printed
- in the map the "-attr text 1234" is honored.
point symbol in th2-file: point u:mappe -attr text "1234"
--------------------
# Symbol to denote assigned survey.
# If option -attr text <string> is given, it will be used; otherwise
current survey is shown.
def p_u_mappe(expr pos, theta, sc, al) =
T:=identity aligned al rotated theta scaled sc shifted pos;
% GET LABEL TEXT:
string txt;
if known(ATTR_text):
txt := ATTR_text;
else:
txt := ATTR__survey;
fi;
% DRAW LABEL:
lab:=thelabel(txt, pos);
process_label(pos, 0.001);
% BORDER:
pickup PenA; % border thickness
interim bboxmargin:=6.5bp; % padding border->text
q:=((bbox lab) smoothed 4); % smoothness of corners
draw q;
enddef;
--------------------
Am 2020-02-27 0:37, schrieb Tarquin Wilton-Jones via Therion:
Hi Benedikt,
txt := "123";
txt := ATTR__text; % does not work. How do i get the value
from
You are so nearly right.
Two underscores for Therion's built in properties. One underscore for
-attr properties.
ATTR_text
I have an example here:
https://therion.speleo.sk/wiki/metapost#rope_lengths
Regarding your main question, no I don't know how to create custom
label
ornamentation (it looks like black magic to me). But you can see what I
have learned here:
https://therion.speleo.sk/wiki/metapost#adding_custom_styled_labels_at_any_point_linepoint
And then you need to look through the Metapost debugging output for:
vardef p_label@#(expr txt,pos,rot,mode) =
That is the code that actually draws labels with ornamentation. It then
calls functions like this: process_circledlabel
That in turn - after writing a label - uses some kind of bounding box
measuring to decide how to ornament it. Check out the function:
def write_circ_bbox expr q =
Good luck sir. If you work it out, please document it so we can all
learn how it all works. :)
Cheers,
Tarquin
_______________________________________________
Therion mailing list
[email protected]
https://mailman.speleo.sk/listinfo/therion
_______________________________________________
Therion mailing list
[email protected]
https://mailman.speleo.sk/listinfo/therion