This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Get FEGraphicFactory Snippet (ArcObjects .NET 10.4 SDK) |
Uses MoleCoreHelper to get a single instance of the FEGraphicFactory.
///<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; }
'''<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