Auto Follow: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
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_gdk5/managed/class_t_p_g_1_1_g_d_k_1_1_windows_1_1_globe_map_1_1_auto_follow.html here] | ||
Each target item type has a corresponding AutoFollowSource, i.e <code>TrackAutoFollowSource</code>, | 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> | |||
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> | </source> |
Revision as of 14:56, 13 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() };
}