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

  • 相关阅读:
    多数据源源路由方案
    java 异常信息返回
    SQL中只要用到聚合函数就一定要用到group by 吗?
    ASP.NET使用一般处理程序实现上传文本文件后实时读取
    git-删除远程不存在的分支
    Spring Boot-整合Retry框架重试机制
    vue3 Unsupported URL Type “npm:“: npm:vue-loader@^16.0.0-beta.7
    npm : 无法加载文件 D: odejs pm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 http://go.microsoft.com/fwlink
    flutter dio请求DioError [DioErrorType.DEFAULT]: SocketException: Insecure socket connections are disallowed by platform: ****
    Vue Element UI el-table 样式属性重叠发生错位
  • 原文地址:https://www.cnblogs.com/glacierh/p/1262238.html
Copyright © 2011-2022 走看看