public MsSql2008SpatialFeatureClassExplorerObject(MsSql2008SpatialExplorerObject parent, IDatasetElement element) : base(parent, typeof(IFeatureClass)) { if (element == null || !(element.Class is IFeatureClass)) { return; } _parent = parent; _fcname = element.Title; if (element.Class is IFeatureClass) { _fc = (IFeatureClass)element.Class; switch (_fc.GeometryType) { case geometryType.Envelope: case geometryType.Polygon: _icon = new MsSql2008SpatialPolygonIcon(); _type = "Polygon Featureclass"; break; case geometryType.Multipoint: case geometryType.Point: _icon = new MsSql2008SpatialPointIcon(); _type = "Point Featureclass"; break; case geometryType.Polyline: _icon = new MsSql2008SpatialLineIcon(); _type = "Polyline Featureclass"; break; default: _icon = new MsSql2008SpatialLineIcon(); _type = "Featureclass"; break; } } }
async public Task <IExplorerObject> CreateInstanceByFullName(string FullName, ISerializableExplorerObjectCache cache) { if (cache.Contains(FullName)) { return(cache[FullName]); } FullName = FullName.Replace("/", @"\"); int lastIndex = FullName.LastIndexOf(@"\"); if (lastIndex == -1) { return(null); } string dsName = FullName.Substring(0, lastIndex); string fcName = FullName.Substring(lastIndex + 1, FullName.Length - lastIndex - 1); MsSql2008SpatialExplorerObject dsObject = new MsSql2008SpatialExplorerObject(); dsObject = await dsObject.CreateInstanceByFullName(dsName, cache) as MsSql2008SpatialExplorerObject; if (dsObject == null || await dsObject.ChildObjects() == null) { return(null); } foreach (IExplorerObject exObject in await dsObject.ChildObjects()) { if (exObject.Name == fcName) { cache.Append(exObject); return(exObject); } } return(null); }