Loading the INTViewer Platform and creating your first module
INTViewer platform can easily be extended with new modules (also called plugins). This tutorial will show you how to create and deploy your own window module inside INTViewer.
Use NetBeans 8.1, 8.2 or 9 with INTViewer 2018 (see Pre-Requirements)
The purpose of this first module is to display a Trace Info Window component that shows the number of displayed traces for each seismic display selected, as shown in the area at the bottom left (highlighted in red) of this screen snapshot:
To load the INTViewer platform under NetBeans, start NetBeans and select option Tools->NetBeans Platforms. Select option Add Plaform ... and point to the top folder of your INTViewer distribution (this folder should be named INTViewer).
Note: Do not use com.interactive.intviewer for the Code Name Base. It is already in use by INTViewer.
Before we proceed further, you can run the application by pressing on the green arrow in the icon bar.
Note: you will need to copy the INTViewer license.dat file inside your INTViewer distribution (for example C:\Program Files\INT\INTViewer) created during installation.
Once the INTViewer application is running, select Window->traceinfo and an empty window named traceInfo Window will show up at the bottom left corner of the application. Components will be added to this window in the next two steps.
Close the appication and go back to the editor in Design mode for the traceInfoTopComponent.java file. This editor will allow us to build the GUI part of our module easily.
Switch to the Source view by pressing the Source button just above the drawing area. Just above the constructor for traceinfoTopComponent, enter the following line (see Window and Layer Selection):
GlobalSelection<ISeismicLayer> layerSelection = new GlobalSelection<ISeismicLayer>(ISeismicLayer.class);
Press on the little yellow bulb that appears on the left side of the new line to help you with the import statements. If no suggestion is made, verify that you have specified the Module Dependencies correctly in the Configuring your Module section.
Next, make the class implement the LookupListener interface
final class traceInfoTopComponent extends TopComponent implements LookupListener {
Fix the imports and select the option to implement all the Abstract methods (from the little yellow bulb icon).
Find the generated method resultChanged at the bottom of the file and edit it as follows:
public void resultChanged(LookupEvent arg0) {
Collection<? extends ISeismicLayer> selections = layerSelection.allInstances();
if (!selections.isEmpty()) {
int ntraces = selections.iterator().next().getReader().getNumberOfTraces();
jTextField1.setText("" + ntraces);
}
}
Finally, at the end of the traceInfoTopComponent constructor, add the following line:
layerSelection.addLookupListener(WeakListeners.create(LookupListener.class, this, layerSelection));
Save your file and run the application again. As you add new seismic layers, you should see your new component display the number of traces displayed.
Continue to the Basics of INTViewer for an explanation of this implementation. A walkthrough is also available to run your customized INTViewer application outside of NetBeans.