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


Get Tactical Graphic Cached Renderer Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Get Tactical Graphic Cached Renderer Snippet

Creates a Tactical Graphic Layer and obtains a cached renderer from this layer.

[C#]
///<summary>Creates a Tactical Graphic Layer and obtains a cached renderer from this layer.</summary>
///  
///<returns>An ICacheRendererCollection interface.</returns>
///   
///<remarks>
///IMPORTANT: For performance reasons, this should only be called once
///and a application-wide reference to the renderer returned should be 
///maintained by the client (rather than making multiple or frequent calls
///to this function).
///</remarks>
public ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection GetTacticalGraphicCachedRenderer()
{
  ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicLayer tacticalGraphicLayer=new ESRI.ArcGIS.DefenseSolutions.TacticalGraphicLayerClass();
  ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection cachedRenderCollection=((ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection)(tacticalGraphicLayer)); // Explicit Cast
  ESRI.ArcGIS.DefenseSolutions.ICacheRenderer cacheRenderer=new ESRI.ArcGIS.DefenseSolutions.TacticalGraphic2525BRendererClass();
  cachedRenderCollection.AddRenderer(ref cacheRenderer, 0);
  return cachedRenderCollection;
}
[Visual Basic .NET]
'''<summary>Creates a Tactical Graphic Layer and obtains a cached renderer from this layer.</summary>
'''  
'''<returns>An ICacheRendererCollection interface.</returns>
'''   
'''<remarks>
'''IMPORTANT: For performance reasons, this should only be called once
'''and a application-wide reference to the renderer returned should be 
'''maintained by the client (rather than making multiple or frequent calls
'''to this function).
'''</remarks>
Public Function GetTacticalGraphicCachedRenderer() As ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection

  Dim tacticalGraphicLayer As ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicLayer=New ESRI.ArcGIS.DefenseSolutions.TacticalGraphicLayerClass
  Dim cachedRenderCollection As ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection=CType(tacticalGraphicLayer, ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection) ' Explict Cast
  Dim cacheRenderer As ESRI.ArcGIS.DefenseSolutions.ICacheRenderer=New ESRI.ArcGIS.DefenseSolutions.TacticalGraphic2525BRendererClass
  cachedRenderCollection.AddRenderer(cacheRenderer, 0)

  Return cachedRenderCollection

End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Carto
  • ESRI.ArcGIS.DefenseSolutions
  • ESRI.ArcGIS.Geodatabase
  • ESRI.ArcGIS.System