Using the Custom Action ATL Class Template
The Tracking Server SDK is required to execute this procedure.
Microsoft Visual Studio 2008 or 2010 is required to execute this procedure.
Either an ArcGIS for Desktop or ArcGIS Engine for Windows installation is required to execute this procedure.
Custom actions can be created to execute custom data processing on tracking data. An action can belong to one or more of the following categories: server actions, service actions, layer actions, and real-time layer actions.
The C++ Custom Action Class Template can be used to create a custom action of any of these types.
- Start Visual Studio and create a new project. The New Project dialog box appears.
- In the Project types listing, select Visual C++ > ATL.
- Select ATL Project from the list of installed templates.
- Enter additional information required for your new project and click OK to create the project. For example, you might want to change the name and location of your project.
- On the ATL Project Wizard dialog box, ensure that the server type is set to Dynamic-link Library (DLL) and no additional options are specified.
- Click Finish to create the project.
- Select the option to add a class to your new project. This can be done by selecting Project > Add Class from the main menu or right-clicking on the new ATL Project and selecting Add > Class. The Add Class dialog box appears.
- In the Categories listing, select Visual C++ > ArcGIS > Engine.
- Select TrackingAction from the list of installed templates and click Add. The Tracking Action Object Wizard appears.
- Enter a name for the new action class in the Name text box. This specifies the name of the class files that will be created.
- Enter a title for the new action in the Title text box. This title will identify the new action in the New Action dialog box in ArcGIS for Desktop, if it is installed.
- Enter a description for the new action in the Description text box. This description will appear in the Action Description text box in ArcGIS for Desktop, if it is installed.
- In the ArcGIS Engine/Desktop install directory text box, enter the path to your ArcGIS for Desktop or ArcGIS Engine for Windows installation location. For example, some common installation locations are “C:\Program Files\ArcGIS\Desktop10.1” and “C:\Program Files\ArcGIS\Engine10.1”.
- Based on the type of action you want to create, check the appropriate check boxes in the Action Type section of the dialog box. A single action may have one or more different types.
The available action types are:
- Server Action
- Service Action
- Real-time Layer Action
- Layer Action
- Click Finish to add the new class to your project. You will notice that several files have been added to your project.
- Add custom code to the classes in the project to achieve the desired result. To find the areas where it is suggested to modify the code, search for the phrase "TODO" throughout the entire project and follow the instructions.
- Build the project.
- You must register the new DLL that was created using the registration utility provided by ESRI. The ESRIRegasm.exe is located in “C:\Program Files\Common Files\ArcGIS\bin”.
The syntax for the registration utility is:ESRIRegasm.exe <assembly name> /v:<version> /p:<product>
For example, if the DLL created is located in "C:\Project" and you have ArcGIS for Desktop installed, the command might look like this:"C:\Program Files\Common Files\ArcGIS\bin\ESRIRegasm.exe" "C:\Project\CustomComponent.dll" /v:10.1 /p:Desktop
If you have ArcGIS Engine for Windows installed, the command might look like this:"C:\Program Files\Common Files\ArcGIS\bin\ESRIRegasm.exe" "C:\Project\CustomComponent.dll" /v:10.1 /p:Engine
You will receive a confirmation message if the registration is successful.
- Build the project.
- Your custom action is ready for use.
If you have ArcGIS for Desktop installed, then layer actions, real-time layer actions, and service actions will be available in the appropriate layer or service properties dialog boxes. If you have Tracking Server installed, then server actions will appear in Tracking Server Manager.