ShapeUp Loader Plugin Overview


General

A loader plugin is responsible for creating shapes and deliver them to ShapeUp main executable. Where the data comes from is entierly up to the loader. E.g. data sources can be files, databases, web servers, GPS equipment etc. A loader plugin is a plain DLL with a renamed extension to distinguish it from other types of plugins. The extension should be .ldr, and the file should be located in the folder <ShapeUp.exe folder>\Plugins.

Valid loaders can then be found by the user from the Insert|Insert Theme From menu. The name displayed here is not necessarily the same name as the .ldr file, since the display name is defined within the plugin.

Function

The idea is that the plugin loads geo data from somewhere when the user activates it from the menu, passes the information over to ShapeUp main executable, and then waits until a theme is removed or the application stopped where it unloads all data and terminates.

Notice: The plugin is responsible for managing the memory for all its shapes during the time the plugin is loaded. ShapeUp uses only the pointers to the shapes created.

A loader plugin can load any number of themes in one batch. These themes doesn't have to contain the same type of shapes, even though a mix of shapes in one theme isn't permitted.

To allow the user to save and load the state of a loaders data to a ShapeUp workspace file (.sup), a serializing mechanism is provided and should if possible be implemented.


Figure 1. Loading call sequence

Attributes

Most of the time it is required that a set of attributes are attached to the shapes. From the ShapeUp applications point of view, an initial check is performed to see if the loader supports attributes, and how many of them there might be. When attributes are needed, typically when displayed in the attribute data view, the loader is queried for attributes for each shape.

Notice: The data view does not ask the loader plugin for more attributes at a time than are displayed.

When ShapeUp queries the loader for an attribute, the shape for which attributes are needed is sent to the loader. The plugin should use this shape to look-up the needed attribute. There are different approaches to handle this in a ShapeUp loader plugin. The look-up mechanism might use the shape index, or even the shape pointer as a key to read data from a suitable source.

Notice: No attributes are cached in ShapeUp. Data is always fetched from the loader when needed.

Caching attributes in memory might be a good idea to get maximun performance.

Since ShapeUp uses only as much of a shape that is specified by ESRI, a high performance alternative is to allocate more space than needed when creating the shape in the first place. Typically, as much extra needed to store all attributes right after the geographic information. This way, there is no look-up overhead. If this technique is used, all shapes in each theme must have the same number of extra data bytes and ShapeUp needs to be notified of how many of these extra data bytes are added at the end.

...

See Also

Loader API