Discover renderer line symbol type

377
3
Jump to solution
04-25-2014 11:16 AM
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?
Reply
0 Kudos
1 Solution

Accepted Solutions
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

Reply
0 Kudos
3 Replies
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.
Reply
0 Kudos
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

Reply
0 Kudos
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.
Reply
0 Kudos