This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Draw Compound Marker on Dynamic Display Snippet (ArcObjects .NET 10.4 SDK) |
Draws a given point as a compound marker symbol with six strings around it.
///<summary>Draws a given point as a compound marker symbol with six strings around it.</summary> /// ///<param name="dynamicDisplay">An IDynamicDisplay interface.</param> ///<param name="dynamicGlyph">An IDynamicGlyph interface that is the marker used to draw the point.</param> ///<param name="point">An IPoint interface that is the point in which the marker will get drawn.</param> ///<param name="heading">A float that is the heading which sets the item's orientation. Example: 0.</param> ///<param name="scale">A float that is the scale of the marker symbol. Value of 1.0 will draw the marker in its original size. Example: 2.</param> /// ///<remarks></remarks> public void DrawCompoundMarkerOnDynamicDisplay(ESRI.ArcGIS.Display.IDynamicDisplay dynamicDisplay, ESRI.ArcGIS.Display.IDynamicGlyph dynamicGlyph, ESRI.ArcGIS.Geometry.IPoint point, System.Single heading, System.Single scale) { if (null == dynamicDisplay || null == point || dynamicGlyph == null) return; // cast the DynamicDisplay into DynamicSymbolProperties ESRI.ArcGIS.Display.IDynamicSymbolProperties dynamicSymbolProperties=dynamicDisplay as ESRI.ArcGIS.Display.IDynamicSymbolProperties; // Dynamic Cast // cast the compound marker symbol ESRI.ArcGIS.Display.IDynamicCompoundMarker dynamicCompoundMarker=dynamicDisplay as ESRI.ArcGIS.Display.IDynamicCompoundMarker; // Dynamic Cast // set the heading of the current symbols' text dynamicSymbolProperties.set_Heading(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolText, heading); // set the symbol alignment so that it will align with the screen dynamicSymbolProperties.set_RotationAlignment(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker, ESRI.ArcGIS.Display.esriDynamicSymbolRotationAlignment.esriDSRAScreen); // set the text alignment so that it will also align with the screen dynamicSymbolProperties.set_RotationAlignment(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolText, ESRI.ArcGIS.Display.esriDynamicSymbolRotationAlignment.esriDSRAScreen); // scale the item dynamicSymbolProperties.SetScale(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker, scale, scale); // set the items' color (blue) dynamicSymbolProperties.SetColor(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker, 0.0f, 0.0f, 1.0f, 1.0f); // Blue // assign the item's glyph to the dynamic-symbol dynamicSymbolProperties.set_DynamicGlyph(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker, dynamicGlyph); // set the color of the text dynamicSymbolProperties.SetColor(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolText, 1.0f, 1.0f, 0.0f, 1.0f); // Yellow // draw the item as a compound marker. This mean that you do not have to draw the items and its // accompanying labels separately, and thus allow you to write less code as well as get better // performance. dynamicCompoundMarker.DrawCompoundMarker6 (point, "TOP", "BOTTOM", "Item", heading.ToString("###.##"), point.X.ToString("###.#####"), point.Y.ToString("###.#####")); }
'''<summary>Draws a given point as a compound marker symbol with six strings around it.</summary> ''' '''<param name="dynamicDisplay">An IDynamicDisplay interface.</param> '''<param name="dynamicGlyph">An IDynamicGlyph interface that is the marker used to draw the point.</param> '''<param name="point">An IPoint interface that is the point in which the marker will get drawn.</param> '''<param name="heading">A float that is the heading which sets the item's orientation. Example: 0.</param> '''<param name="scale">A float that is the scale of the marker symbol. Value of 1.0 will draw the marker in its original size. Example: 2.</param> ''' '''<remarks></remarks> Public Sub DrawCompoundMarkerOnDynamicDisplay(ByVal dynamicDisplay As ESRI.ArcGIS.Display.IDynamicDisplay, ByVal dynamicGlyph As ESRI.ArcGIS.Display.IDynamicGlyph, ByVal point As ESRI.ArcGIS.Geometry.IPoint, ByVal heading As System.Single, ByVal scale As System.Single) If Nothing Is dynamicDisplay OrElse Nothing Is point OrElse dynamicGlyph Is Nothing Then Return End If ' cast the DynamicDisplay into DynamicSymbolProperties Dim dynamicSymbolProperties As ESRI.ArcGIS.Display.IDynamicSymbolProperties=TryCast(dynamicDisplay, ESRI.ArcGIS.Display.IDynamicSymbolProperties) ' Dynamic Cast ' cast the compound marker symbol Dim dynamicCompoundMarker As ESRI.ArcGIS.Display.IDynamicCompoundMarker=TryCast(dynamicDisplay, ESRI.ArcGIS.Display.IDynamicCompoundMarker) ' Dynamic Cast ' set the heading of the current symbols' text dynamicSymbolProperties.Heading(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolText)=heading ' set the symbol alignment so that it will align with the screen dynamicSymbolProperties.RotationAlignment(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker)=ESRI.ArcGIS.Display.esriDynamicSymbolRotationAlignment.esriDSRAScreen ' set the text alignment so that it will also align with the screen dynamicSymbolProperties.RotationAlignment(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolText)=ESRI.ArcGIS.Display.esriDynamicSymbolRotationAlignment.esriDSRAScreen ' scale the item dynamicSymbolProperties.SetScale(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker, scale, scale) ' set the items' color (blue) dynamicSymbolProperties.SetColor(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker, 0.0, 0.0, 1.0, 1.0) ' Blue ' assign the item's glyph to the dynamic-symbol dynamicSymbolProperties.DynamicGlyph(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolMarker)=dynamicGlyph ' set the color of the text dynamicSymbolProperties.SetColor(ESRI.ArcGIS.Display.esriDynamicSymbolType.esriDSymbolText, 1.0, 1.0, 0.0, 1.0) ' Yellow ' draw the item as a compound marker. This mean that you do not have to draw the items and its ' accompanying labels separately, and thus allow you to write less code as well as get better ' performance. dynamicCompoundMarker.DrawCompoundMarker6(point, "TOP", "BOTTOM", "Item", heading.ToString("###.##"), point.X.ToString("###.#####"), point.Y.ToString("###.#####")) End Sub