Example #1
0
 /// <summary>
 /// This event is called, when the ArcMap tool is activated.
 /// </summary>
 protected override void OnActivate()
 {
     try
     {
         _pickLayers = ArcmapLayerUtils.EnumerateLayers(ArcmapUtils.GetFocusMap(), false).ToList();
     }
     catch (Exception)
     {
         // Don't let the exeption escape to arcgis.
     }
 }
Example #2
0
        private List <LayerInfoViewModel> LoadLayerInfosFromArcMap()
        {
            List <LayerInfoViewModel> result = new List <LayerInfoViewModel>();

            var layers = ArcmapLayerUtils.EnumerateLayers(ArcmapUtils.GetFocusMap(), false);

            foreach (IFeatureLayer layer in layers)
            {
                LayerInfoViewModel layerInfo = LoadLayerInfoFromArcMap(layer);
                result.Add(layerInfo);
            }
            return(result);
        }
Example #3
0
        /// <summary>
        /// Expands the table of contents in ArcMap to the matching layer and selects it.
        /// </summary>
        private void SelectFeature()
        {
            IFeatureSelection featureSelection;
            IMap map = ArcmapUtils.GetFocusMap();

            foreach (IFeatureLayer featureLayer in ArcmapLayerUtils.EnumerateLayers(map, false))
            {
                featureSelection = featureLayer as IFeatureSelection;
                featureSelection?.Clear();
            }

            featureSelection = _layer as IFeatureSelection;
            featureSelection?.Add(_feature);

            ArcmapUtils.InvalidateMap(map);
        }