Proceed to GeoCommunity Home Page


SpatialNewsGIS Data DepotGeoImaging ChannelGIS and MappingSoftwareGIS JobsGeoBids-RFPsGeoCommunity MarketplaceGIS Event Listings
HomeLoginAccountsAboutContactAdvertiseSearchFAQsForumsCartFree Newsletter

Sponsored by:


TOPICS
Today's News

Submit News

Feature Articles

Product Reviews

Education

News Affiliates

Discussions

Newsletters

Email Lists

Polls

Editor's Corner


SpatialNews Daily Newswire!
Subscribe now!

Latest Industry Headlines
SiteVision GIS Partnership With City of Roanoke VA Goes Live
Garmin® Introduces Delta™ Upland Remote Trainer with Beeper
Caliper Offers Updated Chile Data for Use with Maptitude 2013
Southampton’s Go! Rhinos Trail Mapped by Ordnance Survey
New Approach to Measuring Coral Growth Offers Valuable Tool for Reef Managers
Topo ly - Tailor-Fit for Companies' Online Mapping Needs

Latest GeoBids-RFPs
Nautical Charts*Poland
Software & Telemetry GPS
Spatial Data Management-DC
Geospatial and Mapping-DC
Next-Gen 911-MO

Recent Job Opportunities
Planner/GIS Specialist
Team Leader- Grape Supply Systems
Geospatial Developer

Recent Discussions
Raster images
cartographic symbology
Telephone Exchange areas in Europe
Problem showcasing Vector map on Windows CE device
Base map

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!

Copyright© 1995-2012 MindSites Group / Privacy Policy

GeoCommunity™, Wireless Developer Network™, GIS Data Depot®, and Spatial News™
including all logos and other service marks
are registered trademarks and trade communities of
MindSites Group