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