Xcos block: getting the position of ports in the interface function

classic Classic list List threaded Threaded
3 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Xcos block: getting the position of ports in the interface function

Hello,

It could be useful for some blocks to set the label according to some
parameter's value.
Now, i would like to set such a label with some Scilab code in the
interface function,
and to avoid overlaying the ports and links connected to them.

To do this, we need to know the position of ports, while the block might
have
been rotated.

I have found no block property (.graphics.*, .model.*) providing ports
positions (or the block orientation).
Have i missed anything?
Is there another way to detect ports positions ?

Thanks

Samuel

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: Xcos block: getting the position of ports in the interface function

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

> -----Original Message-----
> From: dev <[hidden email]> On Behalf Of Samuel Gougeon
> Sent: Tuesday, June 18, 2019 9:07 PM
> To: List dedicated to development questions <[hidden email]>
> Subject: [Scilab-Dev] Xcos block: getting the position of ports in the interface
> function
>
> Hello,
>
> It could be useful for some blocks to set the label according to some
> parameter's value.
> Now, i would like to set such a label with some Scilab code in the interface
> function, and to avoid overlaying the ports and links connected to them.
>
> To do this, we need to know the position of ports, while the block might have
> been rotated.
>
> I have found no block property (.graphics.*, .model.*) providing ports positions
> (or the block orientation).
> Have i missed anything?
> Is there another way to detect ports positions ?
>
> Thanks
>
> Samuel
>
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Xcos block: getting the position of ports in the interface function

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


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev