Overview of API changes in INTViewer 4.5.2

New Java API

INTViewer 4.5.2 brings a new set of functionalities that have been made available through the API:

Generic Data Types

The com.interactive.intviewerapi.data.IDataFactory.createNewInstance method has been typed:

public IData createNewInstance(String dataPath, Class<T extends IData> dataKlass) throws Exception;

became

public <T extends IData> T createNewInstance(String dataPath, Class<T> dataKlass) throws Exception;

As a result, lines like this:

ISeismicData seismicData = (ISeismicData) IData.factory.createNewInstance(path, ISeismicData.class);

can be written simply:

ISeismicData  seismicData = IData.factory.createNewInstance(path, ISeismicData.class);

Generic Window Types

The com.interactive.intviewerapi.windows.ILayeredWindowFactory class has been typed:

public interface ILayeredWindowFactory {

became

public interface ILayeredWindowFactory<T extends ILayeredWindow> {

As a result, lines like this:

IMapWindow mapWindow = (IMapWindow) IMapWindow.factory.createWindow();

can be written simply:

IMapWindow mapWindow = IMapWindow.factory.createWindow();

Generic Layer Types

The com.interactive.intviewerapi.layers.ILayerFactory class has been typed:

public interface ILayerFactory {

became

public interface ILayerFactory<T extends ILayer2D, U extends IData, V extends ILayeredWindow> {

As a result, lines like this:

IMapHorizonLayer mapLayer = (IMapHorizonLayer) IMapHorizonLayer.factory.createLayer(mapWindow, data, props, false);

can be written simply:

IMapHorizonLayer mapLayer = IMapHorizonLayer.factory.createLayer(mapWindow, data, props, false);

The same change has been implemented for com.interactive.intviewerapi.objects3d.IObject3DFactory.

The com.interactive.intviewerapi.IVisual class has been typed as well:

public interface IVisual

became

public interface IVisual<U extends IData, V extends IViewerWindow>

As a result, lines like this:

IMapHorizonLayer mapLayer = ...
IMapWindow window = (IMapWindow) mapLayer.getViewerWindow();
IHorizonData data = (IHorizonData) mapLayer.getData();

can be written simply:

IMapHorizonLayer mapLayer = ...
IMapWindow window = mapLayer.getViewerWindow();
IHorizonData data = mapLayer.getData();

These changes are backward compatible, no change to your existing code should be needed. However, they might require your plugins to be recompiled against INTViewer 4.5.2.

Important:

In INTViewer 5.1, the types U and V of ILayerFactory and IObject3DFactory will match the type of data and window each layer type is supposed to use. As this is a backward incompatible change, it is scheduled for INTViewer 5.1 so developers have time to prepare.

Example:

The factory for ISeismicLayer is currently defined as:

ILayerFactory<ISeismicLayer, IData, ILayeredWindow> factory = ...

will be defined in future releases as:

ILayerFactory<ISeismicLayer, ISeismicData, IXSectionWindow> factory = ...

As a result, the following lines that compile today will no longer compile in future releases:

ILayeredWindow window = ...
IData data = ....
ISeismicLayer layer = ISeismicLayer.factory.createLayer(window , data, new NamedProps(), false)

and should be changed to:

IXSectionWindow window = ...
ISeismicData data = ....
ISeismicLayer layer = ISeismicLayer.factory.createLayer(window , data, new NamedProps(), false)

Also, the methods IVisual.setData and AbstractLayer2D.onSetData currently defined as:

    public void setData(IData data) throws Exception;
    protected void onSetData(IData data) throws Exception;

will be defined in future releases as:

    public void setData(U data) throws Exception;
    protected void onSetData(U data) throws Exception;

U being the type of IData returned by the IVisual.getData() method.

As a result, the following lines that compile today will no longer compile in INTViewer 5.1:

ISeismicLayer layer = ...
IData data = ...
layer.setData(data)
and should be changed to:
ISeismicLayer layer = ...
ISeismicData data = ...
layer.setData(data)

Incompatibilities with 4.5.1

A set of API incompatibilities have been introduced as part of this release.

See also: Overview of API changes in INTViewer 4.5.1