Re: [Therion] boxed label

2018-09-24 Thread Bruce Mutton via Therion
Thanks Marco

Eventually the squeaky wheel gets oiled :)

Looks like it should work, but it seems to complain about setting the parsed 
attribute to a picture.

I will look some more when I have time tonight..

 

**data.mp

(./data.mp [4001] [4002] [4003] [4004] [4005] [4006] [4007] [4008] [4009] [4010

] [4011] [4012] [4013]

[4014] [4015] [4016] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

[14] [15] [16] [17]

>> unknown picture pic

>> thelabelboxed

! Equation cannot be performed (unknown picture=numeric).

 

Bruce

 

From: Therion  On Behalf Of Marco Corvi via Therion
Sent: Monday, 24 September 2018 21:16
To: therion@speleo.sk
Cc: Marco Corvi 
Subject: [Therion] boxed label

 

hi bruce,

 

this is a boxed u:label

basically it gets the string as picture,

its bounding box corners, and define the x and y to draw the box, 

then draw the string picture

 

point 10 20 u:label -attr val 20

 

def p_u_label ( expr p,r,s,t ) =

  picture pic;

  pic := thelabel( ATTR_val, (0,0)) scaled s;

 pair q[]; numeric n[], m[], v;

 path bb;

 v := defaultscale;

 qO = ulcorner pic;

 q1 = lrcorner pic;

 nO := ypart q0 + 2.5 * v;

 n1 := ypart q1 - 1.5*v;

 m0 := xpart q0 - v;

 m1 := xpart q1 + 1.5*v;

bb := (m0,n0) -- (m0,n1) -- (m1,n1) -- (m1,n0) -- cycle;

draw bb  rotated r shifted p;

draw pic rotated r shifted p;

enddef;

 

 

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


Re: [Therion] boxed label

2018-09-24 Thread Martin Sluka via Therion
Marco, 

you are right. But the discussion is that Missouri mappers use number in box as 
point height. So by my meaning correct way should be to define new symbol set 
which will generate point height in sguare label.

User definition is temporary solution in this case.

Martin S.


> 24. 9. 2018 v 11:16, Marco Corvi via Therion :
> 
> hi bruce,
> 
> this is a boxed u:label
> basically it gets the string as picture,
> its bounding box corners, and define the x and y to draw the box, 
> then draw the string picture
> 
> point 10 20 u:label -attr val 20
> 
> def p_u_label ( expr p,r,s,t ) =
>   picture pic;
>   pic := thelabel( ATTR_val, (0,0)) scaled s;
>  pair q[]; numeric n[], m[], v;
>  path bb;
>  v := defaultscale;
>  qO = ulcorner pic;
>  q1 = lrcorner pic;
>  nO := ypart q0 + 2.5 * v;
>  n1 := ypart q1 - 1.5*v;
>  m0 := xpart q0 - v;
>  m1 := xpart q1 + 1.5*v;
> bb := (m0,n0) -- (m0,n1) -- (m1,n1) -- (m1,n0) -- cycle;
> draw bb  rotated r shifted p;
> draw pic rotated r shifted p;
> enddef
> 
> 
> ___
> Therion mailing list
> Therion@speleo.sk
> https://mailman.speleo.sk/listinfo/therion

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


[Therion] boxed label

2018-09-24 Thread Marco Corvi via Therion
hi bruce,

this is a boxed u:label
basically it gets the string as picture,
its bounding box corners, and define the x and y to draw the box,
then draw the string picture

point 10 20 u:label -attr val 20

def p_u_label ( expr p,r,s,t ) =
  picture pic;
  pic := thelabel( ATTR_val, (0,0)) scaled s;
 pair q[]; numeric n[], m[], v;
 path bb;
 v := defaultscale;
 qO = ulcorner pic;
 q1 = lrcorner pic;
 nO := ypart q0 + 2.5 * v;
 n1 := ypart q1 - 1.5*v;
 m0 := xpart q0 - v;
 m1 := xpart q1 + 1.5*v;
bb := (m0,n0) -- (m0,n1) -- (m1,n1) -- (m1,n0) -- cycle;
draw bb  rotated r shifted p;
draw pic rotated r shifted p;
enddef
___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion