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 博客园-所有随笔区 ...
随机推荐
- LeetCode 176 Second Highest Salary mysql,select 嵌套 难度:1
https://leetcode.com/problems/second-highest-salary/ Write a SQL query to get the second highest sal ...
- Spring之JDBC模板jdbcTemplate
要使用Jdbctemplate 对象来完成jdbc 操作.通常情况下,有三种种方式得到JdbcTemplate 对象. 第一种方式:我们可以在自己定义的DAO 实现类中注入一个Da ...
- Lantern卫星接收器:为你提供免费上网服务
包括笔者在内,许多现代人的日常生活都无法离开网络,因为在网络上我们几乎可以找到任何我们需要的信息.但你是否有想过在户外无网络信号的情况下如何接收网络数据呢?一个名为Outernet Inc.的公司为我 ...
- oracle生成行方法
数据库记录是行的集合 set of row, 那么如何如何生成集合呢? oracle中常用的是 递归查询(with ... union all ...) 以及 connect by(树形查询) htt ...
- loadrunner (一)如何查看分析、报告结果
- 安装java和jmeter
win7 64位 安装java 1.下载java开发工具包JDK,在硬盘创建java文件夹,在里面创建jdk1.8.0_101和jre1.8.0_101 2.安装jdk,第一个路径装在jdk1.8.0 ...
- filter_input() 函数
定义和用法 filter_input() 函数从脚本外部获取输入,并进行过滤. 本函数用于对来自非安全来源的变量进行验证,比如用户的输入. 本函数可从各种来源获取输入: INPUT_GET INPUT ...
- Windows上管理远程Linux VPS/服务器文件工具 - winscp
Linux上经常会经常需要编辑文件,特别是Linux VPS/服务器安装好系统之后配置环境会需要修改很多的配置文件等,对于常用Linux的基本上都能够熟练使用vi或者nano等SSH下面的文件编辑工具 ...
- java学习第十一天
第十二次课 目标 一维数组(创建访问) 一.概念与特点 1.概念 相同数据类型的有序集合[] 数组名: 容器的名字 元素: 下标变量,数组名[下标] 长度: length 下标: 位置.索引 ...
- php通用安装程序,导入数据文件(.sql)的安装程序
php通用安装程序,导入数据文件(.sql)的安装程序 该程序只需要1个php文件 和 1个数据文件,很方便调用.install/index.php 程序文件install/mycms ...