Advanced topics / important considerations – Pitney Bowes MapXtreme User Manual

Page 505

Advertising
background image

Appendix D: Extensible Data Providers

Advanced Topics / Important Considerations

MapXtreme v7.1

512

Developer Guide

SpatiaLite Data Provider Extension

The code in this project shows how the MapXtreme Extensible Data Provider classes and interfaces
have been extended to create a SpatiaLite data provider that allows you to open SpatiaLite tables,
insert/update/delete records, search tables, changes the styles, and import new tables into an
SQLite3 database. Abstract base classes have been used to make coding more efficient. See the
Readme.rtf that accompanies the sample for details on which classes and interfaces were extended.

At compile time, the SpatiaLite Data Provider project creates an assembly called
MapInfo.SpatiaLite.DataProvider.SessionEventHandler.dll that serves as the main data provider
implementation and also a session event handler that makes the data provider available for
autoloading at MapXtreme startup.

The SpatiaLite data provider assembly also encompasses an implementation of a persistence
provider, an optional component for a data provider, but a useful one. This allows SpatiaLite table
and data source definitions that MapXtreme does not natively read/write to/from a MapInfo
workspace (.MWS). See

Persistence Providers

.

The implementation of ISessionEventHandler in the SpatiaLite data provider is another useful
component, also optional. Containing this in the data provider assembly allows the data provider to
be autoloaded when MapXtreme starts up. This means that SpatiaLite tables definitions can be
loaded and available in your MapXtreme application as soon as the MapXtreme session has
initialized.

The SessionEventHandler is not specific to data provider extensibility. This can be used to load any
custom code that you need at session startup. We took advantage of this capability to persist custom
SpatiaLite table and data source definitions. In order to use this for other custom code, the assembly
must contain the suffix SessionEventHandler.dll and put in the \Common
Files\MapInfo\MapXtreme\7.x.x\SessionEventHandlers in order for MapXtreme to be aware of it. For
more on this topic see

ISessionEventHandlers

SpatiaLite Workspace Manager Extension

Another major enhancement to MapXtreme is the ability to extend the functionality of Workspace
Manager. An example of this is the SpatiaLite Workspace Manager Extension project contained in
the SpatiaLite Data Provider sample. This project extends Workspace Manager to provide SpatiaLite
menus, dialogs and code connecting to a database and opening a table.

When this project is compiled it generates an assembly with the suffix WorkspaceManagerExtension
DLL. This assembly is dependent on the SpatiaLite data provider which provides the table definitions
for the SpatiaLite database.

Workspace Manager extensions can contain any functionality you may need as you create and save
workspaces. They are discussed in

Appendix B: Customizing MapXtreme

.

Advanced Topics / Important Considerations

This section includes a variety of topics worth considering as you design and build your extensible
data provider:

Advertising