How to change feature weights for standard graphics layer programmatically??

795
3
Jump to solution
07-19-2013 08:06 AM
johannesuhl
New Contributor
Hey all,

I wrote some ArcObjects code (ArcGIS 9.2, VB.NET) which creates some graphic elements programmatically and then exports the map. some labels that overlap with the graphic features are not displayed. the "manual" solution is to open the Labeling toolbar, click on "Label Weight Ranking" and set the feature weight of the standard layer to "none". I would like to change the feature weights programmatically.
Does anybody know which interfaces I can use in order to access the feature weights of the standard layer??

Thank you in advance for you help!

Regards,
Johannes
0 Kudos
1 Solution

Accepted Solutions
LeoDonahue
Occasional Contributor III
Dude!  Go for it! Don't look back.

if that doesn't pan out.. what if you tried creating a GraphicsSubLayer and add your graphic element to that. Then you could maybe use setWeight, or sendToBack or sendBackward?  Worth a shot..

com.esri.arcgis.carto.GraphicsSubLayer

View solution in original post

0 Kudos
3 Replies
johannesuhl
New Contributor
I found a workaround for my problem:

1) Quit GIS business.
2) Become a rock star.
0 Kudos
LeoDonahue
Occasional Contributor III
Dude!  Go for it! Don't look back.

if that doesn't pan out.. what if you tried creating a GraphicsSubLayer and add your graphic element to that. Then you could maybe use setWeight, or sendToBack or sendBackward?  Worth a shot..

com.esri.arcgis.carto.GraphicsSubLayer
0 Kudos
johannesuhl
New Contributor
Thanks a lot for your help! It worked. I created a new graphics layer for which I set the weight to zero using IBarrierProperties. I cast the IGraphicsContainer object to the graphicsLayer and add the graphic element to the container.

Since the feature weight is 0, labels that are within the graphic element bounding box are displayed now!

Best,

Johannes

Here comes the code:


        Dim pMap As IMap = pMxDoc.FocusMap
        Dim graphicsLayer As IGraphicsLayer = New CompositeGraphicsLayerClass()
        CType(graphicsLayer, ILayer).Name = "TESTLAYER"
        pMap.ActiveGraphicsLayer = CType(graphicsLayer, ILayer)
        pMap.AddLayer(CType(graphicsLayer, ILayer))

        Dim pBarrierProperties As IBarrierProperties
        pBarrierProperties = graphicsLayer
        pBarrierProperties.Weight = 0

        Dim pGContainer As IGraphicsContainer
        pGContainer = pMxDoc.FocusMap

        pGContainer = graphicsLayer
        pGContainer.AddElement(pGraphicElement1, 0)

        pMxDoc.ActiveView.Refresh()
0 Kudos