[Therion] Selective output of label text

Bruce Mutton bruce.mutton at paradise.net.nz
Sun Feb 15 10:03:12 CET 2009


>just add following to the options for point labels you want to show
>(all other labels will be hidden):

>-attr visibility on

>('visibility' and 'on' are just strings you can freely choose; just
>match them in the metapost macros)

>and use modified label definition in code tex-mpost


  vardef p_label@#(expr txt,pos,rot,mode) =

   if known ATTR_visibility: if ATTR_visibility="on":  % ADDED CONDITIONS

    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;

   fi; fi;  % END OF CONDITIONS

  enddef;

>Martin
>_______________________________________________


Martin
In trying various versions of the above, the best I can get is an error; 
	"...
	converting scraps ... done
	making map ... D:\Program Files\Therion\therion.exe: error -- Can't
open file
	writing xtherion file ... done
"
I have tried many combinations of string, numeric, quotes, no quotes for the
-attr variables parsed, and most cause identifiable metapost errors. If I
comment out the metapost code it compiles perfectly.  I'm a bit lost and
assume I'm making a simple mistake somewhere.

However, before pursuing this approach too much further, it is apparent that
adding extra attributes to labels is a big imposition when they already have
a -scale attribute that matches, more or less, their 'importance'.  I have
18km of plans and elevations to adjust!
Better to link the visibility of labels (and other entities perhaps) to the
scale, ie at 1:1000 print all labels, at 1:5000 print only labels with
-scale l and -scale xl.  The attached file gives an indication of the
approach I am looking at, and it will mean little or no change to my scrap
drawings is needed.

So, is there a way to modify the metapost code to progressively hide labels
of -scale xs, s, m etc as the output scale increases from 1:1000, 1:2000,
1:5000 etc?  

Also I will need to modify the code for many entities I assume.  Ie line
label, point passage-gradient (perhaps?) and not just point label.  There
must be a location in my Windows Installation from where I can pluck the
code for all the Therion entities, once I can figure out the pattern for the
changes required?

Or perhaps a simpler approach is to modify the syntax following;
	code metapost
	fonts_setup(0,0,0,4,6);
where a font size of 0 means it is not printed (currently returns an error).

Thanks for your patience.
Any further guidance appreciated.
Bruce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LayoutScales.thc
Type: application/octet-stream
Size: 3117 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20090215/9bee2014/attachment.obj>


More information about the Therion mailing list