protected override void OnClick() { //Get the snap environment UID snapUID = new UID(); snapUID.Value = "{E07B4C52-C894-4558-B8D4-D4050018D1DA}"; m_SnappingEnv = ArcMap.Application. FindExtensionByCLSID(snapUID) as ISnappingEnvironment; m_Snapper = m_SnappingEnv.PointSnapper; ISet excludedLayerSet = new SetClass(); m_Snapper.ExcludedLayers(ref excludedLayerSet); //loop through all layers in the map IMap map = ArcMap.Document.FocusMap; for (int i = 0; i < map.LayerCount; i++) { //is this a basemap layer? IBasemapLayer basemapLayer = map.get_Layer(i) as IBasemapLayer; if (basemapLayer != null) { ICompositeLayer basemapComposite = basemapLayer as ICompositeLayer; for (int j = 0; j < basemapComposite.Count; j++) { //get the real layer from the basemap/composite IBasemapSubLayer basemapSubLayer = basemapComposite.get_Layer(j) as IBasemapSubLayer; ILayer innerLayer = basemapSubLayer.Layer; excludedLayerSet.Add(innerLayer); } } m_Snapper.ClearCache(); } }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.