示例#1
0
        private void LoadDatasetAndFetclass()
        {
            InstanceIdentify id = _tag as InstanceIdentify;

            try
            {
                string url = _parent.Tag.ToString();
                Dictionary <string, string> args = new Dictionary <string, string>();
                args.Add(HttpCommands.cstArgNameCommand, HttpCommands.cstArgCmdGetCatalogList);
                args.Add(HttpCommands.cstArgInstanceId, id.Id.ToString());
                url = url + HttpCommands.GetCatalogUrl(HttpCommands.cstCatalogPage, args);
                object[] objs = GetObjectFromHttpStream.GetObject(url) as object[];
                if (objs != null && objs.Length > 0)
                {
                    FetDatasetIdentify[] dsIds   = objs[0] as FetDatasetIdentify[];
                    FetClassIdentify[]   fetcIds = objs[1] as FetClassIdentify[];
                    //
                    if (dsIds != null && dsIds.Length > 0)
                    {
                        foreach (FetDatasetIdentify did in dsIds)
                        {
                            ICatalogItem cit = new CatalogNetFeatureDataset(did.Name, did.Id, did.Description);
                            AddChild(cit);
                            //
                            if (did.FetClassIds != null && did.FetClassIds.Length > 0)
                            {
                                foreach (FetClassIdentify fetcId in did.FetClassIds)
                                {
                                    ICatalogItem fcit = new CatalogNetFeatureClass(fetcId.Name, fetcId, fetcId.Description);
                                    cit.AddChild(fcit);
                                }
                            }
                        }
                    }
                    //
                    if (fetcIds != null && fetcIds.Length > 0)
                    {
                        foreach (FetClassIdentify fetcId in fetcIds)
                        {
                            ICatalogItem fcit = new CatalogNetFeatureClass(fetcId.Name, fetcId, fetcId.Description);
                            AddChild(fcit);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowError(ex.Message);
            }
        }
示例#2
0
        private static FeatureDataSourceBase GetDataSource(CatalogNetFeatureClass catalogNetFeatureClass)
        {
            string           uri        = null;
            InstanceIdentify instanceId = null;

            if (catalogNetFeatureClass.Parent is CatalogNetFeatureDataset)
            {
                instanceId = catalogNetFeatureClass.Parent.Parent.Tag as InstanceIdentify;
                uri        = catalogNetFeatureClass.Parent.Parent.Parent.Tag.ToString();//CatalogNetServer
                //                                        CatalogNetFeatureDataset.CatalogNetInstance.CatalogNetServer
            }
            else
            {
                instanceId = catalogNetFeatureClass.Parent.Tag as InstanceIdentify;
                uri        = catalogNetFeatureClass.Parent.Parent.Tag.ToString();//CatalogNetServer
                //                                         CatalogNetFeatureClass.CatalogInstance.CatalogNetServer
            }
            FetClassIdentify fetclassId = catalogNetFeatureClass.Tag as FetClassIdentify;

            return(new ServerDataSource(catalogNetFeatureClass.Name, uri, instanceId, fetclassId));
        }