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

  • 相关阅读:
    eclipse-source not found
    eclipse-[org.apache.hadoop.util.Shell]
    Oracle—字段多行合并(LISTAGG)
    Selenium IDE 命令使用——断言
    Selenium IDE录制脚本——Chrome浏览器使用介绍
    Selenium家族谱(三生三世)
    python自动化测试之多线程生成BeautifulReport测试报告
    Python接口自动化之ExtentHTMLTestRunner测试报告
    [Java] Tomcat
    [刷题] 1002 写出这个数 (20分)
  • 原文地址:https://www.cnblogs.com/glacierh/p/1262185.html
Copyright © 2011-2022 走看看