This document is archived and information here might be outdated.  Recommended version.


Create Group Layer Animation Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Create Group Layer Animation Snippet

Creates a group layer animation using all the layers present in the globe.

[C#]
///<summary>Creates a group layer animation using all the layers present in the globe.</summary>
/// 
///<param name="globe">An IGlobe interface</param>
///  
///<remarks></remarks>
public void CreateGroupLayerAnimation(ESRI.ArcGIS.GlobeCore.IGlobe globe)
{
  ESRI.ArcGIS.Animation.IAGAnimationUtils agAnimationUtils=new ESRI.ArcGIS.Animation.AGAnimationUtilsClass();
  ESRI.ArcGIS.Analyst3D.IBasicScene2 basicScene=(ESRI.ArcGIS.Analyst3D.IBasicScene2)globe; // Explicit Cast
  ESRI.ArcGIS.Animation.IAGAnimationEnvironment agAnimationEnvironment=basicScene.AnimationExtension.AnimationEnvironment;

  // Get the layers in the Globe
  ESRI.ArcGIS.Analyst3D.IScene scene=(ESRI.ArcGIS.Analyst3D.IScene)globe; // Explicit Cast
  ESRI.ArcGIS.Carto.IEnumLayer enumLayer=scene.get_Layers(null, false);
  ESRI.ArcGIS.Carto.ILayer layer=enumLayer.Next();
  ESRI.ArcGIS.esriSystem.IArray array=new ESRI.ArcGIS.esriSystem.ArrayClass();

  do
  {
    array.Add(layer);
    layer=enumLayer.Next();
  }
  while (layer != null);

  // Set the Group AnimationOptions
  ESRI.ArcGIS.Animation.IAGGroupAnimationOptions agGroupAnimationOptions=new ESRI.ArcGIS.Animation.AGGroupAnimationOptionsClass();

  ESRI.ArcGIS.Animation.IAGAnimationTracks AGAnimationTracks=basicScene.AnimationExtension.AnimationTracks;
  agGroupAnimationOptions.AnimationEnvironment=agAnimationEnvironment;
  agGroupAnimationOptions.LayerSet=array;
  agGroupAnimationOptions.AnimationTracks=AGAnimationTracks;
  agGroupAnimationOptions.Blending=true;
  agGroupAnimationOptions.CycleAnimation=true;
  agGroupAnimationOptions.FadingPercentage=20;
  agGroupAnimationOptions.OverwriteExisting=true;
  agGroupAnimationOptions.PutTrackInterval(0, 1);
  agGroupAnimationOptions.PutVisibilitySettings(false, false, false);

  ESRI.ArcGIS.Animation.IAGAnimationContainer agAnimationContainer=(ESRI.ArcGIS.Animation.IAGAnimationContainer)globe;
  agAnimationUtils.CreateLayerGroupAnimation(agAnimationContainer, agGroupAnimationOptions);
}
[Visual Basic .NET]
'''<summary>Creates a group layer animation using all the layers present in the globe.</summary>
''' 
'''<param name="globe">An IGlobe interface</param>
'''  
'''<remarks></remarks>
Public Sub CreateGroupLayerAnimation(ByVal globe As ESRI.ArcGIS.GlobeCore.IGlobe)

  Dim agAnimationUtils As ESRI.ArcGIS.Animation.IAGAnimationUtils=New ESRI.ArcGIS.Animation.AGAnimationUtilsClass
  Dim basicScene As ESRI.ArcGIS.Analyst3D.IBasicScene2=CType(globe, ESRI.ArcGIS.Analyst3D.IBasicScene2) ' Explicit Cast
  Dim AGAnimationEnvironment As ESRI.ArcGIS.Animation.IAGAnimationEnvironment=basicScene.AnimationExtension.AnimationEnvironment

  ' Get the layers in the Globe
  Dim scene As ESRI.ArcGIS.Analyst3D.IScene=CType(globe, ESRI.ArcGIS.Analyst3D.IScene) ' Explicit Cast
  Dim enumLayer As ESRI.ArcGIS.Carto.IEnumLayer=scene.Layers(Nothing, False)
  Dim layer As ESRI.ArcGIS.Carto.ILayer=enumLayer.Next
  Dim array As ESRI.ArcGIS.esriSystem.IArray=New ESRI.ArcGIS.esriSystem.ArrayClass

  Do
    array.Add(layer)
    layer=enumLayer.Next
  Loop While Not (layer Is Nothing)

  ' Set the Group AnimationOptions
  Dim agGroupAnimationOptions As ESRI.ArcGIS.Animation.IAGGroupAnimationOptions=New ESRI.ArcGIS.Animation.AGGroupAnimationOptionsClass

  Dim AGAnimationTracks As ESRI.ArcGIS.Animation.IAGAnimationTracks=basicScene.AnimationExtension.AnimationTracks
  agGroupAnimationOptions.AnimationEnvironment=AGAnimationEnvironment
  agGroupAnimationOptions.LayerSet=array
  agGroupAnimationOptions.AnimationTracks=AGAnimationTracks
  agGroupAnimationOptions.Blending=True
  agGroupAnimationOptions.CycleAnimation=True
  agGroupAnimationOptions.FadingPercentage=20
  agGroupAnimationOptions.OverwriteExisting=True
  agGroupAnimationOptions.PutTrackInterval(0, 1)
  agGroupAnimationOptions.PutVisibilitySettings(False, False, False)

  Dim AGAnimationContainer As ESRI.ArcGIS.Animation.IAGAnimationContainer=CType(globe, ESRI.ArcGIS.Animation.IAGAnimationContainer) ' Explicit Cast
  agAnimationUtils.CreateLayerGroupAnimation(AGAnimationContainer, agGroupAnimationOptions)

End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.3DAnalyst
  • ESRI.ArcGIS.Animation
  • ESRI.ArcGIS.Carto
  • ESRI.ArcGIS.Display
  • ESRI.ArcGIS.GlobeCore
  • ESRI.ArcGIS.System