ISurfaceOp 接口生成等高线
(1)ISurfaceOp.Contour 根据DEM生成等高线图层:
private void button1_Click(object sender, EventArgs e)
{
//得到Raster
ILayer tLayer=this.axMapControl1.get_Layer(0);
IRasterLayer tRasterLayer=(IRasterLayer)tLayer;
IFeatureClass tFeatureClass=null;
IGeoDataset tGeodataset=null;
//使用接口 参数(Raster,等高线间距,基值)
ISurfaceOp tSurfaceop = new RasterSurfaceOpClass();
object obj = 0;
tGeodataset=tSurfaceop.Contour((IGeoDataset)tRasterLayer.Raster, 10, ref obj);
//判断是否生成等高线层,如果生成,加载到Map中
if (tGeodataset != null)
{
tFeatureClass = (IFeatureClass)tGeodataset;
if (tFeatureClass != null)
{
IFeatureLayer tFeatureLayer = new FeatureLayerClass();
tFeatureLayer.FeatureClass = tFeatureClass;
this.axMapControl1.AddLayer((ILayer)tFeatureLayer);
this.axMapControl1.Refresh();
}
}
}
(2) ISurfaceOp.ContourAsPolyline 根据已知点,返回穿过改点的等高线和改点的高程
private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
//通过鼠标获取点击的点坐标
IPoint tPoint = new PointClass();
tPoint.X = e.mapX;
tPoint.Y = e.mapY;
//得到Raster
ILayer tLayer = this.axMapControl1.get_Layer(0);
IRasterLayer tRasterLayer = (IRasterLayer)tLayer;
ISurfaceOp tSurfaceop = new RasterSurfaceOpClass();
//定义返回的线
IPolyline tPolygline = new PolylineClass();
//定义返回的高程点
double tEve = 0;
tSurfaceop.ContourAsPolyline((IGeoDataset)tRasterLayer.Raster, tPoint, out tPolygline, out tEve);//tSurfaceop.Contour((IGeoDataset)tRasterLayer.Raster, 10, ref obj);
//把生成的等高线画到Map上
ILineElement tLineElement = new LineElementClass();
IElement tElement = (IElement)tLineElement;
tElement.Geometry = tPolygline;
this.axMapControl1.ActiveView.GraphicsContainer.AddElement(tElement, 0);
//刷新Map
this.axMapControl1.Refresh();
}
(3)ISurfaceOp.ContourList 根据一系列高程点生成等高线图层:
private void button1_Click(object sender, EventArgs e)
{
//得到Raster
ILayer tLayer = this.axMapControl1.get_Layer(0);
IRasterLayer tRasterLayer = (IRasterLayer)tLayer;
//定义高程点数组
double[] tDouble = new double[] { 100, 120, 150, 200 };
IFeatureClass tFeatureClass = null;
IGeoDataset tGeodataset = null;
//使用接口
ISurfaceOp tSurfaceop = new RasterSurfaceOpClass();
object obj = tDouble;
tGeodataset = tSurfaceop.ContourList((IGeoDataset)tRasterLayer.Raster, ref obj);
//判断是否生成等高线层,如果生成,加载到Map中
if (tGeodataset != null)
{
tFeatureClass = (IFeatureClass)tGeodataset;
if (tFeatureClass != null)
{
IFeatureLayer tFeatureLayer = new FeatureLayerClass();
tFeatureLayer.FeatureClass = tFeatureClass;
this.axMapControl1.AddLayer((ILayer)tFeatureLayer);
this.axMapControl1.Refresh();
}
}
}
(4)ISurfaceOp.ContoursAsPolylines根据一系列点生成多根等高线
//定义点坐标集合
IPointCollection _PointCollect = new MultipointClass();
private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
//通过鼠标获取点击的点坐标集合
IPoint tPoint = new PointClass();
tPoint.X = e.mapX;
tPoint.Y = e.mapY;
object obj = Type.Missing;
_PointCollect.AddPoint(tPoint, ref obj, ref obj);
}
private void button1_Click(object sender, EventArgs e)
{
//得到Raster
ILayer tLayer = this.axMapControl1.get_Layer(0);
IRasterLayer tRasterLayer = (IRasterLayer)tLayer;
ISurfaceOp tSurfaceop = new RasterSurfaceOpClass();
//定义返回的线集合
IGeometryCollection tGeometryCollection;
//定义返回的高程点集合
IPointCollection tEveColl;
tSurfaceop.ContoursAsPolylines((IGeoDataset)tRasterLayer.Raster, _PointCollect, out tGeometryCollection, out tEveColl);//tSurfaceop.Contour((IGeoDataset)tRasterLayer.Raster, 10, ref obj);
if (tGeometryCollection!=null && tGeometryCollection.GeometryCount > 0)
{
//把生成的等高线画到Map上
for (int i = 0; i < tGeometryCollection.GeometryCount; i++)
{
IGeometry tGeometry = tGeometryCollection.get_Geometry(i);
ILineElement tLineElement = new LineElementClass();
IElement tElement = (IElement)tLineElement;
tElement.Geometry = tGeometry;
this.axMapControl1.ActiveView.GraphicsContainer.AddElement(tElement, 0);
}
}
//刷新Map
this.axMapControl1.Refresh();
}
ISurfaceOp 接口生成等高线的更多相关文章
- arcgis中DEM如何生成等高线
地形图指比例尺大于1∶100万的着重表示地形的普通地图(根据经纬度进行分幅,常用有1:100万,1:50万,1比25万,1:15万,1:10万,1:5万等等).由于制图的区域范围比较小,因此能比较精确 ...
- Delphi 提示在Delphi的IDE中,按Ctrl+Shift+G键可以为一个接口生成一个新的GUID。
对于Object Pascal语言来说,最近一段时间最有意义的改进就是从Delphi3开始支持接口(interface),接口定义了能够与一个对象进行交互操作的一组过程和函数.对一个接口进行定义包含两 ...
- Java WebService接口生成和调用 图文详解>【转】【待调整】
webservice简介: Web Service技术, 能使得运行在不同机器上的不同应用无须借助附加的.专门的第三方软件或硬件, 就可相互交换数据或集成.依据Web Service规范实施的应用之间 ...
- Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring
Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring 非原创[只为记录],原博文地址:https://www.cnblogs.com/ ...
- (转)Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring
Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring Mybatis在与Spring集成的时候可以配置MapperFactoryBea ...
- mybatis如何根据mapper接口生成其实现类
SpringBoot集成mybatis mybatis的statement的解析与加载 mybatis如何根据mapper接口生成其实现类 mybatis的mapper返回map结果集 mybatis ...
- 如何自动在Eclipse里对指定类或接口生成要覆盖的方法?
我们经常遇到对对指定类或接口生成要覆盖的方法,但是我们不了解这些类和接口,完全手写不能保证完全正确,那么是否可以准确知道指定类或接口要被覆盖的方法,自动生成这些代码呢?是的,完全可以,按照下面步骤操作 ...
- Mybaits 源码解析 (十一)----- 设计模式精妙使用:静态代理和动态代理结合使用:@MapperScan将Mapper接口生成代理注入到Spring
上一篇文章我们讲了SqlSessionFactoryBean,通过这个FactoryBean创建SqlSessionFactory并注册进Spring容器,这篇文章我们就讲剩下的部分,通过Mapper ...
- Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring - 大新博客 - 推酷 - 360安全浏览器 7.1
Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring - 大新博客 时间 2014-02-11 21:08:00 博客园-所有随笔区 ...
随机推荐
- C语言学习常识
开发环境 学习C语言,在mac os x上,我们选用的开发工具是x-code:而在Windows上,我们一般用微软提供的vc6.0:此外还有很多编辑器内置了或者支持下载C语言的编译器插件.所以,我们可 ...
- android属性之excludeFromRecents -- clearTaskOnLaunch 隐身意图 启动activity
这个可以 用android 任务中app 隐藏起来 android属性之clearTaskOnLaunch 此属性是 每次启动app时都会进入 根目录中 android:clearTask ...
- bicycle
http://bj.ganji.com/zixingchemaimai/611076069x.htm
- C#日志记录函数
错误日志记录在程序运行的实际维护中定位问题具有很大作用,日志越详细,反馈处理问题越方便. 常用的一个B/S架构下的日志函数. //日志记录函数 private void WriteLog( strin ...
- linux命令:which
1.命令介绍: which用来在指定的路径搜索某个系统命令的位置,并返回第一个搜索结果. 2.命令格式: which [选项] 系统命令 3.命令参数: -n 指定文件名长度,指定的长度必须大于或等 ...
- java.net.BindException: address already in use <null>:xxxx
linux下,tomcat突然关闭了,执行关闭(shutdown.sh)和启动(startup.sh)成功后,tomcat仍未运行,查看tomcat的catalina日志发现这样一个报错:java.n ...
- lucene教程简介
1 lucene简介 1.1 什么是lucene Lucene是一个全文搜索框架,而不是应用产品.因此它并不像www.baidu.com 或者google Desktop那么拿来就能用,它只是 ...
- JPush极光推送Java服务器端API
// 对android和ios设备发送 JPushClient jpush = new JPushClient(masterSecret, appKey); // 对android和ios设备发送 ...
- 信号处理基础概念比较----频谱vs功率谱vs能谱
频谱: 对动态信号在频率域内进行分析,分析的结果是以频率为坐标的各种物理量的谱线和曲线,可得到各种幅值以频率为变量的频谱函数F(ω).频谱是个很不严格的东西,常常指信号的Fourier变换.频谱分析中 ...
- 在C#中使用C++编写的类
现在在Windows下的应用程序开发,VS.Net占据了绝大多数的份额.因此很多以前搞VC++开发的人都转向用更强大的VS.Net.在这种情况下,有很多开发人员就面临了如何在C#中使用C++开发好的类 ...