Пример #1
0
        public PostGISFeatureClassExplorerObject(MongoDbExplorerObject parent, IDatasetElement element)
            : base(parent, typeof(IFeatureClass), 1)
        {
            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 MongoDbPolygonIcon();
                    _type = "Polygon Featureclass";
                    break;

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

                case geometryType.Polyline:
                    _icon = new MongoDbLineIcon();
                    _type = "Polyline Featureclass";
                    break;
                }
            }
        }
Пример #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 dsName = FullName.Substring(0, lastIndex);
            string fcName = FullName.Substring(lastIndex + 1, FullName.Length - lastIndex - 1);

            MongoDbExplorerObject dsObject = new MongoDbExplorerObject();

            dsObject = await dsObject.CreateInstanceByFullName(dsName, cache) as MongoDbExplorerObject;

            var childObjects = await dsObject?.ChildObjects();

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

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