Using the Custom Action ATL Class Template


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.

  1. Start Visual Studio and create a new project. The New Project dialog box appears.
  2. In the Project types listing, select Visual C++ > ATL.
  3. Select ATL Project from the list of installed templates.
  4. 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.
  5. 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.
  6. Click Finish to create the project.
  7. 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.
  8. In the Categories listing, select Visual C++ > ArcGIS > Engine.
  9. Select TrackingAction from the list of installed templates and click Add. The Tracking Action Object Wizard appears.
  10. 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.
  11. 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.
  12. 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.
  13. 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”.
  14. 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
  15. Click Finish to add the new class to your project. You will notice that several files have been added to your project.
  16. 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.
  17. Build the project.
  18. 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.

  19. Build the project.
  20. 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.