{"name":"Terrain Processor SDK Manual","title":"Terrain Processor SDK Manual","type":"topic","url":"https://community.bistudio.com/wiki/Terrain_Processor_SDK_Manual","revid":349828,"updated":"2023-11-20T22:10:30Z","aliases":[],"markdown":"Terrain Processor has its own **SDK** which allows the creation of new tasks. Hereafter, you will find a quick introduction of the setup of the new project. All you need is the Visual Studio (an Express version is enough) and the SDK which is available in [Arma 3 Samples](http://store.steampowered.com/app/390500).\n\n### Create New Project in Visual Studio\n\nStart Microsoft Visual Studio and create a new Project.\n\nConfigure it to be an empty DLL.\n\n### Add include and library directories\n\nThen, go to the configuration of the project and edit the debug configuration to include the library directory (VC++ Directories option group).\n\n### Add lib to dependencies\n\nFrom the project configuration, go to *Linker*, *Input* and define the additional dependencies.\n\n### Create plugin source files\n\nCreate a new header called **pluginTest.h** with the following content:\n\n```cpp\n#pragma once\n\n#include \"TerrainProcessorPlugin.h\"\n\nusing namespace TerrainProcessorSDK;\n\n// Test plugin.\nclass PluginTest : public TerrainProcessorPlugin\n{\npublic:\n    // Sample parameter\n    TerrainProcessorParameterDefinition _sampleParameter;\n\n    // Constructor.\n    PluginTest();\n    // Process shape.\n    virtual void ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters);\n};\n```\n\nThen a code file called **pluginTest.cpp** with this content:\n\n```cpp\n#include \"PluginTest.h\"\n#include <algorithm>\n#include <cmath>\n\n// Constructor.\nPluginTest::PluginTest()\n    : TerrainProcessorPlugin(\n    \"Test\",\n    \"Test plugin.\",\n    GTPolyline,\n    TPPFlagsShapeFile | TPPFlagsDEM)\n{\n    _sampleParameter = TerrainProcessorParameterDefinition(\n    \"Sample parameter\",\n    \"Sample parameter. \\r\\n\"\n    \"Default value is : 10\",\n    \"10\",\n    TPPT_DOUBLE);\n    _parameters.push_back(_sampleParameter);\n}\n\n// Process shape.\nvoid PluginTest::ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters)\n{\n    _sampleParameter = _parameters[0];\n}\n```\n\n### Create Plugin.cpp and DllExport.def\n\nNew code file named **Plugin.cpp**:\n\n```cpp\n#include <vector>\n#include <memory>\n#include \"TerrainProcessorPlugin.h\"\n#include \"PluginTest.h\"\n\nusing namespace TerrainProcessorSDK;\n\n// Get plugins function.\n__declspec(dllexport) bool __stdcall GetPlugins(std::reference_wrapper<std::vector<std::shared_ptr<TerrainProcessorPlugin>>> plugins)\n{\n    plugins.get().push_back(std::make_shared<PluginTest>());\n\n    return true;\n}\n```\n\nAnd finally a new **module-definitions** file:\n\n```cpp\nLIBRARY PLUGIN_TEST\nEXPORTS\n    GetPlugins        @1\n```","sections":[{"heading":null,"level":1,"markdown":"Terrain Processor has its own **SDK** which allows the creation of new tasks. Hereafter, you will find a quick introduction of the setup of the new project. All you need is the Visual Studio (an Express version is enough) and the SDK which is available in [Arma 3 Samples](http://store.steampowered.com/app/390500)."},{"heading":"Create New Project in Visual Studio","level":3,"markdown":"Start Microsoft Visual Studio and create a new Project.\n\nConfigure it to be an empty DLL."},{"heading":"Add include and library directories","level":3,"markdown":"Then, go to the configuration of the project and edit the debug configuration to include the library directory (VC++ Directories option group)."},{"heading":"Add lib to dependencies","level":3,"markdown":"From the project configuration, go to *Linker*, *Input* and define the additional dependencies."},{"heading":"Create plugin source files","level":3,"markdown":"Create a new header called **pluginTest.h** with the following content:\n\n```cpp\n#pragma once\n\n#include \"TerrainProcessorPlugin.h\"\n\nusing namespace TerrainProcessorSDK;\n\n// Test plugin.\nclass PluginTest : public TerrainProcessorPlugin\n{\npublic:\n    // Sample parameter\n    TerrainProcessorParameterDefinition _sampleParameter;\n\n    // Constructor.\n    PluginTest();\n    // Process shape.\n    virtual void ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters);\n};\n```\n\nThen a code file called **pluginTest.cpp** with this content:\n\n```cpp\n#include \"PluginTest.h\"\n#include <algorithm>\n#include <cmath>\n\n// Constructor.\nPluginTest::PluginTest()\n    : TerrainProcessorPlugin(\n    \"Test\",\n    \"Test plugin.\",\n    GTPolyline,\n    TPPFlagsShapeFile | TPPFlagsDEM)\n{\n    _sampleParameter = TerrainProcessorParameterDefinition(\n    \"Sample parameter\",\n    \"Sample parameter. \\r\\n\"\n    \"Default value is : 10\",\n    \"10\",\n    TPPT_DOUBLE);\n    _parameters.push_back(_sampleParameter);\n}\n\n// Process shape.\nvoid PluginTest::ProcessShape(IRunContext& context, ShapeFiles::SHPShape* shape, const ShapeParameters& shapeParameters)\n{\n    _sampleParameter = _parameters[0];\n}\n```"},{"heading":"Create Plugin.cpp and DllExport.def","level":3,"markdown":"New code file named **Plugin.cpp**:\n\n```cpp\n#include <vector>\n#include <memory>\n#include \"TerrainProcessorPlugin.h\"\n#include \"PluginTest.h\"\n\nusing namespace TerrainProcessorSDK;\n\n// Get plugins function.\n__declspec(dllexport) bool __stdcall GetPlugins(std::reference_wrapper<std::vector<std::shared_ptr<TerrainProcessorPlugin>>> plugins)\n{\n    plugins.get().push_back(std::make_shared<PluginTest>());\n\n    return true;\n}\n```\n\nAnd finally a new **module-definitions** file:\n\n```cpp\nLIBRARY PLUGIN_TEST\nEXPORTS\n    GetPlugins        @1\n```"}],"categories":["Arma 3: Official Tools Manual","Terrain Processor Manual"],"groups":["Tools and File Formats"]}