AnsweredAssumed Answered

IFeatureLayer count for a complex group layer? Similar to IMap.Layers property

Question asked by deleted-user-VeC5jUIlNXtq on Oct 8, 2013
Latest reply on Oct 9, 2013 by deleted-user-VeC5jUIlNXtq
Hello,

This might be a lost cause, but worth a shot...

I'm curious about a potential functionality exactly like IMap.Layers, but instead of IMap, I want ICompositeLayer (or any reference to a group layer really).

I'm looking for the most elegant solution to getting a count of all IFeatureLayer layers, but only within a relatively complex group layer, not the entire map.

In my head, I would call ICompositeLayer.Layers(<insert IFeatureLayer UID here>, True), if it existed. But it doesn't, and I'm not sure if anything like it does.

Currently, the code I'm working with calls a function "GetNumLayers" which has a series of nested loops checking if a particular ILayer, is of type IFeatureLayer or not and adding +1 to the counter, and then returning the total. I'm convinced something faster exists as an alternative.

I think it would be a good learning experience, and to be honest, I'm really not worried about the time it takes, rather the "best" way to achieve this.

Any assistance would be much appreciated!

Outcomes