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 博客园-所有随笔区 ...
随机推荐
- NetworkReachable学习笔记
一.基本知识 在需要联网的iPhone程序中,我们首先需要检查网络的状态,如果不能连接网络则告诉用户程序不能使用的原因是没有网络连接.在iPhone的SystemConfiguration框架里有提供 ...
- jquery 动态生成html后click事件不触发原因
转自:http://www.iam3y.com/html/560.html 最近在做一个项目的时候,遇到动态加载微博内容,然后点击“展开评论”后获取该微博的所有评论.这里使用了动态加载的<spa ...
- html 选择图片后马上展示出来
document.getElementById('file4').onchange = function(evt) { // 如果浏览器不支持FileReader,则不处理 if (!window.F ...
- Linux-Big-Endian和Little-Endian转换
转自:http://blog.csdn.net/aklixiaoyao/article/details/7548860 在各种计算机体系结构中,对于字节.字等的存储机制有所不同,因而引发了计算机通信领 ...
- adb push和pull使用
1.运行cmd> 进入adb.exe目录 2.>adb connect ip 3.>adb remount 4.>adb push 本地apk全路径 /system/app/ ...
- hdu 2063
ps:二分匹配法,匈牙利算法.感觉自己只是学了点皮毛...这里贴上大神的微博,深入浅出的讲了匈牙利算法: http://blog.csdn.net/dark_scope/article/details ...
- Android Framework层Power键关机流程(二,关机流程)
二,关机流程 从前一篇博文我们知道,当用户长按Power键时会弹出(关机.重启,飞行模式等选项)对话框,我们点击关机,则会弹出关机确认对话框.那么从选项对话框到关机确认对话框又是一个什么流程呢.下面我 ...
- C语言之EOF和feof()
EOF用于判断所操作的文件是否已经读到文件结束,是在stdio.h文件中定义的符号常量,值为-1. 即当系统读取到文件结尾,所返回的一个信号值(也就是-1). EOF不是可输出字符,因此不能在屏幕上输 ...
- iOS-服务器文件断点下载
文件下载基本步骤:1.获取下载链接,创建响应发送请求.(使用异步请求,避免因文件过大下载时间长而阻塞主线程).2.当接到响应时在下载目录中创建文件.创建文件使用NSFileHandle进行文件内部处理 ...
- springboot系列之-helloword入门
一. What: Spring Boot是什么?以1.4.3.RELEASE为例,官方介绍为:http://docs.spring.io/spring-boot/docs/1.4.3.RELEASE/ ...