Table of Contents

Track Field Of View

This page describes how to track View updates to render Field-Of-Views on the Reference Map.

Listening

Tracking Views means listening for changes in the number of views, or changes in the state of an individual View. To do that, use these signals :

When any of these events occur, Views should be refreshed on the map.

Loading

Use the getFieldOfViews() function to get the list of Field-of-view objects for all views.

/**
 * Update views on the map.
 */
function updateViews() {
  var mapObjects = viewer.getFieldOfViews(null/*all*/);
  renderMapObjects(mapObjects);
}
// Listen to view changes
this.viewer.onViewStateChanged.add(updateViews);
this.viewer.onViewOpened.add(updateViews);
this.viewer.onViewClosed.add(updateViews);
 
// Start with an update.
// It may be the case that a view was already open prior to attaching our signal listener.
updateViews();

Below is an example that uses the above signals and shows you the returned MapObjects as the Views change.

Rendering

See Rendering MapObjects.