On Wed, Feb 3, 2010 at 10:43 AM, Bruce <dangle@tomo.co.nz> wrote:
I have just noticed Thomas Holders metapost sample for hiding small rocks at large scale reductions.
def l_rockborder (expr p) =
if abs(llcorner p - urcorner p) > u:
l_rockborder_UIS(p);
fi;
enddef;
What would be the chances of this working in the form presented above for point objects?
You would need to use something like if abs(U) > 3pt: p_symbol_UIS(p); fi; where abs(U) means (approximate) distance from the centre of the point symbol to the upper-right corner. The U variable is defined for all (or almost all) point symbols directly in the symbol definition. It means that you would need to implement the test after the U is defined (so you need to change the definition of the original symbol; it would be not enough just to define wrapper symbol like in l_rockborder example). Another possibility is create wrapper symbol which 1) draws the desired symbol in the temporary picture 2) measures the dimensions of temporary picture 3) decides whether to draw the symbol. But this would be quite slow.
Or for labels as below?
The easiest way would be to enhance p_label symbol itself: vardef p_label@#(expr txt,pos,rot,mode) = if (mode=1) or (mode=7): interim labeloffset:=(u/8) fi; lab:=thelabel@#(txt, pos); if abs(llcorner bbox lab - urcorner bbox lab) > u: % here is the size test 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; % end of size test enddef;
Or modified to show or hide point objects depending on the value of the –scale property?
You can test even for user-defined attributes. martin