INTViewer Tutorial

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:

Loading the INTViewer Platform

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).

Creating your module template using NetBeans wizard

  • Click File -> New Project
  • In the New Project wizard select NetBeans Modules from the Categories list and Module from the Projects list and click Next >
  • For Project Name, specify mymodule1
  • Select option Standalone Module and make sure to specify "INTViewer" in the NetBeans Platform field.
  • Click Next > and specify mymodule1 for the Code Name Base and MyModule1 for the Module Display Name.

Note: Do not use com.interactive.intviewer for the Code Name Base. It is already in use by INTViewer.

  • Click on Finish
  • In the Projects tree view, you should see your project which includes a number of files that have been created for you.

Configuring your Module

  • In the Projects tree, right click on the module MyModule1 and select Properties from the list.
  • Under Categories, select Libraries.
  • Select Java plaform JDK1.7 . If you don't see this option, you will need to install jdk1.7 and load it into NetBeans using option Tools->Java Platforms
  • Click on the Add button next to Module Dependencies
  • In the list, select IntviewerCore and click OK. This will give you access to the INTViewer API. If you don't see IntviewerCore in the list, make sure you selected "INTViewer" in the NetBeans Platform field. Also add SeismicData, Seismic2D and Viewer2D. Often needed modules are AllDeps and Lookup.
  • Click Add again,select Utilities API and click OK. This will give you access to some required NetBeans API for this tutorial.
  • Click OK in Project Properties Dialog

Creating your Window Component

  • In the Projects tree view, expand the Source Packages tree.
  • Right click on mymodule1 and select New->Window Component...
  • In the wizard, select tools for the Window Position
  • DO NOT CHECK ANY OF THE OTHER TOGGLES AT THIS STAGE
  • Select Next >
  • Specify traceInfo for the Class Name Prefix.
  • Specify an optional 16x16 icon file with the Icon option and press Finish.
  • The Wizard creates a number of files and opens automically the traceInfoTopComponent.java file in Design mode.

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.

Designing the GUI using the Matisse graphical editor

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.

  • In the Palette, under Swing Controls, drag a Label control into the upper left corner of the drawing area.
  • Right click on the label and select Edit Text option.
  • Set the label text to Number of Traces:
  • Always in Swing Controls, drag a Text Field control and place it to the right of the label.
  • Right click on the text fiels, select Edit Text option and clear the text
  • Resize the text field to be large enough to display about 8 characters.
  • Type Ctrl+S to save your work.

Adding the Code to print the number of traces when a seismic layer is selected

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.