Hi Bruce, I've solved the problem - obvious really - I need to use p_station, not p_station_SKBB. I'll send the example through later - I need to copy it off another computer. Regards, - Ben
_____ From: therion-bounces at speleo.sk [mailto:therion-boun...@speleo.sk] On Behalf Of Ben Cooper Sent: 30 November 2011 22:35 To: 'List for Therion users' Subject: Re: [Therion] symbol-show fixed points / point text Hi Bruce, You beat me to it! I've spent the last few days learning metapost and rummaging around the bowels of the Therion's source code and have more or less got to what you have summarised below. I also spotted the smartlabel, though haven't yet tried it in the re-definition of p_continuation. I surmise that stations with fixed co-ordinates are not exported by Therion in any detectable way; while the th2 mark "fixed" is exported as "mark", and the th2 flags are exported as "flags". The items that are exported are accessible in metapost. In the debug output data.mp file, I saw that "attr code" is exported by Therion as ATTR_code, where "code" is whatever attr has been declated in the th2 file. Note that it only has one "_" whereas ATTR__text has two "_". So one thing I tried that did work is to print the value of my user define attr statements instead of the text, which is potentially quite useful, as I can display a short code, and use continuation.html for the longer description. However, this still relies on having the "continuation" flag set. I used the following re-definition of p_continuation using ATTR_code instead of the example's ATTR__text, as follows **THE FOLLOWING WORKS** code metapost def p_continuation(expr pos,theta,sc,al) = % draw default continuation symbol p_continuation_UIS(pos,theta,sc,al); % if attr code is set if known(ATTR_code): % set labeling color to light orange push_label_fill_color(1.0, 0.9, 0.8); % draw filled label with text next to ? p_label.urt(ATTR_code,(.5u,-.25u) transformed T,0.0,8); % restore original labeling color pop_label_fill_color; fi; enddef; endcode Looking at p_station_SKBB, the problem you and I are facing is that it's only for the "continuation" flags that ATTR__text has been set. It occurred to me that if it was possible to refedine p_station_SKBB in the thconfig file, then it would be possible to output ATTR__text if an "attr code" has been declared in the th2 file. For example, th2 file:- station 1 "Some text to output" entrance attr print "true" My example p_station_SKBB is below. Unfortunately, I've so far not managed to see it being executed. I can see it appear in the data.mp debug file, but the changes I've made to it don't appear to work - the text is not yet being output to my pdf file. Also, I don't understand yet the purpose of the metapost "save" command, and the manual doesn't really shed much light on it! So it's possible that I've just not yet properly understood metapost syntax. This is the sort of thing I've got in mind ** WARNING, THE FOLLOWING IS NOT YET WORKING ** def p_station_SKBB(expr pos,mark,txt)(text flags) = T:=identity shifted pos; if mark=4: p_station_fixed(pos) elseif mark=3: p_station_natural(pos) elseif mark=2: p_station_painted(pos) elseif mark=1: p_station_temporary(pos) fi; path path_cave; path_cave = (-.3u,-.25u) -- (-.2u,-.25u){dir 135} .. (0, .25u) .. {dir 225}(.2u,-.25u) -- (.3u,-.25u); for i=flags: % ... etc. No change to contents of for-loop endfor; % if the "print" attribute is set to true, display the text if known (ATTR_print) and ATTR_print="true": if picture(txt): picture ATTR__text; ATTR__text := txt; % set labeling color to light orange push_label_fill_color(1.0, 0.9, 0.8); % draw filled label with text next to ? p_label.urt(ATTR__text,(.5u,-.25u) transformed T,0.0,8); % restore original labeling color pop_label_fill_color; save ATTR__text; fi; % thdraw (0,0) withpen PenX withcolor red; enddef; You're welcome to try it to see if you can get it to work! Regards, - Ben _____ From: therion-bounces at speleo.sk [mailto:therion-boun...@speleo.sk] On Behalf Of Bruce Sent: 29 November 2011 18:20 To: 'List for Therion users' Subject: Re: [Therion] symbol-show fixed points / point text Ben I think the following (dumped below) from the therion sources mpost\thPoint.mp holds the solution to what we are looking for. And I think the smartlabel is the wonderous self organising label routine. I have not had time to verify all this however. Stacho tried to point me to it http://article.gmane.org/gmane.comp.gis.therion/2468/match=symbol+show+fixed +points+text but I did not follow up on it. The first definition below is the code for drawing the ? symbol of a continuation point. You just need to replace the thdraw statements with the symbol you would like. Don't ask me how - my approach is to trawl the rest of the therion code for a symbol I like and perhaps tweak it a little. The second shows how mark is used to decide what station 'x' mark to use, and then how the flags control how the secondary symbols are added. The %% comments are mine, so may not be correct. It shows that station comment text is only added if the station is flagged entrance. I think moving the smartlabel into all but the station_temporary conditional statements might be what we are after. Bruce def p_continuation_UIS(expr pos,theta,sc,al) = U:=(.15u,.3u); T:=identity aligned al shifted pos; %% draw ? symbol pickup PenC; thdraw (-.1u,.2u){up}..{down}(.1u,.2u)..{down}(0,-.05u); pickup PenX; thdraw (0,-.2u); enddef; def p_station_SKBB(expr pos,mark,txt)(text flags) = T:=identity shifted pos; if mark=4: p_station_fixed(pos) elseif mark=3: p_station_natural(pos) elseif mark=2: p_station_painted(pos) elseif mark=1: p_station_temporary(pos) fi; path path_cave; %% = omega symbol path_cave = (-.3u,-.25u) -- (-.2u,-.25u){dir 135} .. (0, .25u) .. {dir 225}(.2u,-.25u) -- (.3u,-.25u); for i=flags: pickup PenX; if i="entrance": % thfill fullcircle scaled 1 cm withtransparentcolor tr_blue; thdraw path_cave; % p_label.urt(txt,pos+(0.4u,0),0,0); %% move this if block outside of for loop to label all stations, not just flagged entrance if not numeric txt: p_smartlabel(txt,pos); %% This is the wonderous self organising label i think fi; %% elseif i="sink": thdraw path_cave cutbefore ((-u,0)--(u,0)) cutafter ((-u,0)--(u,0)); pickup PenA; thdraw (0,-.45u) -- (0,.05u) withcolor blue; thdraw (-.15u,-.02u) -- (0,.05u) -- (.15u,-.02u) withcolor blue; elseif i="spring": thdraw path_cave cutbefore ((-u,0)--(u,0)) cutafter ((-u,0)--(u,0)); pickup PenA; thdraw (0,-.45u) -- (0,.05u) withcolor blue; thdraw (-.15u,-.38u) -- (0,-.45u) -- (.15u,-.38u) withcolor blue; elseif i="doline": thdraw (-.5u,.05u){down}..(0,-0.6u)..{up}(.5u,.05u); elseif i="dig": thdraw (-.5u,.25u) -- (-.35u,.25u)--(-.23u,-.25u)--(.23u,-.25u)--(.35u,.25u)--(.5u,.25u); elseif substring(0,11) of i = "air-draught": pickup PenB; thdraw ((0,.11u){dir-120} ..{dir-70}(0,0) .. {dir-120}(0,-.11u)); thdraw ((0,.11u){dir-120} ..{dir-70}(0,0) .. {dir-120}(0,-.11u)) shifted (.11u,0); thdraw ((0,.11u){dir-120} ..{dir-70}(0,0) .. {dir-120}(0,-.11u)) shifted (-.11u,0); elseif i="continuation": if picture(txt): picture ATTR__text; ATTR__text := txt; fi; begingroup; save T; transform T; p_continuation(pos+(0,.25u),0,1,(0,1)); endgroup; if picture(txt): save ATTR__text; fi; elseif i="arch": thdraw (-.5u,-.25u)--(-.5u,.25u)--(.5u,.25u)--(.5u,-.25u)..(0,.2u)..cycle; thfill (-.5u,-.25u)--(-.5u,.25u)--(.5u,.25u)--(.5u,-.25u)..(0,.2u)..cycle; elseif i="overhang": thdraw (.2u,-.25u)--(-.2u,-.25u){up}..{right}(.2u,.25u); fi; endfor; % thdraw (0,0) withpen PenX withcolor red; enddef; -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20111201/c84c0c92/attachment.html>