ArcEngine下一个TIN生成的轮廓
太晚了,直接连接的源代码:
/// <summary>
/// TIN生成等高线
/// </summary>
/// <param name="pInterval">等高线间距</param>
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 创建几何字段
/// <summary>
/// 创建几何字段
/// </summary>
/// <param name="p_esriGeotype"></param>
/// <returns></returns>
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功能说明参考帮助文档。
版权声明:本文博主原创文章,博客,未经同意,不得转载。
ArcEngine下一个TIN生成的轮廓的更多相关文章
- SGU 179 Brackets light(生成字典序的下一个序列)
题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=179 解题报告:输入一个合法的括号串,求出这个括号串的字典序的下一个串.(认为'(' ...
- 31. Next Permutation (java 字典序生成下一个排列)
题目: Implement next permutation, which rearranges numbers into the lexicographically next greater per ...
- POJ 1146 ID Codes 用字典序思想生成下一个排列组合
ID Codes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7644 Accepted: 4509 Descript ...
- Scrapy 小技巧(一):使用 scrapy 自带的函数(follow & follow_all)优雅的生成下一个请求
前言 如何优雅的获取同一个网站上下一次爬取的链接并放到生成一个 Scrapy Response 呢? 样例 from urllib import parse import scrapy class S ...
- poj 1146 ID Codes (字符串处理 生成排列组合 生成当前串的下一个字典序排列 【*模板】 )
ID Codes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6229 Accepted: 3737 Descript ...
- js获取上一个月、下一个月格式为yyyy-mm-dd的日期
/** * 获取上一个月 * * @date 格式为yyyy-mm-dd的日期,如:2014-01-25 */ function getPreMonth(date) { var arr = date. ...
- asp.net下调用Matlab生成动态链接库
对于这次论文项目,最后在写一篇关于工程的博客,那就是在asp.net下调用matlab生成的dll动态链接库.至今关于matlab,c/c++(opencv),c#(asp.net)我总共写了4篇配置 ...
- Linux下动态库生成和使用
Linux下动态库生成和使用 一.动态库的基本概念 1.动态链接库是程序运行时加载的库,当动态链接库正确安装后,所有的程序都可以使用动态库来运行程序.动态链接库是目标文件的集合,目标文件在动态链接库中 ...
- Linux下静态库生成和使用
Linux下静态库生成和使用 一.静态库概念 1.库是预编译的目标文件(object files)的集合,它们可以被链接进程序.静态库以后缀为”.a”的特殊的存档(archive file)存储. ...
随机推荐
- DFA和trie特里实现敏感词过滤(python和c语言)
今天的项目是与完成python开展,需要使用做关键词检查,筛选分类,使用前c语言做这种事情.有了线索,非常高效,内存小了,检查快. 到达python在,第一个想法是pip基于外观的c语言python特 ...
- STM32本学习笔记EXTI(外部中断)
参考资料:STM32数据表.网络信息 =========================================切割线===================================== ...
- [LeetCode107]Binary Tree Level Order Traversal II 二叉树层次遍历
题目: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from ...
- 七牛对用户使用webp图片格式的使用建议
Qiniu 七牛问题解答 Chrome浏览器是可打开WebP格式的.可是并非全部的浏览器都支持webp格式,比如360.ie等浏览器是不支持的. WebP格式,谷歌(google)开发的一种旨在加快图 ...
- cassandra 服务启动流程
cassandra 服务启动流程 1. setup 1) CassandraDaemon ->main publicstaticvoidmain(String[]args) { insta ...
- S2SH新手框架结构的准备工作只需要导入这些文件
实习北京最近一直在某公司.时间很冲突,总想着有事找东西坐,思想,做事先成套我吧 一套完整的东西想好主题,术去实现了,在学校尽管说是学了J2EE,可是确实没学到东西,Struts2+Hibernate不 ...
- CreateEvent、SetEvent、ResetEvent和WaitForSingleObject
事件对象就像一个开关:它仅仅有两种状态---开和关.当一个事件处于"开"状态.我们称其为"有信号".否则称为"无信号". 能够在一个线程的运 ...
- NET MVC过滤器
NET MVC过滤器 本系列目录:ASP.NET MVC4入门到精通系列目录汇总 在ASP.NET MVC中有四种过滤器类型
- Oracle中merge into的使用 (转)
http://blog.csdn.net/yuzhic/article/details/1896878 http://blog.csdn.net/macle2010/article/details/5 ...
- JS学习笔记-OO创建怀疑的对象
问了.工厂介绍,解决重码 前面已经提到,JS中创建对象的方法.不难发现,主要的创建方法中,创建一个对象还算简单,假设创建多个类似的对象的话就会产生大量反复的代码. 解决:工厂模式方法(加入一个专门创建 ...