• MapXtreme 2005学习(2):向图层中添加点


    在添加点之前先要在地图上创建一个临时图层,创建临时图层请参考《MapXtreme2005学习(1):创建临时图层》。本示例中通过指定图层名,表名,点坐标在图层中添加一个点。代码如下:

     

        /// <summary>
        /// 向图层中添加点
        /// Design by Glacier
        /// 2008年8月6日
        /// <param name="tempLayerTableName">表名</param>
        /// <param name="tempLayerName">图层名</param>
        /// <param name="dPoint">点坐标</param>
        /// </summary>
        public static void AddPointToLayer(string tempLayerTableName, string tempLayerName, DPoint dPoint)
        {
            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 pgPoint = new MapInfo.Geometry.Point(workLayer.CoordSys, dPoint);
            MapInfo.Styles.SimpleVectorPointStyle spsPoint = new MapInfo.Styles.SimpleVectorPointStyle(37, System.Drawing.Color.Red, 20);
            MapInfo.Styles.CompositeStyle csPoint = new MapInfo.Styles.CompositeStyle(spsPoint);
            MapInfo.Data.Feature ptPoint = new MapInfo.Data.Feature(tblTemp.TableInfo.Columns);
            ptPoint.Geometry = pgPoint;
            ptPoint.Style = csPoint;

            //将点图元加入图层
            workLayer.Table.InsertFeature(ptPoint);
        }

  • 相关阅读:
    业务对象(BO)设计
    业务对象和BAPI
    LSMW应用
    BDC、CATT批量数据维护
    ABAP RFC远程调用
    LIST动态表格画线(动态列)
    ALV详解:OO SALV
    ALV详解:OO ALV
    ALV详解:Function ALV(二)
    ALV详解:Function ALV(一)
  • 原文地址:https://www.cnblogs.com/glacierh/p/1262143.html
Copyright © 2020-2023  润新知