[Scilab-Dev] Xcos block: getting the position of ports in the interface function

Samuel Gougeon sgougeon at free.fr
Tue Jun 25 12:55:25 CEST 2019


Hello Clément,

Thanks for your answer. During my first disp(graphics) tests, i likely 
focussed on /.in_style/ and its /rotation=/ flag, instead of on /.style/ 
that is only the one showing /flip=, mirror=/ and /rotation=/ flags. So 
i missed the info.

Other tests done for CSCOPE show that in /.style/, /rotation=/ is in 
[0,90], and it's a combination with /flip=/ and /mirror=/ that builds 
any actual rotation in [0, 270].
And that the /flip=/ and /mirror=/ roles are inverted when /rotation=90 
/(so: flip and mirror are in the icon's referential, not in the user's 
one. This is also what we see when flipping a 90°-rotated block).

Anyway, this will allow to decide where is the relevant free place(s) to 
set a label around the icon, wrt existing ports. Since combinations of 
flip, mirror and rotation flags together with ports positions are not 
trivial, writing a short shared internal function (likely in 
scicos/macros/utils) returning "free sides" could be useful. I am going 
to do it when required.

Best regards

Samuel

Le 24/06/2019 à 11:48, Clément David a écrit :
> Hello Samuel,
>
> The ports labels could be set on the on `blk.graphics.in_label` and `blk.graphics.out_label` depending on block's parameters by the interface function as it is done by the BIGSOM_f (or others). About the position, they are computed by Xcos as dataflow (on the left and right) or as eventflow (on the top and bottom) and it is not possible to fix them within the interface function.
>
> You could also get the rotation, flip and mirror information from the blk.graphics.style value.
>
> Thanks,
>
> --
> Clément DAVID

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20190625/d6f0fb93/attachment.htm>


More information about the dev mailing list