public OgrLayerExplorerObject(OgrDatasetExplorerObject parent, IDatasetElement element)
            : base(parent, typeof(FeatureClass))
        {
            if (element == null)
            {
                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 AccessFDBPolygonIcon();
                    _type = "Polygon Featureclass";
                    break;

                case geometryType.Multipoint:
                case geometryType.Point:
                    _icon = new AccessFDBPointIcon();
                    _type = "Point Featureclass";
                    break;

                case geometryType.Polyline:
                    _icon = new AccessFDBLineIcon();
                    _type = "Polyline Featureclass";
                    break;

                default:
                    _icon = new AccessFDBLineIcon();
                    _type = "Featureclass";
                    break;
                }
            }
        }
Exemple #2
0
        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[] parts = FullName.Split('\\');
            if (parts.Length != 3)
            {
                return(null);
            }

            OgrDatasetExplorerObject parent = new OgrDatasetExplorerObject();

            parent = await parent.CreateInstanceByFullName(parts[0] + @"\" + parts[1], cache) as OgrDatasetExplorerObject;

            if (parent == null)
            {
                return(null);
            }

            foreach (IExplorerObject exObject in await parent.ChildObjects())
            {
                if (exObject.Name == parts[2])
                {
                    cache.Append(exObject);
                    return(exObject);
                }
            }
            return(null);
        }