[Therion] Need metapost wizard: new text label

Benedikt Hallinger beni at hallinger.org
Wed Feb 26 23:47:40 CET 2020


Hello,
meanwhile i tried to play more with this.
I'm nearly there, however i still have no clue how to read out the text 
attribute i attached to the symbol in the th2. "txt := ATTR__text;" 
throws metapost out the window.

The point is defined like this:
   point 234.0909090909091 626.3636363636364 u:mappe -attr text 1234


Layout i came up with so far (does not support 
scaling/alignment/rotation, but thats fine so far):



---------------------
layout m

   # Symbol to denote assigned survey.
   # If option -attr text <string> is given, it will be used; otherwise 
current survey is shown.
   code metapost
     def p_u_mappe(expr pos, theta, sc, al) =
       T:=identity aligned al rotated theta scaled sc shifted pos;

       % GET LABEL TEXT:
       string txt;
       txt := "123";
       %txt := ATTR__text;   % does not work. How do i get the value from 
' -attr text "345" '?
       if known(ATTR__text):
         txt := ATTR_text;   % NEVER evaluates to TRUE!?!?
       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;

     initsymbol("p_u_mappe");
   endcode
endlayout
---------------------


Am 2020-02-19 18:34, schrieb Benedikt Hallinger:
> Hi there,
> i need some new point symbol (text label). Its a simple text on white
> color within a box with rounded corners, like the attached image.
> 
> 
> My metapostskills are not good enough to get this to work...
> 
> For now i would be happy to have such a user point symbol.
> It would be important that it scales well and react to xtherions
> direction setting.
> 
> Optional it would be cool if the default symbol could show the current
> survey identifier of the nearest station in the scrap and maybe also
> the nearest next survey.
> But this information could also be maintained manually for now.
> 
> Is there someone here for my rescue? :)
> Thanks in advance,
> Beni



More information about the Therion mailing list