Creates a MOLE Tactical Graphic as a CachedGraphic with the specified attributes.
[C#]
///<summary>Creates a MOLE Tactical Graphic as a CachedGraphic with the specified attributes.</summary> /// ///<param name="cacheRendererCollection">An ICacheRendererCollection interface that is a collection of renderers.</param> ///<param name="display">An IDisplay interface. Preferably an ActiveView.ScreenDisplay.</param> ///<param name="symbolIdCode">A System.String that is Symbol ID Code (SIC) from MIL-STD-2525B / APP6a document. Example: "GFGPGLP-------X"</param> ///<param name="geometry">An IGeometry interface that is used to create graphic with (must match geometry required by corresponding Symbol Id Code in the standard.</param> ///<param name="propertySet">An IPropertySet interface that is used for creating graphic.</param> ///<param name="textSize">A System.Double that is the size of Text accompanying graphic(in Map Units). Example: 0.5</param> ///<param name="symbolSize">A System.Double that is the size of Symbol (in Map Units). Example: 0.5</param> ///<param name="useAffiliationColor">A System.Boolean that ignores Style's color and use affilition color.</param> ///<param name="useFonts">A System.Boolean if true, polygon text if false.</param> /// ///<returns>An ICachedGraphic interface with the specified attributes, Nothing if fails</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.DefenseSolutions.ICachedGraphic CreateTacticalGraphic(ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection cachedRenderCollection, ESRI.ArcGIS.Display.IDisplay display, System.String symbolIdCode, ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.esriSystem.IPropertySet propertySet, System.Double textSize, System.Double symbolSize, System.Boolean useAffiliationColor, System.Boolean useFonts) { // For more information on Symbol ID Codes see see: http://webhelp.esri.com/arcgisdesktop/9.1/body.cfm?tocVisable=1&ID=2778&TopicName=Symbol%20ID%20code ESRI.ArcGIS.DefenseSolutions.ICachedGraphic cachedGraphic = null; ESRI.ArcGIS.DefenseSolutions.ITacticalElement tacticalElement = new ESRI.ArcGIS.DefenseSolutions.TacticalElementClass(); tacticalElement.Shape = geometry; tacticalElement.MessageString = symbolIdCode; tacticalElement.PropertySet = propertySet; ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer tacticalGraphicRenderer; System.Boolean foundRendererForGraphic = false; System.Int32 count = cachedRenderCollection.RendererCount; for (System.Int32 i = 0; i < count; i++) { // for each renderer, see if it can render the selected graphic tacticalGraphicRenderer = cachedRenderCollection.Renderer(i) as ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer; // Dynamic Cast if (tacticalGraphicRenderer.CanRenderTacticalElement(tacticalElement)) { // find the first renderer that can render it, and then use it foundRendererForGraphic = true; tacticalGraphicRenderer.TextSize = textSize; tacticalGraphicRenderer.UsesAffiliationColor = useAffiliationColor; ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer2 tacticalGraphicRenderer2 = tacticalGraphicRenderer as ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer2; // Dynamic Cast if (tacticalGraphicRenderer2 != null) tacticalGraphicRenderer2.Size = symbolSize; if (tacticalGraphicRenderer.Style != null) tacticalGraphicRenderer.Style.UseFonts = useFonts; cachedGraphic = tacticalGraphicRenderer.GraphicByTacticalElement(display, tacticalElement); cachedGraphic.Geometry = geometry; cachedGraphic.Draw(display, null); break; } // if CanRenderTacticalElement } // for each renderer if ((cachedGraphic == null) || (!foundRendererForGraphic)) { System.Diagnostics.Trace.WriteLine("Could not render graphic with supplied properties."); } return cachedGraphic; }
[Visual Basic .NET]
'''<summary>Creates a MOLE Tactical Graphic as a CachedGraphic with the specified attributes.</summary> ''' '''<param name="cacheRendererCollection">An ICacheRendererCollection interface that is a collection of renderers.</param> '''<param name="display">An IDisplay interface. Preferably an ActiveView.ScreenDisplay.</param> '''<param name="symbolIdCode">A System.String that is Symbol ID Code (SIC) from MIL-STD-2525B / APP6a document. Example: "GFGPGLP-------X"</param> '''<param name="geometry">An IGeometry interface that is used to create graphic with (must match geometry required by corresponding Symbol Id Code in the standard.</param> '''<param name="propertySet">An IPropertySet interface that is used for creating graphic.</param> '''<param name="textSize">A System.Double that is the size of Text accompanying graphic(in Map Units). Example: 0.5</param> '''<param name="symbolSize">A System.Double that is the size of Symbol (in Map Units). Example: 0.5</param> '''<param name="useAffiliationColor">A System.Boolean that ignores Style's color and use affilition color.</param> '''<param name="useFonts">A System.Boolean if true, polygon text if false.</param> ''' '''<returns>An ICachedGraphic interface with the specified attributes, Nothing if fails</returns> ''' '''<remarks></remarks> Public Function CreateTacticalGraphic(ByVal cacheRendererCollection As ESRI.ArcGIS.DefenseSolutions.ICacheRendererCollection, ByVal display As ESRI.ArcGIS.Display.IDisplay, ByVal symbolIdCode As System.String, ByVal geometry As ESRI.ArcGIS.Geometry.IGeometry, ByVal propertySet As ESRI.ArcGIS.esriSystem.IPropertySet, ByVal textSize As System.Double, ByVal symbolSize As System.Double, ByVal useAffiliationColor As System.Boolean, ByVal useFonts As System.Boolean) As ESRI.ArcGIS.DefenseSolutions.ICachedGraphic ' For more information on Symbol ID Codes see see: http://webhelp.esri.com/arcgisdesktop/9.1/body.cfm?tocVisable=1&ID=2778&TopicName=Symbol%20ID%20code Dim cachedGraphic As ESRI.ArcGIS.DefenseSolutions.ICachedGraphic = Nothing Dim tacticalElement As ESRI.ArcGIS.DefenseSolutions.ITacticalElement = New ESRI.ArcGIS.DefenseSolutions.TacticalElementClass tacticalElement.Shape = geometry tacticalElement.MessageString = symbolIdCode tacticalElement.PropertySet = propertySet Dim tacticalGraphicRenderer As ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer Dim foundRendererForGraphic As System.Boolean = False Dim count As System.Int32 = cacheRendererCollection.RendererCount Dim i As Integer = 0 While i < count ' for each renderer, see if it can render the selected graphic tacticalGraphicRenderer = CType(cacheRendererCollection.Renderer(i), ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer) ' Explicit Cast If tacticalGraphicRenderer.CanRenderTacticalElement(tacticalElement) Then ' find the first renderer that can render it, and then use it foundRendererForGraphic = True tacticalGraphicRenderer.TextSize = textSize tacticalGraphicRenderer.UsesAffiliationColor = useAffiliationColor Dim tacticalGraphicRenderer2 As ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer2 = CType(tacticalGraphicRenderer, ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicRenderer2) ' Explicit Cast If Not (tacticalGraphicRenderer2 Is Nothing) Then tacticalGraphicRenderer2.Size = symbolSize End If If Not (tacticalGraphicRenderer.Style Is Nothing) Then tacticalGraphicRenderer.Style.UseFonts = useFonts End If cachedGraphic = tacticalGraphicRenderer.GraphicByTacticalElement(display, tacticalElement) cachedGraphic.Geometry = geometry cachedGraphic.Draw(display, Nothing) i = count End If i = i + 1 End While If (cachedGraphic Is Nothing) OrElse (Not foundRendererForGraphic) Then System.Diagnostics.Trace.WriteLine("Could not render graphic with supplied properties.") End If Return cachedGraphic End Function