Incompatible API changes in INTViewer 4.5

A/ The com.interactive.intviewerapi.windows.AbstractViewerWindow class no longer extends javax.swing.JInternalFrame.

This change was necessary to implement the "Tab Windows" option accessible from Tools -> Options -> Desktop. Depending on the value of this option, a Swing JInternalFrame or a NetBeans TopComponent might be created to represent a window.

If your code no longer compiles because of this change, try these workarounds:

- instead of adding Swing components to the window, use the getContentPane() method. This code:

           public class MyWindow extends AbstractViewerWindow {
                public void init() {
                     this.add(new JLabel("Demo"));
                }
           }
           should be changed to:
           public class MyWindow extends AbstractViewerWindow {
                public void init() {
                     this.getContentPane().add(new JLabel("Demo"));
                }
           }

- To retrieve a reference to the JInternalFrame, use the getComponent() method. This code:

         MyWindow window = new MyWindow();
         ((JInternalFrame) window). setDefaultCloseOperation (JInternalFrame.DO_NOTHING_ON_CLOSE);
           should be changed to:
        MyWindow window = new MyWindow();
       ((JInternalFrame) window.getComponent()).setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);

If the "Tab Windows" option is enabled, getComponent() will return a TopComponent instead of a JInternalFrame.

Also, because of this change, plugins compiled against INTViewer 4.4 need to be recompiled against INTViewer 4.5. 4.4 and 4.5 plugins are not binary compatible.

B/ The getPosition() and getEPSGCode() methods of com.interactive.intviewerapi.data.well.IWellData have been moved to the com.interactive.intviewerapi.data.well.ITrajectory interface

- To retrieve the position of a well, this code:

           IWellData wellData = ...
            Point2D position = wellData.getPosition();
           should be changed to: 
                      IWellData wellData = ...
            Point2D position = wellData.getTrajectory().getPosition();

- To retrieve the EPSG code of a well, this code:

           IWellData wellData = ...
            String epsgCode= wellData.getEPSGCode();
           should be changed to: 
                      IWellData wellData = ...
             String  epsgCode = wellData.getTrajectory(). getEPSGCode ();

C/ Layers that handle shape selection must implement com.interactive.intviewerapi.layers.ISingleShapeSelectionHandler

In INTViewer 4.5, clicking inside the plot of a 2D window can cause the "selected layer" to change. This layer selection change is triggered before the layer event handler of the selected layer can handle the mouse click.

To restore the legacy behavior where no layer selection occurs when your layer is the selected layer, make your layer event handler implement ISingleShapeSelectionHandler, and override the following methods:

    @Override
    public boolean canHandleShapeSelection(cgPlotView pv) {
        return true;
    }
    @Override
    public boolean canHandleShapeSelection(cgPlotView pv, cgShape cgshp) {
        return true;
    }
    @Override
    public boolean onShapeSelection(cgPlotView pv, cgShape cgshp) {
        return true;
    }

D/ Two "saveDataUsingLongTask" methods have been added to the com.interactive.intviewerapi.data.IDataSaver interface

These two methods are meant to be used when the data saving should occur in a separate non-blocking thread (instead of the Swing/Event Dispatch Thread). When the save ends successfully, a notification is displayed by default at the bottom right of the screen.

This API change shouldn't affect your application as the legacy "saveData" methods haven't changed behavior. However, in the next version of INTViewer, the "saveData" methods will always execute in the Event Dispatch Thread. We recommend that you change your code as part of the migration to INTViewer 4.5 if you do want to use the "separate non-blocking thread" mode.

int rc = ds.setDataSaverVisible(true, dataPath, data);

if (rc == JFileChooser.APPROVE_OPTION) {

ds.saveData(data);

}

should be changed to:

int rc = ds.setDataSaverVisible(true, dataPath, data);

if (rc == JFileChooser.APPROVE_OPTION) {

ds.saveDataUsingLongTask(data, null, null, null, true);

}

E/ The format of EPSG codes has changed

The new code has two parts, separated by a ":" character. Example: 32056:1173

  • The first part of the "new" EPSG code is the "old" EPSG code, uniquely identifying the CRS in the EPSG database. Example: 32056 for "NAD27 / Wyoming East Central"
  • The second part is a unique code identifying the transform in the same EPSG database. Example: 1173 for "NAD27 to WGS 84 (4)"

From a user perspective, when a coordinate reference system needs to be selected, there can be up to two steps. The first step allows the user to pick a CRS, the second step allows the user to pick a matching transform if several are found. The first step corresponds to the first part of the new EPSG code (example: 32056), the second step corresponds to the second part of the new EPSG code (example: 1173).