ArcObjects Library Reference

Get FEGraphicFactory Snippet

Uses MoleCoreHelper to get a single instance of the FEGraphicFactory.

[C#]

///<summary>Uses MoleCoreHelper to get a single instance of the FEGraphicFactory.</summary>
///   
///<returns>An IFEGraphicFactory interface for Force Element operations.</returns>
///
///<remarks>
///Uses MoleCoreHelper to get a single instance of the FEGraphicFactory
///Regardless of the number of times called, the same FEGraphicFactory will always be
///returned.  Also note, changing the properties of this FEGraphicFactory will also
///affect all others using it.
///</remarks>
public ESRI.ArcGIS.DefenseSolutions.IFEGraphicFactory GetFEGraphicFactory()
{
  ESRI.ArcGIS.DefenseSolutions.IFEGraphicFactory feGraphicFactory = null;

  // use MoleCoreHelper to get single instance of renderer
  ESRI.ArcGIS.DefenseSolutions.IMoleCoreHelper moleHelper = new ESRI.ArcGIS.DefenseSolutions.MoleCoreHelperClass();

  ESRI.ArcGIS.DefenseSolutions.IForceElement2525BRenderer renderer = moleHelper.ForceElementRenderer as ESRI.ArcGIS.DefenseSolutions.IForceElement2525BRenderer;  // Dynamic Cast

  // use the renderer to get the one instance of the graphic factory
  if (renderer != null)
    feGraphicFactory = renderer.GraphicFactory;

  return feGraphicFactory;
}
[Visual Basic .NET]

'''<summary>Uses MoleCoreHelper to get a single instance of the FEGraphicFactory.</summary>
'''   
'''<returns>An IFEGraphicFactory interface for Force Element operations.</returns>
'''
'''<remarks>
'''Uses MoleCoreHelper to get a single instance of the FEGraphicFactory
'''Regardless of the number of times called, the same FEGraphicFactory will always be
'''returned.  Also note, changing the properties of this FEGraphicFactory will also
'''affect all others using it.
'''</remarks>
Public Function GetFEGraphicFactory() As ESRI.ArcGIS.DefenseSolutions.IFEGraphicFactory

  Dim feGraphicFactory As ESRI.ArcGIS.DefenseSolutions.IFEGraphicFactory = Nothing

  ' use MoleCoreHelper to get single instance of renderer
  Dim moleCoreHelper As ESRI.ArcGIS.DefenseSolutions.IMoleCoreHelper = New ESRI.ArcGIS.DefenseSolutions.MoleCoreHelperClass
  Dim forceElement2525BRenderer As ESRI.ArcGIS.DefenseSolutions.IForceElement2525BRenderer

  ' use the renderer to get the one instance of the graphic factory
  forceElement2525BRenderer = CType(moleCoreHelper.ForceElementRenderer, ESRI.ArcGIS.DefenseSolutions.IForceElement2525BRenderer) ' Explicit Cast

  If Not (forceElement2525BRenderer Is Nothing) Then

    feGraphicFactory = forceElement2525BRenderer.GraphicFactory

  End If

  Return feGraphicFactory

End Function


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