public async Task <bool> AddFeatureClassToActiveView(string featureClassName) { if (string.IsNullOrEmpty(featureClassName) || string.IsNullOrEmpty(DatabaseName)) { return(await Task.FromResult <bool>(false)); } bool layerAdded = false; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { string uri = $@"{DatabaseName}\{ProSymbolUtilities.GetDatasetName()}\{featureClassName}"; Item currentItem = ItemFactory.Instance.Create(uri); if (LayerFactory.Instance.CanCreateLayerFrom(currentItem)) { FeatureLayer fl = LayerFactory.Instance.CreateLayer(currentItem, MapView.Active.Map) as FeatureLayer; if (fl != null) { ArcGIS.Core.CIM.CIMDictionaryRenderer dictionaryRenderer = ProSymbolUtilities.CreateDictionaryRenderer(); fl.SetRenderer(dictionaryRenderer); layerAdded = true; } } }); return(await Task.FromResult <bool>(layerAdded)); }
public async Task <bool> GDBContainsMilitaryOverlay(GDBProjectItem gdbProjectItem, ProSymbolUtilities.SupportedStandardsType standard) { if (gdbProjectItem == null) { return(false); } string militaryOverlayFeatureDatasetName = ProSymbolUtilities.GetDatasetName(standard); bool gdbContainsMilitaryOverlay = await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run <bool>(() => { using (Datastore datastore = gdbProjectItem.GetDatastore()) { // Unsupported datastores (non File GDB and non Enterprise GDB) will be of type UnknownDatastore if (datastore is UnknownDatastore) { return(false); } Geodatabase geodatabase = datastore as Geodatabase; if (geodatabase == null) { return(false); } var defs = geodatabase.GetDefinitions <FeatureDatasetDefinition>().Where(fd => fd.GetName().Contains(militaryOverlayFeatureDatasetName)).ToList();; return(defs.Count > 0); } }); return(gdbContainsMilitaryOverlay); }
public string GetDatasetName() { return(EGDBPrefixName + ProSymbolUtilities.GetDatasetName(ProSymbolUtilities.Standard)); }