Discover renderer line symbol type

745
3
Jump to solution
04-25-2014 11:16 AM
MartinLewis
New Contributor III
I'm trying to figure out how to discover if the symbol class from a simple renderer is CartographicLineSymbol in vb.NET

According to the documentation ISimpleRenderer.Symbol returns ISymbol.

According to the documentation ISymbol implements several line symbol classes (CartographicLineSymbol, HashLineSymbol, etc.)

I set layer's symbol "Type" to "Cartographic Line Symbol" in the properties and yet this code is not working:

                Dim rendLinks As ISimpleRenderer = geoLyrLinks.Renderer
                Dim aSymbol As ISymbol = rendLinks.Symbol
                If TypeOf aSymbol Is ICartographicLineSymbol Then
                    MessageBox.Show("i'm a cartographiclinesymbol")
                Else
                    MessageBox.Show("NOT a cartographiclinesymbol")
                End If

Can someone tell me what I'm doing wrong?  Or can someone tell me how to simply retrieve the symbol class from a simple renderer?
0 Kudos
1 Solution

Accepted Solutions
NeilClemmons
Regular Contributor III
It's probably a IMultiLayerLineSymbol if you set it through the UI.  If it is, you'll need to loop through the layers in the symbol to find the one you're looking for.

View solution in original post

0 Kudos
3 Replies
MartinLewis
New Contributor III
In the code above:

Dim aSymbol as ISymbol = rendLinks.Symbol

seems to return aSymbol as type ILineSymbol, regardless of what symbol class is defined in the renderer.
0 Kudos
NeilClemmons
Regular Contributor III
It's probably a IMultiLayerLineSymbol if you set it through the UI.  If it is, you'll need to loop through the layers in the symbol to find the one you're looking for.
0 Kudos
MartinLewis
New Contributor III
Thank you so much.  I just happened to stumble on a similar thread that was pointing me in this direction, but your tip got me there faster.

I just tested this - it seems that when changing the line symbol through ArcMap (Symbol Selector>Edit Symbol>Symbol Property Editor) and selecting Cartographic Line Symbol the new symbol is a IMultiLayerLineSymbol.

Now I just need to figure out how to loop thru the layers.
0 Kudos