手机版

东华理工GIS二次开发实验报告(8)

发布时间:2021-06-06   来源:未知    
字号:

21 {

22 mmap = map; 23 }

24 public ILayer getlayerbyname(string slayername) 25 {

26 if (slayername == "" || mmap == null) return null; 27 for (int i = 0; i < yerCount; i++) 28 if (mmap.get_Layer(i).Name == slayername) 29

31 } 32

33 public IFeatureClass createshapefile

34 (string sparentdirection, string sworkspc, string sfilename) 35 {

36 if (System.IO.Directory.Exists(sparentdirection + sworkspc)) 37 System.IO.Directory.Delete(sparentdirection + sworkspc, true); 38 IWorkspaceFactory workspacef = 39

new ShapefileWorkspaceFactoryClass();

40 IWorkspaceName workname; 41 workname = 42

workspacef.Create(sparentdirection, sworkspc, null, 0);

43 IName name = workname as IName;

44 IWorkspace workspace = (IWorkspace)name.Open(); 45 IFeatureWorkspace ftworkspace = 46

workspace as IFeatureWorkspace;

47 IFields fields = new FieldsClass();

48 IFieldsEdit fieldsedit = fields as IFieldsEdit; 49 IFieldEdit fedit = new FieldClass(); 50 _2 = "OID"; 51 fedit.AliasName_2 = "序号";

52 fedit.Type_2 = esriFieldType.esriFieldTypeOID; 53 fieldsedit.AddField((IField)fedit); 54 fedit = new FieldClass(); 55 _2 = "Name"; 56 fedit.AliasName_2 = "名称";

57 fedit.Type_2 = esriFieldType.esriFieldTypeString; 58 fieldsedit.AddField((IField)fedit);

59 IGeometryDefEdit geodefedit = new GeometryDefClass(); 60 ISpatialReference sparef = mmap.SpatialReference; 61 geodefedit.SpatialReference_2 = sparef; 62 geodefedit.GeometryType_2 = 63

esriGeometryType.esriGeometryPoint;

64 fedit = new FieldClass();

return mmap.get_Layer(i);

30 return null;

东华理工GIS二次开发实验报告(8).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
×
二维码
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)