zoukankan      html  css  js  c++  java
  • AE Contour和ContourAsPolyline

    转自http://www.cnblogs.com/cglNet/archive/2011/03/03/1970061.html

    感谢cglNet分享

    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();
            }
  • 相关阅读:
    SpringCloud
    SpringCloud
    一个表的字段更新另一个表的字段
    MYSQL5.7 sql_mode=only_full_group_by
    CentOS7 防火墙操作
    log4j DailyRollingFileAppender, DatePattern 配置
    Fiddler抓包-会话框添加查看get与post请求类型选项
    Fiddler抓包-工具介绍(request和response)
    Fiddler抓包-get与post请求
    Fiddler抓包-只抓APP的请求
  • 原文地址:https://www.cnblogs.com/imihiroblog/p/2590268.html
Copyright © 2011-2022 走看看