zoukankan      html  css  js  c++  java
  • MapXtreme 2005学习(4):添加标注图层

    MapXtreme 2005中添加标注图层是非常容易的,只要知道要标准的表和相关的列,几行代码就搞定了,比想像中要容易多了。当然还有一些标注样式可以设置,可以从类库中查到相关的说明。

        /// <summary>
        /// 添加标注图层
        /// Design by Glacier
        /// 2008年8月6日
        /// <param name="tableName">标注的表名</param>
        /// <param name="columnName">标注的列名</param>
        /// </summary>
        public static void ShowLabelLayer(string tableName, string columnName)
        {
            MapInfo.Mapping.Map myMap = MapInfo.Engine.Session.Current.MapFactory[MapControl1.MapAlias];
           
            //新建标注图层
            LabelLayer labelLayer = new LabelLayer();
            myMap.Layers.Add(labelLayer);

            //指定要标注的数据表
            LabelSource labelSource = new LabelSource(MapInfo.Engine.Session.Current.Catalog.GetTable(tableName);
            labelLayer.Sources.Append(labelSource);
           
            //指定要标准字段所在的列
            labelSource.DefaultLabelProperties.Caption = columnName;

            //标注样式等属性
            //source.DefaultLabelProperties.Visibility.Enabled = true;
            //source.DefaultLabelProperties.Visibility.VisibleRangeEnabled = true;
            //source.DefaultLabelProperties.Visibility.VisibleRange = new VisibleRange(0.01, 10, MapInfo.Geometry.DistanceUnit.Mile);
            //source.DefaultLabelProperties.Visibility.AllowDuplicates = true;
            //source.DefaultLabelProperties.Visibility.AllowOverlap = true;
            //source.DefaultLabelProperties.Visibility.AllowOutOfView = true;
            //source.Maximum = 50;
            //source.DefaultLabelProperties.Layout.UseRelativeOrientation = true;
            //source.DefaultLabelProperties.Layout.RelativeOrientation = MapInfo.Text.RelativeOrientation.FollowPath;
            //source.DefaultLabelProperties.Layout.Angle = 33.0;
            //source.DefaultLabelProperties.Priority.Major = "index";
            //source.DefaultLabelProperties.Layout.Offset = 7;
            //source.DefaultLabelProperties.Layout.Alignment = MapInfo.Text.Alignment.BottomRight;
            //Font font = new Font("黑体", 10);
            //font.ForeColor = System.Drawing.Color.DarkBlue;
            //source.DefaultLabelProperties.Style.Font = font;
        }

  • 相关阅读:
    基于javascript引擎封装实现算术表达式计算工具类
    Windows 服务入门指南
    参数化查询为什么能够防止SQL注入
    Control 的DraggerHelper, 拖动控件从此变得很简单。。。
    书籍推荐记这几年看的书
    使用“using” 的 “Cursor”
    多线程,silverlight_Rest_WCF,dynamic 索引帖
    关于静态事件 static event 的二三事
    探讨 .NET 4 新增的 SortedSet 类
    我们需要莱特希尔报告
  • 原文地址:https://www.cnblogs.com/glacierh/p/1262238.html
Copyright © 2011-2022 走看看