xcos

classic Classic list List threaded Threaded
5 messages Options
Johan Wesselink Johan Wesselink
Reply | Threaded
Open this post in threaded view
|

xcos

Good day,

I was having a look into some superblock problems.
In version 6.0.1. there are many problems with the super block.

I have checkout the latest version of the GIT repository and can build and debug it using eclipse.

On this moment I am interested in Bug 14670 Super block can be opened more then once.
I already discovered that the xcos/block/actian/BlockParametersAction.java contains the method ActionPerformed on line 96 that actually generates the diagram.
I am a little bit curious for the architecture.
I see that a XcosDiagram is created using the UID, Kind and Id of cell that is the SUPER_f block. This is created diagram is then added to the root diagram.
Maybe a very simplistic view, but is it possible to get the root diagram and search for a sub diagram with the same UID, Kind and Id. And so, if this is present does that mean that the diagram is already created and that it only should be shown?
Or do not understand how it works.

Sincerely
Johan


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Johan Wesselink Johan Wesselink
Reply | Threaded
Open this post in threaded view
|

Re: xcos

I have a quick and dirty fix. Not for real use, but it shows a proof of concept. I am certainly cutting corners here.

Would like to know how to translate this into a better solution?
Add a function to the Xcos class that returns a diagram based on cell that is passed?

Started with this simple problem. Really like Xcos, but it is still very broken. Like to contribute if possible.

Thanks.


Op di 28 aug. 2018 om 17:40 schreef Johan Wesselink <[hidden email]>:
Good day,

I was having a look into some superblock problems.
In version 6.0.1. there are many problems with the super block.

I have checkout the latest version of the GIT repository and can build and debug it using eclipse.

On this moment I am interested in Bug 14670 Super block can be opened more then once.
I already discovered that the xcos/block/actian/BlockParametersAction.java contains the method ActionPerformed on line 96 that actually generates the diagram.
I am a little bit curious for the architecture.
I see that a XcosDiagram is created using the UID, Kind and Id of cell that is the SUPER_f block. This is created diagram is then added to the root diagram.
Maybe a very simplistic view, but is it possible to get the root diagram and search for a sub diagram with the same UID, Kind and Id. And so, if this is present does that mean that the diagram is already created and that it only should be shown?
Or do not understand how it works.

Sincerely
Johan


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

fix_multiple_open_super_block.patch (4K) Download Attachment
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: xcos

Hello Johan,

Thanks for taking a look at Xcos, this is a great Scilab functionnality that deserve more love ! I
will try to help you understanding the codebase, do not hesitate to ask if needed.

For Scilab 6, Xcos GUI is coded in Java as you have correctly noted *BUT* the Diagram, Block, Link
and Annotation data (available on Scilab through scicos API) are stored in C++ (to relax memory
constraints on huge diagrams). To pass data from C++ to Java, an object identified by a (ScicosID,
Kind) pair could retrieve its properties through a Controller object. The GUI fully interacts with
Scilab this way.

You are correct about Bug 14670 fix, to avoid opening twice an XcosDiagram for a specific block (eg.
ScicosID) Scilab 5.5.2 stored a reference to all the opened diagrams and create only a new
XcosDiagram if needed. I will review it, do you know how to use codereview.scilab.org to push fixes
?

Thanks for your help,

--
Clément


Le mardi 28 août 2018 à 21:59 -0300, Johan Wesselink a écrit :

> I have a quick and dirty fix. Not for real use, but it shows a proof of concept. I am certainly
> cutting corners here.
>
> Would like to know how to translate this into a better solution?
> Add a function to the Xcos class that returns a diagram based on cell that is passed?
>
> Started with this simple problem. Really like Xcos, but it is still very broken. Like to
> contribute if possible.
>
> Thanks.
>
>
> Op di 28 aug. 2018 om 17:40 schreef Johan Wesselink <[hidden email]>:
> > Good day,
> >
> > I was having a look into some superblock problems.
> > In version 6.0.1. there are many problems with the super block.
> >
> > I have checkout the latest version of the GIT repository and can build and debug it using
> > eclipse.
> >
> > On this moment I am interested in Bug 14670 Super block can be opened more then once.
> > I already discovered that the xcos/block/actian/BlockParametersAction.java contains the method
> > ActionPerformed on line 96 that actually generates the diagram.
> > I am a little bit curious for the architecture.
> > I see that a XcosDiagram is created using the UID, Kind and Id of cell that is the SUPER_f
> > block. This is created diagram is then added to the root diagram.
> > Maybe a very simplistic view, but is it possible to get the root diagram and search for a sub
> > diagram with the same UID, Kind and Id. And so, if this is present does that mean that the
> > diagram is already created and that it only should be shown?
> > Or do not understand how it works.
> >
> > Sincerely
> > Johan
> >
>
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Johan Wesselink Johan Wesselink
Reply | Threaded
Open this post in threaded view
|

Re: xcos

I am aware that it is a MVC architecture. The Model in this case is the C++ part. The controller is instantiated in JAVA and has a JNI interface.
The view in this case is actually everything that makes the view visible include the diagram structure info. One thing that makes me very curious. The models are made using modelica. How is the image of the model imported into the view? Something I still haven't found (did not yet look very good also). Started simple with the diagram problem.

The fix I made is not very well implemented. It doesn't make me happy, but it works. The idea is that I think that every root diagram has a number of child diagrams. These are created from superblock. If a superblock and all of it recursive children are  converted into a diagram. I noticed that the diagram ID and Kind are equal to the ID and Kind of the superblock. This makes it possible to make a list with diagrams, for a given root, and look at them I simple iterate over them and compare the Kind and ID of the SuperBlock with the those of the diagrams stored in the list.. This works, but for big diagrams this can be done way better. I would prefer a map that maps a superblock to a diagram. This makes it possible to look up a diagram with O(1), which is way faster. Notice that for small diagrams, most practical examples for know there is no measurable performance difference.

I do not know how the CodeReview system works, but I am eager to learn. I think you need some kind of login for it? Or can the normal login be used also?

My idea is to have a look at some problems with SuperBlocks. These make it very difficult for me to run some older diagrams I have.

Johan Wesselink



Op wo 5 sep. 2018 om 11:21 schreef Clément David <[hidden email]>:
Hello Johan,

Thanks for taking a look at Xcos, this is a great Scilab functionnality that deserve more love ! I
will try to help you understanding the codebase, do not hesitate to ask if needed.

For Scilab 6, Xcos GUI is coded in Java as you have correctly noted *BUT* the Diagram, Block, Link
and Annotation data (available on Scilab through scicos API) are stored in C++ (to relax memory
constraints on huge diagrams). To pass data from C++ to Java, an object identified by a (ScicosID,
Kind) pair could retrieve its properties through a Controller object. The GUI fully interacts with
Scilab this way.

You are correct about Bug 14670 fix, to avoid opening twice an XcosDiagram for a specific block (eg.
ScicosID) Scilab 5.5.2 stored a reference to all the opened diagrams and create only a new
XcosDiagram if needed. I will review it, do you know how to use codereview.scilab.org to push fixes
?

Thanks for your help,

--
Clément


Le mardi 28 août 2018 à 21:59 -0300, Johan Wesselink a écrit :
> I have a quick and dirty fix. Not for real use, but it shows a proof of concept. I am certainly
> cutting corners here.
>
> Would like to know how to translate this into a better solution?
> Add a function to the Xcos class that returns a diagram based on cell that is passed?
>
> Started with this simple problem. Really like Xcos, but it is still very broken. Like to
> contribute if possible.
>
> Thanks.
>
>
> Op di 28 aug. 2018 om 17:40 schreef Johan Wesselink <[hidden email]>:
> > Good day,
> >
> > I was having a look into some superblock problems.
> > In version 6.0.1. there are many problems with the super block.
> >
> > I have checkout the latest version of the GIT repository and can build and debug it using
> > eclipse.
> >
> > On this moment I am interested in Bug 14670 Super block can be opened more then once.
> > I already discovered that the xcos/block/actian/BlockParametersAction.java contains the method
> > ActionPerformed on line 96 that actually generates the diagram.
> > I am a little bit curious for the architecture.
> > I see that a XcosDiagram is created using the UID, Kind and Id of cell that is the SUPER_f
> > block. This is created diagram is then added to the root diagram.
> > Maybe a very simplistic view, but is it possible to get the root diagram and search for a sub
> > diagram with the same UID, Kind and Id. And so, if this is present does that mean that the
> > diagram is already created and that it only should be shown?
> > Or do not understand how it works.
> >
> > Sincerely
> > Johan
> >
>
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Johan Wesselink Johan Wesselink
Reply | Threaded
Open this post in threaded view
|

Re: xcos

I will have a look at gerrit. I already did some reading on the subject. Interesting stuff.

Thanks.

Op wo 5 sep. 2018 om 16:09 schreef Johan Wesselink <[hidden email]>:
I am aware that it is a MVC architecture. The Model in this case is the C++ part. The controller is instantiated in JAVA and has a JNI interface.
The view in this case is actually everything that makes the view visible include the diagram structure info. One thing that makes me very curious. The models are made using modelica. How is the image of the model imported into the view? Something I still haven't found (did not yet look very good also). Started simple with the diagram problem.

The fix I made is not very well implemented. It doesn't make me happy, but it works. The idea is that I think that every root diagram has a number of child diagrams. These are created from superblock. If a superblock and all of it recursive children are  converted into a diagram. I noticed that the diagram ID and Kind are equal to the ID and Kind of the superblock. This makes it possible to make a list with diagrams, for a given root, and look at them I simple iterate over them and compare the Kind and ID of the SuperBlock with the those of the diagrams stored in the list.. This works, but for big diagrams this can be done way better. I would prefer a map that maps a superblock to a diagram. This makes it possible to look up a diagram with O(1), which is way faster. Notice that for small diagrams, most practical examples for know there is no measurable performance difference.

I do not know how the CodeReview system works, but I am eager to learn. I think you need some kind of login for it? Or can the normal login be used also?

My idea is to have a look at some problems with SuperBlocks. These make it very difficult for me to run some older diagrams I have.

Johan Wesselink



Op wo 5 sep. 2018 om 11:21 schreef Clément David <[hidden email]>:
Hello Johan,

Thanks for taking a look at Xcos, this is a great Scilab functionnality that deserve more love ! I
will try to help you understanding the codebase, do not hesitate to ask if needed.

For Scilab 6, Xcos GUI is coded in Java as you have correctly noted *BUT* the Diagram, Block, Link
and Annotation data (available on Scilab through scicos API) are stored in C++ (to relax memory
constraints on huge diagrams). To pass data from C++ to Java, an object identified by a (ScicosID,
Kind) pair could retrieve its properties through a Controller object. The GUI fully interacts with
Scilab this way.

You are correct about Bug 14670 fix, to avoid opening twice an XcosDiagram for a specific block (eg.
ScicosID) Scilab 5.5.2 stored a reference to all the opened diagrams and create only a new
XcosDiagram if needed. I will review it, do you know how to use codereview.scilab.org to push fixes
?

Thanks for your help,

--
Clément


Le mardi 28 août 2018 à 21:59 -0300, Johan Wesselink a écrit :
> I have a quick and dirty fix. Not for real use, but it shows a proof of concept. I am certainly
> cutting corners here.
>
> Would like to know how to translate this into a better solution?
> Add a function to the Xcos class that returns a diagram based on cell that is passed?
>
> Started with this simple problem. Really like Xcos, but it is still very broken. Like to
> contribute if possible.
>
> Thanks.
>
>
> Op di 28 aug. 2018 om 17:40 schreef Johan Wesselink <[hidden email]>:
> > Good day,
> >
> > I was having a look into some superblock problems.
> > In version 6.0.1. there are many problems with the super block.
> >
> > I have checkout the latest version of the GIT repository and can build and debug it using
> > eclipse.
> >
> > On this moment I am interested in Bug 14670 Super block can be opened more then once.
> > I already discovered that the xcos/block/actian/BlockParametersAction.java contains the method
> > ActionPerformed on line 96 that actually generates the diagram.
> > I am a little bit curious for the architecture.
> > I see that a XcosDiagram is created using the UID, Kind and Id of cell that is the SUPER_f
> > block. This is created diagram is then added to the root diagram.
> > Maybe a very simplistic view, but is it possible to get the root diagram and search for a sub
> > diagram with the same UID, Kind and Id. And so, if this is present does that mean that the
> > diagram is already created and that it only should be shown?
> > Or do not understand how it works.
> >
> > Sincerely
> > Johan
> >
>
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev

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