ShapeUp Statistical Plug-in Overview


General

A statistical plug-in is used to perform various calculations on attribute data. Some functions are already included in ShapeUp, such as min, max, mean, standard deviation etc, but the overall need for functions is hard to foresee. This type of plug-in is desigend to solve that problem. A statistical plug-in is a plain DLL with a renamed extension to distinguish it from other types of plug-ins. The extension should be .stc, and the file should be located in the folder <ShapeUp.exe folder>\Plugins.

Valid statistical tools can then be found by the user from the Table menu or possibly from the statistical toolbar. The name displayed here is not necessarily the same name as the .stc file, since the display name is defined within the plug-in.

Function

The idea is that the plug-in is first initialized globally by a call to fnPreCalculate. Then for each shape in the data set, fnPushValue is called with the value taken from the current selected attribute column. The data set can vary depending on current selection in the active layer. If there are selections, the user can choose whether to perform the calculation on all, selected or unselected objects. After all shapes in the data set have been sent to fnPushValue, ShapeUp calls fnCalculate. This function should return a message describing what was done and what the result is. This process is totally synchronous, enabling state to be stored in global variables in the plug-in. Make sure any allocated memory is freed before fnCalculate returns.

Notice: State cannot be stored in global variables from fnSettings since the plug-in is reloaded before the actual calculation process begins. It is recommended that these settings are stored in the registry.

All values are sent to fnPushValue as a pointer to a const char regardless of the attribute type, i.e. if performing calculations on e.g. integer values, a conversion must first be made.


Figure 1. Calculation call sequence

See Also

Statistical API