public bool InitPipeLib(IDataSource ds) { if (ds == null) { return(false); } IFeatureDataSet dataset = null; IObjectClass oc = null; IFieldInfoCollection fields = null; string[] arrDBIndex = null; try { //IDomainFactory o = null; //ICodedValueDomain domain = null; //string[] array = null; //o = new DomainFactoryClass(); //CRSFactoryClass crsFactory = new CRSFactoryClass(); //array = ds.GetDomainNames(); //if ((array == null) || (Array.IndexOf<string>(array, "Domain_GroupInfo") == -1)) //{ // domain = o.CreateCodedValueDomain("Domain_GroupInfo", gviFieldType.gviFieldInt32); // domain.Description = "逻辑图层分组"; // ds.AddDomain(domain); //} //Marshal.ReleaseComObject(o); CRSFactoryClass crsFactory = new CRSFactoryClass(); string wKT = "UNKNOWNCS[\"unnamed\"]"; ISpatialCRS spatialCRS = crsFactory.CreateFromWKT(wKT) as ISpatialCRS; if (spatialCRS != null) { if (DataProvider.Instance.TryCeateFeatureDataSet(ds, "DataSet_BIZ", spatialCRS, out dataset) == -1) { return(false); } dataset.Alias = "业务数据集"; Marshal.ReleaseComObject(dataset); if (DataProvider.Instance.TryCeateFeatureDataSet(ds, "DataSet_GEO_Actuality", spatialCRS, out dataset) == -1) { return(false); } dataset.Alias = "现状空间数据集"; Marshal.ReleaseComObject(dataset); if (!DataProvider.Instance.TryOpenFeatureDataSet(ds, "DataSet_BIZ".ToString(), out dataset)) { return(false); } fields = DataModel.GetDataModel("OC_FacilityClass", out arrDBIndex); if (fields != null) { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_FacilityClass", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "设施类注册表"; Marshal.ReleaseComObject(oc); return(true); } } } return(false); } catch (Exception exception4) { return(false); } }
public bool InitTemplateLib(IDataSource ds) { IFeatureDataSet dataset = null; IObjectClass oc = null; IFieldInfoCollection fields = null; string[] arrDBIndex = null; ICRSFactory o = null; ISpatialCRS spatialCRS = null; bool flag; string wKT = "UNKNOWNCS[\"unnamed\"]"; if (ds == null) { return(false); } try { o = new CRSFactoryClass(); spatialCRS = o.CreateFromWKT(wKT) as ISpatialCRS; if (spatialCRS != null) { if (DataProvider.Instance.TryCeateFeatureDataSet(ds, "DataSet_BIZ", spatialCRS, out dataset) == -1) { return(false); } Marshal.ReleaseComObject(dataset); if (!DataProvider.Instance.TryOpenFeatureDataSet(ds, "DataSet_BIZ", out dataset)) { return(false); } fields = DataModel.GetDataModel("OC_Catalog", out arrDBIndex); if (fields != null) { try { try { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_Catalog", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "设施类分类表"; Marshal.ReleaseComObject(oc); break; } } catch (Exception exception) { return(false); } goto Label_012C; } finally { Marshal.ReleaseComObject(fields); fields = null; } } } return(false); Label_012C: fields = DataModel.GetDataModel("OC_FieldConfig", out arrDBIndex); if (fields != null) { try { try { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_FieldConfig", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "设施类字段配置表"; Marshal.ReleaseComObject(oc); break; } } catch (Exception exception2) { return(false); } goto Label_01BE; } finally { Marshal.ReleaseComObject(fields); fields = null; } } return(false); Label_01BE: fields = DataModel.GetDataModel("OC_TopoManage", out arrDBIndex); if (fields != null) { try { try { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_TopoManage", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "拓扑管理表"; Marshal.ReleaseComObject(oc); break; } } catch (Exception exception3) { return(false); } goto Label_0250; } finally { Marshal.ReleaseComObject(fields); fields = null; } } return(false); Label_0250: fields = DataModel.GetDataModel("OC_FacilityStyle", out arrDBIndex); if (fields != null) { try { try { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_FacilityStyle", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "设施风格管理表"; Marshal.ReleaseComObject(oc); break; } } catch (Exception exception4) { return(false); } goto Label_02E2; } finally { Marshal.ReleaseComObject(fields); fields = null; } } return(false); Label_02E2: fields = DataModel.GetDataModel("OC_ModelInfo", out arrDBIndex); if (fields != null) { try { try { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_ModelInfo", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "模型管理表"; Marshal.ReleaseComObject(oc); break; } } catch (Exception exception5) { return(false); } goto Label_0374; } finally { Marshal.ReleaseComObject(fields); fields = null; } } return(false); Label_0374: fields = DataModel.GetDataModel("OC_ColorInfo", out arrDBIndex); if (fields != null) { try { try { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_ColorInfo", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "颜色管理表"; Marshal.ReleaseComObject(oc); break; } } catch (Exception exception6) { return(false); } goto Label_0406; } finally { Marshal.ReleaseComObject(fields); fields = null; } } return(false); Label_0406: fields = DataModel.GetDataModel("OC_TextureInfo", out arrDBIndex); if (fields != null) { try { try { switch (DataProvider.Instance.TryCeateObjectClass(dataset, "OC_TextureInfo", fields, arrDBIndex, out oc)) { case -1: return(false); case 1: oc.AliasName = "材质管理表"; Marshal.ReleaseComObject(oc); break; } } catch (Exception exception7) { return(false); } goto Label_0524; } finally { Marshal.ReleaseComObject(fields); fields = null; } } return(false); Label_0524: flag = true; } catch (Exception exception9) { flag = false; } finally { if (o != null) { Marshal.ReleaseComObject(o); o = null; } } return(flag); }
private bool InitTempLib(IDataSource ds) { if (ds == null) { return(false); } IFieldInfoCollection fields = null; IFieldInfo newVal = null; ISpatialCRS spatialCRS = null; ITable o = null; IFeatureDataSet set = null; try { fields = new FieldInfoCollectionClass(); newVal = new FieldInfoClass { Name = "ID", Alias = "编号", FieldType = gviFieldType.gviFieldFID }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "LayerName", Alias = "图层名称", FieldType = gviFieldType.gviFieldString, Length = 50 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "DataSetName", Alias = "数据集名称", FieldType = gviFieldType.gviFieldString, Length = 100 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "FCName", Alias = "要素类名称", FieldType = gviFieldType.gviFieldString, Length = 100 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "FCGuid", Alias = "要素类GUID", FieldType = gviFieldType.gviFieldString, Length = 100 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "GeoType", Alias = "空间列几何类型", FieldType = gviFieldType.gviFieldString, Length = 50 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "RenderStyle", Alias = "图层渲染样式", FieldType = gviFieldType.gviFieldBlob }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "SourceFile", Alias = "数据来源", FieldType = gviFieldType.gviFieldString, Length = 150 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "GroupId", Alias = "逻辑组ID", FieldType = gviFieldType.gviFieldInt32 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "SourceType", Alias = "数据来源类型", FieldType = gviFieldType.gviFieldString, Length = 50 }; fields.Add(newVal); newVal = new FieldInfoClass { Name = "CreateDate", Alias = "创建日期", FieldType = gviFieldType.gviFieldDate }; fields.Add(newVal); o = ds.CreateTable("Tb_TemporaryMgr", "ID", fields); if (o != null) { IDbIndexInfo index = null; index = new DbIndexInfoClass { Name = string.Format("{0}_{1}", "Tb_TemporaryMgr", "LayerName") }; index.AppendFieldDefine("LayerName", false); o.AddDbIndex(index); index = new DbIndexInfoClass { Name = string.Format("{0}_{1}", "Tb_TemporaryMgr", "DatasetName") }; index.AppendFieldDefine("DatasetName", false); o.AddDbIndex(index); index = new DbIndexInfoClass { Name = string.Format("{0}_{1}", "Tb_TemporaryMgr", "FCName") }; index.AppendFieldDefine("FCName", false); o.AddDbIndex(index); index = new DbIndexInfoClass { Name = string.Format("{0}_{1}", "Tb_TemporaryMgr", "FCGuid") }; index.AppendFieldDefine("FCGuid", false); o.AddDbIndex(index); index = new DbIndexInfoClass { Name = string.Format("{0}_{1}", "Tb_TemporaryMgr", "GeoType") }; index.AppendFieldDefine("GeoType", false); o.AddDbIndex(index); index = new DbIndexInfoClass { Name = string.Format("{0}_{1}", "Tb_TemporaryMgr", "GroupId") }; index.AppendFieldDefine("GroupId", false); o.AddDbIndex(index); index = new DbIndexInfoClass { Name = string.Format("{0}_{1}", "Tb_TemporaryMgr", "SourceType") }; index.AppendFieldDefine("SourceType", false); o.AddDbIndex(index); Marshal.ReleaseComObject(o); } CRSFactory factory = new CRSFactoryClass(); spatialCRS = factory.CreateFromWKT("UNKNOWNCS[\"unnamed\"]") as ISpatialCRS; set = ds.CreateFeatureDataset("FeatureDataSet", spatialCRS); if (set != null) { Marshal.ReleaseComObject(set); } return(true); } catch (Exception exception) { return(false); } }