Auto Follow: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
(Created page with "You can set up an Auto-Follow camera to track a moving entity in the map. The auto-follow source can be either a Track, Draw object or a VideoMetadata source. The API documentation can be found [http://codedocs.maria.teleplanglobe.com/develop_gdk5/managed/class_t_p_g_1_1_g_d_k_1_1_windows_1_1_globe_map_1_1_auto_follow.html here]")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
You can set up an Auto-Follow camera to track a moving entity in the map. The auto-follow source can be either a Track, Draw object or a VideoMetadata source.
You can set up an Auto-Follow camera to track a moving entity in the map. The auto-follow source can be either a Track, Draw object or a VideoMetadata source.


The API documentation can be found [http://codedocs.maria.teleplanglobe.com/develop_gdk5/managed/class_t_p_g_1_1_g_d_k_1_1_windows_1_1_globe_map_1_1_auto_follow.html here]
The API documentation can be found [http://codedocs.maria.teleplanglobe.com/develop/managed/class_t_p_g_1_1_globe3_d_1_1_globe_map_1_1_auto_follow.html here]
 
Each target item type has a corresponding AutoFollowSource, i.e <code>TrackAutoFollowSource</code>, <code>DrawObjectAutoFollowSource</code> and <code>VideoMetadataAutoFollowSource</code>. These are initialized with either an ItemId or a VideoMetadata object.
 
== Example ==
 
The following example enables autofollow on different types of objects depending on what objects exists and are selected:
 
<source lang="C#">
 
  string videoName = "Video";
  var video = _videoLayerViewModel.Videos.FirstOrDefault(metadata => metadata.Name == videoName);
  if (video != null)
  {
      _autoFollow.TargetItem = new VideoMetadataAutoFollowSource { Video = video };
  }
 
  else if (_trackLayer.Selected.Count() > 0)
  {
      _autoFollow.TargetItem = new TrackAutoFollowSource { ItemId = _trackLayer.Selected.First() };
  }
 
  else if (_drawObjectLayer.SelectedDrawObjectIds.Count() > 0)
  {
      _autoFollow.TargetItem = new DrawObjectAutoFollowSource { ItemId = _drawObjectLayer.SelectedDrawObjectIds.First() };
  }
 
</source>
 
[[Category:Draw objects]]
[[Category:Tracks]]

Latest revision as of 10:13, 14 August 2024

You can set up an Auto-Follow camera to track a moving entity in the map. The auto-follow source can be either a Track, Draw object or a VideoMetadata source.

The API documentation can be found here

Each target item type has a corresponding AutoFollowSource, i.e TrackAutoFollowSource, DrawObjectAutoFollowSource and VideoMetadataAutoFollowSource. These are initialized with either an ItemId or a VideoMetadata object.

Example

The following example enables autofollow on different types of objects depending on what objects exists and are selected:

   string videoName = "Video";
   var video = _videoLayerViewModel.Videos.FirstOrDefault(metadata => metadata.Name == videoName);
   if (video != null)
   {
      _autoFollow.TargetItem = new VideoMetadataAutoFollowSource { Video = video };
   }

   else if (_trackLayer.Selected.Count() > 0)
   {
      _autoFollow.TargetItem = new TrackAutoFollowSource { ItemId = _trackLayer.Selected.First() };
   }

   else if (_drawObjectLayer.SelectedDrawObjectIds.Count() > 0)
   {
      _autoFollow.TargetItem = new DrawObjectAutoFollowSource { ItemId = _drawObjectLayer.SelectedDrawObjectIds.First() };
   }