beautypg.com

Optional building blocks: base classes, helpers, And utilities – Pitney Bowes MapXtreme User Manual

Page 499

background image

Appendix D: Extensible Data Providers

Optional Building Blocks: Base Classes, Helpers and Utilities

MapXtreme v7.1

506

Developer Guide

Optional Building Blocks: Base Classes, Helpers and Utilities

The MapXtreme Extensible Data Provider is a collection of interfaces that you can implement to
access data in formats that are currently not supported. MapXtreme provides a collection of utilities,
samples and guidance that can help you jump start your implementation. These are common
implementations that most people will want to use. They cover the following areas:

Š

Abstract Base Classes

Š

Utility Classes

Š

Key implementations

It is well worth understanding what pieces are provided here before starting to build even the
simplest implementation, as some pieces may already be built.

Abstract Base Classes

Abstract base classes for the many interfaces are provided. Their purpose is to handle the default
implementations of the interface, allowing you to implement only what you need.

For example, the IDataProvider provides an OpenDataSource method and two flavors of OpenTable
method (one that uses a data source, and one does not). If you are using a data source, then you
have to implement OpenDataSource and the OpenTable that is based upon the data source. If you
don’t have data source, you only need to implement the OpenTable that doesn’t need a data source.

The abstract base class for IDataProvider has a default implementation for each of those methods,
indicating they are not supported. These are tagged as "virtual" so that when you pick which one(s)
to implement you will provide an override implementation of only what you need.

Utility Classes

SimpleFeature

The basic goal of a data provider is to access features. A feature is typically a row in a table. Spatial
features are described by their geometry, style, key, and attributes.

We provide a utility class called SimpleFeature, that implements the IFeature interface. It
implements a relationship of defining metadata (SimpleFeatureMetdata), and a list of Attributes
(AttributeValues) to a Feature, along with an identifying key (IKey)value. Most data providers will
want to use the SimpleFeature class.

SimpleFeature also implements FeatureChangedEventHandler event management.

SimpleFeature is documented under the MapInfo.Data.Common namespace.

OGC Conversion for Geometries and Coordinate Systems

The MapXtreme Extensible Data Provider includes utilities that help in the conversion process from
an OGC geometry (OpenGIS® Simple Features Interface Standard) into a MapXtreme geometry
and vice versa. This includes OGC-regulated well-known text and well-known binaries that a number
of spatial data systems take advantage of, such as PostGIS, mySQL and SQL Server 2008. Well-
known text refers to a standard textual representation for spatial reference systems. Well-known
binaries are a standard binary representation for geometries.