Back to contents pageHow to track an object in a visualization control

How to track an object in a visualization control

Summary

This article shows you how to track an object in a visualization control using the API.





Prerequisites

You should know the information in the following article:



Example material

Save this link to get a zip file of the example material


Guide

Before you start, remember:

This guide shows you how to track an object in your visualization.

Assume that the list of objects is contained in listBox1. If you want the visualization to track the selected object, you can get that object by iterating over the Ubisense.UName.Naming.ObjectName relation. Then, set the TrackedObject property of your Ubisense.UVis.Visualization instance, in this case visualization1:


    private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        using (Ubisense.UName.Naming.ReadTransaction xact =
            naming_schema.ReadTransaction())
        {
            foreach (Ubisense.UName.Naming.ObjectName.RowType row in
                Ubisense.UName.Naming.ObjectName.name_(
                xact, listBox1.SelectedItem.ToString()))
            {
                visualization1.TrackedObject = row.object_;
            }
        }
    }

When you run your application, the look point of the current view of the map will be fixed to the 2D coordinates of the object selected from the list. This means that the Visualization will point at the floor of the loaded Area directly under the tracked object. This works in both 2D and 3D views.



Back to top