东华理工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文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219