public PickableFeatureClassItem(FeatureClass featureClass, esriGeometryType geometryType, List <FeatureLayer> belongingFeatureLayers) { _itemText = featureClass.GetName(); _geometry = null; _itemImageUri = GetImagePath(geometryType); BelongingFeatureLayers = belongingFeatureLayers; }
private void OutputDefinition(Geodatabase geodatabase, TopologyDefinition topologyDefinition) { Console.WriteLine($"Topology cluster tolerance => {topologyDefinition.GetClusterTolerance()}"); Console.WriteLine($"Topology Z cluster tolerance => {topologyDefinition.GetZClusterTolerance()}"); IReadOnlyList <string> featureClassNames = topologyDefinition.GetFeatureClassNames(); Console.WriteLine($"There are {featureClassNames.Count} feature classes that are participating in the topology:"); foreach (string name in featureClassNames) { // Open each feature class that participates in the topology. using (FeatureClass featureClass = geodatabase.OpenDataset <FeatureClass>(name)) using (FeatureClassDefinition featureClassDefinition = featureClass.GetDefinition()) { Console.WriteLine($"\t{featureClass.GetName()} ({featureClassDefinition.GetShapeType()})"); } } }
private static bool IgnoreLayer(Layer layer, IEnumerable <string> ignoredClasses) { FeatureClass featureClass = (layer as FeatureLayer)?.GetTable() as FeatureClass; if (featureClass == null) { return(true); } string className = featureClass.GetName(); foreach (string ignoredClass in ignoredClasses) { if (className.EndsWith(ignoredClass, StringComparison.InvariantCultureIgnoreCase)) { return(true); } } return(false); }
public static List <FeatureClassInfo> GetSelectableFeatureclassInfos() { IEnumerable <FeatureLayer> featureLayers = MapView.Active.Map.GetLayersAsFlattenedList() .OfType <FeatureLayer>().Where(layer => layer.IsVisible); IEnumerable <IGrouping <string, FeatureLayer> > layerGroupsByFcName = featureLayers.GroupBy(layer => layer.GetFeatureClass().GetName()); var featureClassInfos = new List <FeatureClassInfo>(); foreach (IGrouping <string, FeatureLayer> group in layerGroupsByFcName) { var belongingLayers = new List <FeatureLayer>(); foreach (FeatureLayer layer in group) { belongingLayers.Add(layer); } FeatureClass fClass = belongingLayers.First().GetFeatureClass(); string featureClassName = fClass.GetName(); esriGeometryType gType = belongingLayers.First().ShapeType; var featureClassInfo = new FeatureClassInfo() { BelongingLayers = belongingLayers, FeatureClass = fClass, FeatureClassName = featureClassName, ShapeType = gType }; featureClassInfos.Add(featureClassInfo); } featureClassInfos.OrderBy(info => info.ShapeType); return(featureClassInfos); }
private string GetDisplayField(FeatureClass featureClass) { string displayField = ""; Map map = MapView.Active.Map; if (map == null) return displayField; //Get flattened layers from Map. If the feature class exists in the map, get that feature Layer and its display field. If not, return null. var layer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(lyr => lyr.GetFeatureClass().GetName() == featureClass.GetName()); if (layer == null) return ""; CIMFeatureLayer currentCIMFeatureLayer = layer.GetDefinition() as CIMFeatureLayer; CIMFeatureTable cimFeatureTable = currentCIMFeatureLayer.FeatureTable; displayField = cimFeatureTable.DisplayField; return displayField; }
private string GetDisplayField(FeatureClass featureClass) { string displayField = ""; Map map = MapView.Active.Map; if (map == null) { return(displayField); } //Get flattened layers from Map. If the feature class exists in the map, get that feature Layer and its display field. If not, return null. var layer = map.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(lyr => lyr.GetFeatureClass().GetName() == featureClass.GetName()); if (layer == null) { return(""); } CIMFeatureLayer currentCIMFeatureLayer = layer.GetDefinition() as CIMFeatureLayer; CIMFeatureTable cimFeatureTable = currentCIMFeatureLayer.FeatureTable; displayField = cimFeatureTable.DisplayField; return(displayField); }