|
|
| GeoCommunity Mailing List |
| |
| Mailing List Archives |
| Subject: | [gislist] looping through layers... |
| Date: |
07/30/2007 03:17:34 PM |
| From: |
Jared Allen |
|
|
I want to find and group layers within my TOC. This is the code which I've written, but it is not entering the for loop...
I call this code by passing in the two variables noted: one being the group layer name and the second being the layer which will be added to the group layer. I've commented this out and shown a message box which is indicating that my pCompLayer count is 0, which is why the loop is skipping. However, I verify that the group layers do get added to the map and exist previous to this call.
Any comments and/or suggestions?
public void GroupTheLayers(string strGrpLayer, string strLayerName)
{
pMxDoc = (IMxDocument)m_app.Document:
pMap = pMxDoc.FocusMap:
ILayer pCLayer:
ILayer pLayer:
IFeatureLayer pFLayer:
IGroupLayer pGrpLayer:
ICompositeLayer pCompLayer:
int i:
IEnumLayer pLayers = pMap.get_Layers(null, true):
pLayer = pLayers.Next():
do
{
//Type t = pLayer.GetType():
//if (t is ICompositeLayer)
if (pLayer is ICompositeLayer)
{
if (pLayer.Name == strGrpLayer)
{
pGrpLayer = (IGroupLayer) pLayer:
//pGrpLayer.Expanded = true:
pCompLayer = (ICompositeLayer) pLayer:
BREAKS HERE - DOES NOT ENTER FOR LOOP>>>
for (i = 0: i <= pCompLayer.Count - 1: i++)
{
pCLayer = pCompLayer.get_Layer(i):
pFLayer = (IFeatureLayer)pCLayer:
if (pFLayer.Name == strLayerName)
{
Layer2Top((ICompositeLayer)pLayer, i):
}
}
}
}
pLayer = pLayers.Next():
} while (pLayer != null):
}
Jared Allen
_______________________________________________ gislist mailing list gislist@lists.geocomm.com http://lists.geocomm.com/mailman/listinfo/gislist
_________________________________ This list is brought to you by The GeoCommunity http://www.geocomm.com/
|
|

Sponsored by:

For information regarding advertising rates Click Here!
|