Re: [Therion] specific which label appears in output

2021-01-31 Thread Axel
morning,

 

finally got time to test the modified macro and it works perfectly, thanks a lot!
It's also good to know what is causing the issue. Not that I understand whats happening inside Therion, but it feels better anyway :D

 

have a nice Sunday,
Axel


 

Gesendet: Sonntag, 24. Januar 2021 um 12:17 Uhr
Von: "Martin Budaj" 
An: "List for Therion users" 
Betreff: Re: [Therion] specific which label appears in output

On Sun, Jan 17, 2021 at 8:02 PM Axel  wrote:
> for an overview map I need to specific the labels I want to have in the output. Just sorting them by size is not possible. After searching I found a label re-definition at http://marcocorvi.altervista.org/caving/tbe/m_07/m_072.htm (7.2.10).
>
> Works like a charm in a small cave but taken to my project it behaves odd:
> If I compile, Therion (5.5.6) gives this error (and creates no map):
> converting scraps ... done
> making map ... C:\Program Files (x86)\Therion\therion.exe: error -- Can't open file data.8bbox!

Therion expects to find a *bbox file for each scrap containing labels.
It is generated by metapost when the labels are processed. In your
case, you instructed metapost to skip all the labels in a scrap (so no
*bbox file was produced), but therion knows there were some labels
defined for that scrap (if you displayed at least one label in the
scrap, the *bbox file would be generated). The easiest solution is to
create an empty *bbox file if there is none by writing an empty string
to it. Here is a modified Marco's macro:

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: % altitude
pickup pencircle scaled (u/6);
drawdot(pos);
process_label(pos,0);
elseif mode=2: process_uplabel; % passage height
positive
elseif mode=3: process_downlabel; % passage height
negative
elseif mode=4: process_updownlabel; % passage height both
elseif mode=5: process_circledlabel; % passage height
unsigned.
elseif mode=6: process_boxedlabel;
elseif mode=7: process_label(pos,rot); % station name
elseif mode=8: process_filledlabel(pos, rot);
else: % mode=0 date
process_label(pos,rot);
fi;
else:
write "" to jobname & "." & decimal(charcode) & "bbox";
fi;
else:
write "" to jobname & "." & decimal(charcode) & "bbox";
fi; % END OF CONDITIONS
enddef;


> However, if I put in the –d command it compiles and produces the warning:
> warning -- cavern exit code – 1
> But it creates a nice map showing the labels I want.

There was surely some old data.8bbox file in the thTMPDIR, as therion
doesn't clean this directory between runs in the debug mode. Check the
timestamps of the files.

Best wishes
Martin
___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion



___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion


Re: [Therion] specific which label appears in output

2021-01-24 Thread Martin Budaj
On Sun, Jan 17, 2021 at 8:02 PM Axel  wrote:
> for an overview map I need to specific the labels I want to have in the 
> output. Just sorting them by size is not possible. After searching I found a 
> label re-definition at 
> http://marcocorvi.altervista.org/caving/tbe/m_07/m_072.htm (7.2.10).
>
> Works like a charm in a small cave but taken to my project it behaves odd:
> If I compile, Therion (5.5.6) gives this error (and creates no map):
>   converting scraps ... done
>   making map ... C:\Program Files (x86)\Therion\therion.exe: error -- Can't 
> open file data.8bbox!

Therion expects to find a *bbox file for each scrap containing labels.
It is generated by metapost when the labels are processed. In your
case, you instructed metapost to skip all the labels in a scrap (so no
*bbox file was produced), but therion knows there were some labels
defined for that scrap (if you displayed at least one label in the
scrap, the *bbox file would be generated). The easiest solution is to
create an empty *bbox file if there is none by writing an empty string
to it. Here is a modified Marco's macro:

   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: % altitude
 pickup pencircle scaled (u/6);
 drawdot(pos);
 process_label(pos,0);
   elseif mode=2: process_uplabel;% passage height
positive
   elseif mode=3: process_downlabel;  % passage height
negative
   elseif mode=4: process_updownlabel;% passage height both
   elseif mode=5: process_circledlabel;   % passage height
unsigned.
   elseif mode=6: process_boxedlabel;
   elseif mode=7: process_label(pos,rot); % station name
   elseif mode=8: process_filledlabel(pos, rot);
   else:% mode=0 date
 process_label(pos,rot);
   fi;
 else:
   write "" to jobname & "." & decimal(charcode) & "bbox";
 fi;
   else:
 write "" to jobname & "." & decimal(charcode) & "bbox";
   fi;  % END OF CONDITIONS
 enddef;


> However, if I put in the –d command it compiles and produces the warning:
>warning -- cavern exit code – 1
> But it creates a nice map showing the labels I want.

There was surely some old data.8bbox file in the thTMPDIR, as therion
doesn't clean this directory between runs in the debug mode. Check the
timestamps of the files.

Best wishes
Martin
___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion