Using modules separately

Hello everyone!!
I have achieved to run SNAP in Netbeans and in IntelliJ (with the previous use of Maven), now I am trying to take some functionalities of the Sentinel-1 Toolbox but I don’t know if I can simply use separately some classes or libraries of it. For example, the software allows to open .zip data and performs it in the product explorer with information of the different bands, can I easily access or use, in some way, the methods used to do this? I am a bit lost with that huge code.

Thanks!!!

You should be able to just add the module dependencies you need. You would need to include S1TBX-IO as well as the core of snap-engine.

In your code you would call
Product myProduct = ProductIO.readProduct(path);

Given a path to a zipped S1 product, this will determine that the S1 reader should be used and return a Product object.

have a look at the developer guide and the example code

Hello lveci,
First of all, thank you for your answer, this code is being hard to implement…
I am trying to use it at Eclipse. As I always do to integrate a big downloaded project at Eclipse, I am generating a .jar file to set it as Build Path of my java project and import by this way the different classes of the project. For this case, each main project (snap-engine, snap-desktop, s1tbx and snap-installer) is formed by several subprojects so I don’t know how could I extract that jar file that I can use to create each objects as you exemplify with “Product myProduct = ProductIO.readProduct(path);”.
Another question I have is: is there any document in addition to the javadocs (engine and desktop ) that describes the main function of the principal classes of the code? Where can I find the .java file where the graphic interface user is contained (I have thought that if I could see the connections between the buttons and menu items of the gui to each class I can easily follow the flow of the software)?

Sorry for the big quantity of questions, you can see I am a bit lost and I need some help XD
Thank you!!

My principal problem is the unknown of the path that the software follows for any of the functionalities it has. For example, if I click in “File<Open Product…” I can see that a SnapFileChooser (that implements JFileChooser) object is created in order to choose a file, but I don’t know the rest of the process to open it and show the information relative to this file in the Product Explorer tab.
I am used to locate the java Graphic User Interface file in the code and then look for the associations between the buttons, elements of the tabs, menu items, etc with the classes they need to do their functionality. However, in this code I can’t find the java file that contains the GUI or, otherwise, the connections between the GUI elements and the classes they use, so I am a bit lost in this aspect and I can’t progress in my understanding of the software.

I hope someone can help me :slight_smile:

Some operators don’t have any GUI code. They are based on Java Reflection. The GUI is created from the @Parameters in the operator code.
For operators that need a custom UI, you can find the code in the corresponding UI module for example s1tbx-insar has a s1tbx-insar-ui module with the custom UI code which implements OperatorUI

Also, if you are trying to trace code back from the menu actions, look at the layers.xml file in the resources of modules. This maps the actions in the menus.

You can also have a look into the pom files. There you can also see the dependencies of a module.

Actually there is no ‘the .java file where the graphic interface user is contained’. SNAP is very modularised and also depends on the NetBeans Application platform.
And as Luis already said, some operators don’t have a specific UI at all. It is generically created based on @Parameter annotations