zoukankan      html  css  js  c++  java
  • ISurfaceOp 接口生成等高线(二)

    (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();
            }

  • 相关阅读:
    微信浏览器内 h5 直接唤醒 app 之 微信开放标签 wx-open-launch-app
    HTML5之2D物理引擎 Box2D for javascript Games 系列 翻外篇--如何结合createJS应用box2d.js
    HTML5之2D物理引擎 Box2D for javascript Games 系列 第三部分之创建图腾破坏者的关卡
    HTML5之2D物理引擎 Box2D for javascript Games 系列 第二部分
    HTML5之2D物理引擎 Box2D for javascript Games 系列 第一部分
    写给“有钱大爷”、”美工殿下”、“前端文艺青年”的微信HTML5页面设计建议
    微信 JS-SDK Demo “分享信息设置” API 及数字签名生成方法(NodeJS版本)更新时间(2020-10-29)
    NodeJS让前端与后端更友好的分手
    “榕树下·那年”移动app ( hybrid ) 开发总结
    如何在移动端app中应用字体图标icon fonts
  • 原文地址:https://www.cnblogs.com/cglNet/p/1970100.html
Copyright © 2011-2022 走看看