How to create a dynamic glyph from a marker symbol

Drawing dynamic content to the dynamic display is done with dynamic glyphs. Dynamic glyphs handle the necessary resources to be rendered by the dynamic symbol. This can be a resource for a line, marker, or text. This document guides you through the required steps to create glyphs for a marker symbol and draw them on the map.

Creating dynamic glyphs

Creation of dynamic glyphs must take place inside one of the dynamic drawing methods; either inside IDynamicLayer.drawDynamicLayer or one of the DynamicDisplayEvents callbacks (IDynamicMapEvents.beforeDraw and IDynamicMapEvents.afterDraw). This is because the creation of a DynamicGlyph is done through the DynamicGlyphFactory, which is a property of the DynamicDisplay where the DynamicDisplay is a parameter of these methods.
Obtaining DynamicGlyphFactory and DynamicSymbolProperties from the DynamicDisplay
It is highly recommended to keep the DynamicGlyphFactory and DynamicSymbolProperties as class members and only get them once from the DynamicDisplay, since they will be used many times throughout the lifetime of the application. See the following:
if (bOnce){
    //Get the DynamicGlyphFactory from the DynamicDisplay.
    dynamicGlyphFactory = DynamicDisplay.getDynamicGlyphFactory();
    //Cast the DynamicDisplay into DynamicSymbolProperties.
    dynamicSymbolProps = (IDynamicSymbolProperties)DynamicDisplay;
    � � � 
    //Do other initializations here.
    //Call a method to create your glyph.

    bOnce = false;
Implementing the CreateMarkerGlyph method
The following goes through the required steps to implement the createMarkerGlyph() method.
  1. At the bottom of your code, add a new createMarkerGlyph() private method. See the following:
private void createMarkerGlyph(){}
  1. Set the color that will be used as a background by the DynamicGlyph. See the following:
//Set the background color to white.
IRgbColor color = new RgbColor();
  1. Create the marker symbol. In this example, create a character marker symbol. For convenience, use the ToStdFont() method, which converts a .NET font into stdole.IFontDisp. See the following:
ICharacterMarkerSymbol charMarkerSymbol = new CharacterMarkerSymbol();
StdFont font = new StdFont();
font.setName("ESRI Default Marker");
  1. Set the font's character index, size, and background color. See the following:
  1. Use the previously cached DynamicGlyphFactory to generate the glyph. See the following:
markerGlyph = dynamicGlyphFactory.createDynamicGlyph((ISymbol)charMarkerSymbol);
The glyph is now created and you can use it to draw the marker on the map.
Drawing the marker element
Before drawing the element, set the dynamic symbol properties. This includes setting the heading, alignment, color, scale, and the glyph.
  1. Set the heading of the dynamic symbol. See the following:
dynamicSymbolProps.setHeading(esriDynamicSymbolType.esriDSymbolMarker, (float)
  1. Set the rotation alignment of the dynamic symbol. The symbol's rotation can be aligned in three positions: with the actual orientation of the element (set by the heading), with the window, or with the north direction (the element will always face north). See the following:
//Set the symbol's alignment so that it will align with the symbol's heading.

  1. Scale the symbol. Scaling refers to the scale relative to the original size of the active symbol. When scaling, you can use different scaling for x- and y-axis. See the following:
dynamicSymbolProps.setScale(esriDynamicSymbolType.esriDSymbolMarker, 1.1f, 1.1f);
  1. Assign color to the symbol. See the following:
dynamicSymbolProps.setColor(esriDynamicSymbolType.esriDSymbolMarker, 0.0f, 1.0f,
    0.6f, 1.0f); // GREEN
  1. Set the dynamic glyph. See the following:
  1. Draw the marker symbol. You need a point geometry to specify where the marker will be drawn. See the following:

See Also:

Dynamic Drawing APIs
Sample :Dynamic Layer WalkThrough
How to draw a bitmap element using OpenGL

Development licensingDeployment licensing
Engine Developer KitEngine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced