Every time I have a good idea, I eventually realise why it will not work. Sigh...
So I think the way forward may be to understand and build on the general point label definition.... vardef p_label@#(expr txt,pos,rot,mode) = if (mode=1) or (mode=7): interim labeloffset:=(u/8) fi; lab:=thelabel@#(txt, pos); if mode>1: pickup PenD fi; if mode=1: pickup pencircle scaled (u/6); drawdot(pos); process_label(pos,0); elseif mode=2: process_uplabel; elseif mode=3: process_downlabel; elseif mode=4: process_updownlabel; elseif mode=5: process_circledlabel; elseif mode=6: process_boxedlabel; elseif mode=7: process_label(pos,rot); % station name elseif mode=8: process_filledlabel(pos, rot); else: process_label(pos,rot); fi; enddef; Thomas Holder modified it to get custom ‘point altitude’ here https://therion.speleo.sk/wiki/metapost#label_and_text_examples It is interesting as I don’t think there is a ‘point altitude’ definition present in the Therion distribution, but Thomas has created one to use in conjunction with a modification of the p_label definition above. The situation may be similar for ‘point height’. And Stacho Mudrak once proposed another modification to enable any text label to be hidden, based on a user specified attribute. http://article.gmane.org/gmane.comp.gis.therion/933/match=importance+scaling+text+orientation In principle this approach would allow us to add a box or some other characteristic to any text label. It might be helpful to figure out what the mode settings refer to. Here are my deductions so far. mode = -1 % symbol does not or cannot have a text property mode = 0 % point label mode = 1 % point altitude mode = 2 % point passage-height +ve mode = 3 % point passage-height -ve mode = 4 % point passage-height both +ve and -ve mode = 5 % point passage-height unsigned mode = 6 % ?? (this is the so-called ‘boxed_label’) mode = 7 % point station-name, point height mode = 8 % ?? (this is the so-called ‘filled_label’) Missing entities include ‘remark’, ‘date’ If anyone knows better, please let me know. This bit of code that puts continuation text inside a coloured text box might also provide insight for a one-off solution as well. code metapost def p_continuation(expr pos,theta,sc,al) = %# draw default continuation symbol ie ? p_continuation_UIS(pos,theta,sc,al); %# if text attribute is set if known(ATTR__text) and picture(ATTR__text): %# set labeling color to light orange push_label_fill_color(1.0, 0.9, 0.8); %# draw filled label with text next to symbol ? p_label.urt(ATTR__text,(.5u,-.25u) transformed T,0.0,8); %# restore original labeling color pop_label_fill_color; fi; enddef; endcode Bruce -----Original Message----- From: Therion <therion-boun...@speleo.sk <mailto:therion-boun...@speleo.sk> > On Behalf Of Bruce Mutton via Therion Sent: Sunday, 23 September 2018 10:25 To: 'List for Therion users' <therion@speleo.sk <mailto:therion@speleo.sk> > Cc: Bruce Mutton <br...@tomo.co.nz <mailto:br...@tomo.co.nz> > Subject: Re: [Therion] Height numbers in square boxes Maybe we can use an approach that Thomas Holder demonstrated here <https://therion.speleo.sk/wiki/metapost#scale_dependant_visualization_of_symbols> https://therion.speleo.sk/wiki/metapost#scale_dependant_visualization_of_symbols def l_rockborder (expr p) = if abs(llcorner p - urcorner p) > u: l_rockborder_UIS(p); fi; enddef; Simply enclosing an existing metapost definition within a user customised metapost wrapper. In the case above, it is "if the symbol is big enough, draw it". What we want instead is, "draw the symbol, draw a box around it". I expect something like bbox should enable us to put a line around a symbol, regardless of whether it is a text or arbitrary linework. I'll leave it to someone else to explore... Bruce -----Original Message----- From: Therion < <mailto:therion-boun...@speleo.sk> therion-boun...@speleo.sk> On Behalf Of Andrew Atkinson via Therion Sent: Friday, 21 September 2018 09:16 To: <mailto:therion@speleo.sk> therion@speleo.sk Cc: Andrew Atkinson < <mailto:and...@wotcc.org.uk> and...@wotcc.org.uk> Subject: Re: [Therion] Height numbers in square boxes ... Yes I'm having similar problems to you defining a box, my skills are generally limited to copying existing definitions and adjusting them slightly. My guess is that it is not a metapost, it is tex as it is a label, in tex you can put a box round text with \fbox{4} but how or if you can use that in therion I do not know. It is a problem that is interesting me, as I think it is something that I might want to use. Andrew _______________________________________________ Therion mailing list <mailto:Therion@speleo.sk> Therion@speleo.sk <https://mailman.speleo.sk/listinfo/therion> https://mailman.speleo.sk/listinfo/therion
_______________________________________________ Therion mailing list Therion@speleo.sk https://mailman.speleo.sk/listinfo/therion