uDig

«  Workbench Selection Tutorial   ::   Contents   ::   IAdaptable and Operations Tutorial  »

GIS Platform Tutorials

The GIS platform is used for the catalog and data access.

The following tutorials are available:

GIS Platform

The GIS Platform serves as the foundation of the uDig application responsible for data access. It is the first tier of the Platform Architecture:

  • Custom Application
  • GIS Application
  • GIS Platform

Data Model

The GIS platform works with the concept a catalog which provides access to resource “handles”. Here is how that breaks down in practice:

  • Catalog responsible for:
    • Search: provides a way for developers to discovery new information
    • Management: takes responsibility for tracking data use (add / remove and cleanup of heavy weight objects such as databases)
  • Handles to actual data and services

Inside the catalog we can start to see this idea of “handles” in action.

In the above example we have:

  • Service - represents a service that is publishing information
  • GeoResource - represents the actual spatial information

Data Access Handles

The IService and IGeoResource objects work in a manner similar to a File handle. A Java File object contains information about how to access the file; and can be used to interact with the file; but are not actually the bytes on disk available when you “open” a file and get the input stream.

Here is how to use a getResource to access features:

if( geoResource.canResolve( FeatureStore.class ) ){
    FeatureSource featureSource = handle.resolve( FeatureSource.class, monitor );
    ...
}

Both IService and IGeoResource implement IResolve with the following useful methods:

  • IResolve.getID() is a unique ID used to identify this resource
  • IResolve.canResolve( Class type ) is a non blocking check to see if a type of resource is available
  • IResolve.resolve( Class type, IProgressMonitor monitor ) will aquire the request resource; this method may throw an IOException as it is actually connecting to and opening the resource for use

Eclipse RCP IAdaptable

The Eclipse concept of IAdaptable is similar to the normal example of a Java interface:

if( object instanceof WebMapServer ){
   WebMapServer wms = (WebMapServer) object;
   // use wms here
}

Using IAdaptable this would become:

if( object instanceof IAdaptable){
   IAdaptable adaptee = (IAdaptable) object;
   WebMapServer wms =
      (WebMapServer) adaptee.getAdapter( WebMapServer.class );
   If( wms != null ){
      // use wms here
   }
}

Or using IResolve which uses the same general approach:

if( service.canResolve( WebMapServer.class ) ){
    WebMapServer.class wms = handle.resolve( WebMapServer.class, new NullProgressMonitor() );
    // use wms here
}

«  Workbench Selection Tutorial   ::   Contents   ::   IAdaptable and Operations Tutorial  »