English

Bug: Force Element Labels do scale correctly with symbols when added to a map

Description

Force Element Labels do not scale correctly when added to a map. When zooming in and out, the MOLE symbols scales correctly, but the label size may grow and shrink disproportionally to the symbol.

Cause

There is a problem with the way the fonts are built on loading the Force Element Layer. This issue is related to NIM037810 and NIM038484.

Workaround

To fix the issue, toggle the font property of the Force Elements.

  • This can be done through ArcMap:

    1. Right-click on the Force Element Layer.
    2. Select Properties.
    3. Click on the 'Symbols' Tab.
    4. Click 'OK'.
    This rebuilds the font property, and the labels will scale correctly.
  • When working with Force Elements programmatically, the VBA code below demonstrates how to accomplish the same task as above.

    Code:
    Sub TestFELayerRefresh()

    ' ----------------------------------------------------------------------------------
    ' IMPORTANT: Must add reference to ESRI.DefenseSolutions (Tools | References)
    ' ----------------------------------------------------------------------------------
    Dim theDoc As IMxDocument
    Dim theGroupLayer As IGroupLayer

    Dim theLayer As ILayer

    ' Loop through all MOLE Force Element Group Layers
    Set theDoc = ThisDocument

    Dim layercount As Integer
    layercount = theDoc.FocusMap.layercount - 1

    Dim i As Integer
    For i = 0 To layercount

    Set theGroupLayer = theDoc.FocusMap.Layer(i)

    ' Is this a group/composite layer?
    Dim cl As ICompositeLayer

    If (TypeOf theGroupLayer Is ICompositeLayer) Then

    Set cl = theGroupLayer

    ' Get MOLE Force Element Layer from the Group (2nd layer, 0-indexed)
    Set theLayer = cl.Layer(1)

    If (TypeOf theLayer Is IForceElementLayer) Then

    Dim feLayer As IForceElementLayer
    Set feLayer = theLayer

    Dim fegsc As IFEGraphicStyleCollection
    Set fegsc = feLayer

    Dim fegs As IFEGraphicStyle
    Set fegs = fegsc.FEGraphicStyle(0)
    '
    ' WORKAROUND: Toggle Font property to get labels to rebuild
    '
    fegs.UseFonts = False
    fegs.UseFonts = True

    fegsc.Current = 0

    ' Refresh Layer to rebuild all
    Dim cglLayer As ICachedGraphicLayer
    Set cglLayer = theLayer

    cglLayer.Refresh

    End If

    End If

    Next

    ' redraw map
    theDoc.ActiveView.PartialRefresh esriViewDrawPhase.esriViewGeography, Nothing, Nothing

    End Sub