This is documentation of an archived release.
For documentation on the current version, please check Knowledge Base.

Show Field Of Views

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 :

  • onViewOpened : fired when a View is opened.
  • onViewClosed : fired when a View is closed.
  • onViewStateChanged : fired when a View's state has changed.

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

Loading

Use the Viewer's getFieldOfViews() function to get the list of MapObject instances that represent the Field-of-views of 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();

Rendering

 
Last modified:: 2019/03/25 11:36