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)存储. ...
随机推荐
- 15一个NoSql数据库
随着因特网web2.0该网站的兴起.非关系型数据库,现在已经成为一个非常受欢迎的新领域.非关系数据库产品的发展非常迅速.而在处理传统的关系数据库web2.0现场.特别是大规模,高并发SNS类型web2 ...
- 移动web:转盘抽奖(幸运大转盘)
为了获取客户.回馈客户,平台一般会推出抽奖活动类的营销页.因此web页面中,有各式各样的抽奖效果. 格子式(九宫格),背景滚动式(数字/文字/图案),旋转式(转盘),游戏式(砸蛋/拼图...).... ...
- effective c++ 条款26 postpone variable definition as long as possible
因为构造和析构函数有开销,所以也许前面定义了,还没用函数就退出了. 所以比较好的方法是用到了才定义.
- android生成apk包出现Unable to add "XXX" Zip add failed问题
最近试图整合umeng至cocos2d-x围棋项目,一切好工作,准备生成apk当出现了大量的数据包 [2014-06-03 20:02:52 - MyApp] Unable to add 'G:\co ...
- 【C语言探索之旅】 第二部分第十课:练习题和习作
内容简介 1.课程大纲 2.第二部分第十一课: 练习题和习作 3.第三部分第一课预告: 安装SDL 课程大纲 我们的课程分为四大部分,每一个部分结束后都会有练习题,并会公布答案.还会带大家用C语言 ...
- [ACM] poj 3468 A Simple Problem with Integers(段树,为段更新,懒惰的标志)
A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 55273 ...
- 【rman,1】经典案例增量备份
一.备份策略: 1.星期天晚上 -level 0 backup performed(全备份) 2.星期一晚上 -level 2 backup performed 3.星期二晚上 ...
- Java 打开文件的两种方式
import java.awt.Desktop; import java.io.File; import java.io.IOException; public class LnkDemo { pub ...
- DisplayContent、StackBox、TaskStack笔记
文章仅零散记录自己的一点理解,仅供自己參考. 每一个显示设备,都有一个Display对象,DisplayManagerService专门管理这些Display. 1.DisplayContent() ...
- WP8.1开发者预览版本号已知 Bug
偶的 Lumia 920 已经升级到最新的 8.1 开发者预览版本号,使用中没有发现什么问题. 可能是由于偶玩手机的情况比較少吧!忽然看到 MS 停止此版本号的更新,并说明有非常多的 BUG,偶就郁闷 ...