[Therion] symbol-show fixed points / point text

Bruce bruce at tomo.co.nz
Tue Nov 29 19:20:25 CET 2011


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/20111130/7b86da4a/attachment.htm>


More information about the Therion mailing list