博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ArcEngine下一个TIN生成的轮廓
阅读量:5916 次
发布时间:2019-06-19

本文共 3513 字,大约阅读时间需要 11 分钟。

太晚了,直接连接的源代码:

///         /// TIN生成等高线        ///         /// 等高线间距        public void Tin2Contour(string path_,string name_,double pInterval)        {            //获取TIN            ITinLayer pTinlayer = GetLayerByName(pScene , comboBox_TIN.Text) as ITinLayer;            ITin pTin = pTinlayer.Dataset as ITin;            //创建Contour shape            IWorkspaceFactory pWSFac = new ShapefileWorkspaceFactoryClass();            IFeatureWorkspace pFeatureWS = pWSFac.OpenFromFile(path_ , 0) as IFeatureWorkspace;            if (System.IO.File.Exists(path_+"\\"+name_+".shp"))            {                System.IO.File.Delete(path_ + "\\" + name_ + ".shp");                System.IO.File.Delete(path_ + "\\" + name_ + ".dbf");                System.IO.File.Delete(path_ + "\\" + name_ + ".shx");            }            IFields pFields = CreateShapeFields(esriGeometryType.esriGeometryPolyline);            pFeatureWS.CreateFeatureClass(name_ , pFields , null , null , esriFeatureType.esriFTSimple , "Shape" , null);                       IFeatureClass pContourFeatureClass = pFeatureWS.OpenFeatureClass(name_);                     //生成等高线            ITinSurface pTinSurface = pTin as ITinSurface;            pTinSurface.Contour(0 , pInterval , pContourFeatureClass , "Contour" , 0);            //加入等高线图层            IFeatureLayer pFeatureLayer = new FeatureLayerClass();            pFeatureLayer.FeatureClass = pContourFeatureClass;                      IGeoFeatureLayer pGeoFeatureLayer = pFeatureLayer as IGeoFeatureLayer;            pGeoFeatureLayer.DisplayAnnotation = true;            pGeoFeatureLayer.DisplayField = "Contour";            pGeoFeatureLayer.Name = pContourFeatureClass.AliasName + "_Contour";            //设置线样式            ILineSymbol pLineSymbol = new SimpleLineSymbolClass();            pLineSymbol.Color = GetRGBColor(32 , 47 , 247);            pLineSymbol.Width = 2;            ISimpleRenderer pRender = pGeoFeatureLayer.Renderer as ISimpleRenderer;            pRender.Symbol = pLineSymbol as ISymbol;            pScene.AddLayer(pFeatureLayer as ILayer);        }
#region 创建几何字段        ///         /// 创建几何字段        ///         ///         /// 
public IFields CreateShapeFields(esriGeometryType p_esriGeotype) { IFields pFields = new FieldsClass(); IFieldsEdit pFieldsEdit = pFields as IFieldsEdit; IGeometryDef pGeoDef = new GeometryDefClass(); IGeometryDefEdit pGeoDefEdit = pGeoDef as IGeometryDefEdit; pGeoDefEdit.GeometryType_2 = p_esriGeotype; pGeoDefEdit.SpatialReference_2 = (ISpatialReference) new UnknownCoordinateSystem(); IField pFld = new FieldClass(); IFieldEdit pFldEdit = pFld as IFieldEdit; pFldEdit.Name_2 = "shape"; pFldEdit.IsNullable_2 = false; pFldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; pFldEdit.GeometryDef_2 = pGeoDef; pFieldsEdit.AddField(pFld); return pFields; } #endregion #region 依据名称获取图层 //依据名称获取图层 public ILayer GetLayerByName(IScene scene , string strLayerName) { ILayer pLayer = null; for (int i = 0;i < scene.LayerCount;i++) { pLayer = scene.get_Layer(i); if (strLayerName == pLayer.Name) { break; } } return pLayer; } #endregion
Contour功能说明参考帮助文档。

版权声明:本文博主原创文章,博客,未经同意,不得转载。

你可能感兴趣的文章
opencv 实现图像像素点反转
查看>>
Access denied for user 'root'@'localhost' (using p
查看>>
linux中grep命令
查看>>
H3C模拟器 DHCP Snooping 、中继 实例配置
查看>>
sed工具的使用
查看>>
数据仓库工程师、大数据开发工程师、BI工程师、ETL工程师之间有什么区别?...
查看>>
JVM初识-java类加载器
查看>>
对比各类分布式锁缺陷,抓住Redis分布式锁实现命门
查看>>
设置typeid后织梦currentstyle 不起作用的修复方法
查看>>
AndroidManifest.xml解析
查看>>
linux下磁盘分区详解
查看>>
利用iptables屏蔽IP段
查看>>
Oracle动态采样详解
查看>>
APUE读书笔记-03文件输入输出(4)
查看>>
linux系统中top命令输出详解
查看>>
cURL: Learning..
查看>>
Codeforces Round #219 (Div. 1) A. Counting Kangaroos is Fun 【二分】
查看>>
Html基础
查看>>
wiki----为用户设置管理员权限
查看>>
Codeforces Round #565 (Div. 3) A. Divide it!
查看>>