zoukankan      html  css  js  c++  java
  • MapXtreme 2005学习(3):向图层中添加线段

    向图层中添加线段和向图层中添加点是一样的,其本质都是向图层中添加一个图元,只是属于不同类型的图元。并且点和线段是可以在一个图存上共存的。代码示例如下:

        /// <summary>
        /// 向图层中添加线段
        /// Design by Glacier
        /// 2008年8月6日
        /// <param name="tempLayerTableName">表名</param>
        /// <param name="tempLayerName">图层名</param>
        /// <param name="startPoint">线段起点坐标</param>
        /// <param name="endPoint">线段终点坐标</param>
        /// </summary>
        public static void AddPointToLayer(string tempLayerTableName, string tempLayerName, DPoint startPoint, DPoint endPoint)
        {
            MapInfo.Mapping.Map myMap = MapInfo.Engine.Session.Current.MapFactory[MapControl1.MapAlias];

            //获取图层和表
            FeatureLayer workLayer = (MapInfo.Mapping.FeatureLayer)myMap.Layers[tempLayerName];
            MapInfo.Data.Table tblTemp = MapInfo.Engine.Session.Current.Catalog.GetTable(tempLayerTableName);

            //创建线图元及其样式
            FeatureGeometry pgLine = MultiCurve.CreateLine(workLayer.CoordSys, startPoint, endPoint);
            MapInfo.Styles.SimpleLineStyle slsLine = new MapInfo.Styles.SimpleLineStyle(new LineWidth(3, LineWidthUnit.Pixel), 2, System.Drawing.Color.OrangeRed);
            MapInfo.Styles.CompositeStyle csLine = new MapInfo.Styles.CompositeStyle(slsLine);
            MapInfo.Data.Feature ptLine = new MapInfo.Data.Feature(tblTemp.TableInfo.Columns);
            ptPoint.Geometry = pgLine;
            ptPoint.Style = csLine;
           
            //将线图元加入图层
            workLayer.Table.InsertFeature(ptLine);
        }

  • 相关阅读:
    Hello & Goodbye
    如何将 SQL SERVER 彻底卸载干净
    C#中Split用法
    Tensorflow2(预课程)---7.4、cifar10分类-层方式-卷积神经网络-AlexNet8
    Tensorflow2(预课程)---5.3.2、手写数字识别-层方式-卷积神经网络-LeNet-5稍改
    Tensorflow2(预课程)---5.3、手写数字识别-层方式-卷积神经网络-LeNet
    LeNet-5详解
    卷积神经网络-LeNet
    LeNet结构详细分析
    降采样层和池化层的关系
  • 原文地址:https://www.cnblogs.com/glacierh/p/1262185.html
Copyright © 2011-2022 走看看