Ejemplo n.º 1
0
        public GeoJsonServiceFeatureClassExplorerObject(GeoJsonServiceExplorerObject 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 GeoJsonServicePolygonIcon();
                    _type = "Polygon Featureclass";
                    break;

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

                case geometryType.Polyline:
                    _icon = new GeoJsonServiceLineIcon();
                    _type = "Polyline Featureclass";
                    break;
                }
            }
        }
Ejemplo n.º 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);

            GeoJsonServiceExplorerObject dsObject = new GeoJsonServiceExplorerObject();

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

            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);
        }