Difference between revisions of "Category:Plugins"

From Heureka Wiki
Jump to navigation Jump to search
Line 13: Line 13:
 
*Age to breast height
 
*Age to breast height
 
*Forwarder and harvester cost (time consumption)
 
*Forwarder and harvester cost (time consumption)
 +
 +
==Writing plugins for Heureka==
 +
The easiest way to start writing plugins is to use templates that we provide as a starting point [https://www.heurekaslu.se/FilerepositoryDev PluginTemplateProject.zip]. Either open the included project in Visual Studio 2015 or later, or start a new project and include only the required templates. All templates need a reference to 'Slu.Heureka.DomainLayer.dll'. This library can be found with all installations of Heureka in the root of the installation directory.
 +
 +
Comments in the templates will tell you what Heureka expects as a return value from the functions. If a plugin needs to read settings that the user has made to the Production Model Control Table, Heureka will supply this to the plugin constructor if it finds a matching constructor that accepts a single ProductionModelControlTable as an argument. Otherwise the parameterless constructor will be used. At least one of these two constructors MUST be available.
 +
 +
** IMPORTANT ** Plugins are required to have a unique Name string among plugins of the same model. Heureka uses the name to identify which plugin is currently selected.
 +
 +
After building the template project, the plugin .dll files are copied to the solution directory.
 +
 +
==Getting Heureka to load the plugins==
 +
 +
Plugins are loaded from the install directory sub-folder \Plugins as well as from the current user's \Documents\Heureka\Common\Plugins directory. If successful, the plugin will show up in the drop-down box for that particular feature.
 +
 +
If a plugin failed to load, an error will show up in the 'General' output window with information of what went wrong.

Revision as of 09:22, 11 October 2017

It is possible to replace some of Heureka's built-in functions with your own plugins. You need to program such functions in C#. When you have built a plugin-function, you can place it in My Dcouments > Heureka > Common > Plugins-folder. After that, when you start a Heureka application (StandWise, PlanWise or RegWise), the program will scan this folder for functions that implements a certain so called interface. For example, if there is a plugin (dll) that implements the cost function interface, it will be imported to the application in run-time, and be available as an option the control tables interface.

Plugins are available for the following models:

  • Single-tree growth
  • Stand-level growth
  • Tree volume
  • Tree height
  • Tree height growth
  • Bark thickness
  • Mortality
  • Age to breast height
  • Forwarder and harvester cost (time consumption)

Writing plugins for Heureka

The easiest way to start writing plugins is to use templates that we provide as a starting point PluginTemplateProject.zip. Either open the included project in Visual Studio 2015 or later, or start a new project and include only the required templates. All templates need a reference to 'Slu.Heureka.DomainLayer.dll'. This library can be found with all installations of Heureka in the root of the installation directory.

Comments in the templates will tell you what Heureka expects as a return value from the functions. If a plugin needs to read settings that the user has made to the Production Model Control Table, Heureka will supply this to the plugin constructor if it finds a matching constructor that accepts a single ProductionModelControlTable as an argument. Otherwise the parameterless constructor will be used. At least one of these two constructors MUST be available.

    • IMPORTANT ** Plugins are required to have a unique Name string among plugins of the same model. Heureka uses the name to identify which plugin is currently selected.

After building the template project, the plugin .dll files are copied to the solution directory.

Getting Heureka to load the plugins

Plugins are loaded from the install directory sub-folder \Plugins as well as from the current user's \Documents\Heureka\Common\Plugins directory. If successful, the plugin will show up in the drop-down box for that particular feature.

If a plugin failed to load, an error will show up in the 'General' output window with information of what went wrong.

This category currently contains no pages or media.