コード例 #1
0
        public SdeFeatureClassExplorerObject(SdeExplorerObject parent, IDatasetElement element)
            : base(parent, typeof(IFeatureClass))
        {
            if (element == null)
            {
                return;
            }

            _fcname = element.Title;
            _parent = parent;

            if (element.Class is IFeatureClass)
            {
                _fc = (IFeatureClass)element.Class;
                switch (_fc.GeometryType)
                {
                case geometryType.Envelope:
                case geometryType.Polygon:
                    _icon = new SdePolygonIcon();
                    _type = "Polygon Featureclass";
                    break;

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

                case geometryType.Polyline:
                    _icon = new SdeLineIcon();
                    _type = "Polyline Featureclass";
                    break;
                }
            }
        }
コード例 #2
0
        public 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);

            SdeExplorerObject sdeObject = new SdeExplorerObject();

            sdeObject = sdeObject.CreateInstanceByFullName(dsName, cache) as SdeExplorerObject;
            if (sdeObject == null || sdeObject.ChildObjects == null)
            {
                return(null);
            }

            foreach (IExplorerObject exObject in sdeObject.ChildObjects)
            {
                if (exObject.Name == fcName)
                {
                    cache.Append(exObject);
                    return(exObject);
                }
            }
            return(null);
        }