本文部分说明内容摘自网络文章,经过本人在MapXtreme2008中编写相关的演示例子,详细说明如何操作MapXtreme2008提供的矢量符号和定制符号。
  MapXtreme 在其安装过程中自动安装 10 种 MapInfo 特定的 TrueType 字体。这些字体为用户提供了字形符号选择,范围涉及天气、房地产、交通等。字形编号为 Unicode 字符值,由于这些编号位于第一个 Unicode 字符代码块范围内,因此,与 ASCII 字符集兼容。
  MapXtreme包含三种点样式:BitmapPointStyle (位图点样式)、FontPointStyle(字体点样式)和SimpleVectorPointStyle(简单矢量点样式)。
        
 简单矢量点样式

此样式包含使用MapInfo 3.0 兼容专有字体用于绘制点的样式属性(MapInfow.fnt)。SimpleVectorPointStyle 属性包括了要为点绘制的实际符号的颜色、点大小和形状码。标准集包括符号31 至67。以下是符号与形状码的对应图,31是空。在比较简单的场合使用此样式已经足够,但是很多场合都不简单。

结构:

public SimpleVectorPointStyle(
   short code,
   Color color,
   double pointSize
);

code        上面图片中对应的形状码
color        填充符号的颜色,上面图片中为黑色
pointSize    符号大小

字体点样式
            使用FontPointStyle 类可以显示TrueType字体集,允许的最大点大小为240 点。这给了我们很大的自由空间,其中的MapInfo Symbols字体和上面的字体是相同的,不过MapInfo Symbols是TrueType字符集。MapXtreme自带的字体:
            Map Symbols
            MapInfo Arrows
            MapInfo Cartographic
            MapInfo Miscellaneous
            MapInfo Oil&Gas
            MapInfo Real Estate
            MapInfo Shields
            MapInfo Symbols
            MapInfo Transportation
            MapInfo Weather

可以使用一些相关软件查看这些字体的具体内容,比如 字体试衣间 、微软自带的 字符映射表 。

public FontPointStyle(
   short code,
   Font font,
   short angle,
   Color color,
   double pointSize
);

code        字体映射的编码
font        字体的样式。很关键,字体样式的强大全靠它了
angle        字体旋转的角度
color        字体填充的颜色
pointSize    字体的大小,12就差不多了

位图点样式

定制的位图符号位于 C:\Program Files\Common Files\MapInfo\MapXtreme\6.x\CustSymb。每个图像的文件扩展名都是 .BMP。可以用编程方式通过 MapInfo.Styles 命名空间中的 BitmapPointStyleRepository 集合类访问这些符号。可以创建自己的位图图像并将其添加到 CustSymb 目录。尽管事实上对创建的图像没有大小限制,不过 MapXtreme 显示图像的能力取决于可用的内存。图像不一定必须是方形,而且还可以具有最多24 位颜色深度。要确保图像以其高度和宽度显示,则必须在各自图像的 BitmapPointStyle 对象中将Boolean "NativeSize" 属性设置为 true。
            位图点样式应该是最可能被用到的样式。它通过自定义的图片来标识地图上的图元。位图点样式具有ShowWhiteBackground 属性;如果设置为false,则位图中的白像素为透明。默认情况下,ShowWhiteBackground 被设置为false。

public BitmapPointStyle(
   string strName,
   BitmapStyles style,
   Color color,
   double pointSize
);

strName        图片的相对路径加上名称。一般图片的根路径是  X:\Program Files\Common Files\MapInfo\MapXtreme\6.x\CustSymb    X为安装盘。同时图片也放在那里。
style            图片的样式。

  • None: 按默认的状态显示。并且白色部分将透明。
  • ShowWhiteBackground: 显示白色部分。
  • ApplyColor: 在标识中的透明部分将用第三个参数的颜色填充.
  • NativeSize: 按标识的真实大小和象素显示,第四项参数将无效.

color        白色部分的填充色
pointSize    标识大小

下面分别介绍这几种图标如何在Web中添加展示,下面列出相关代码。

Code
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (StateManager.IsManualState())
            {
                MapInfo.Mapping.Map myMap = GetMapObj();
                if (Session.IsNewSession)
                {
                    MapInfo.WebControls.MapControlModel controlModel = MapControlModel.SetDefaultModelInSession();

//instanciate AppStateManager class
                    AppStateManager myStateManager = new AppStateManager();
                    //put current map alias to state manager dictionary
                    myStateManager.ParamsDictionary[StateManager.ActiveMapAliasKey] = this.MapControl1.MapAlias;
                    //put state manager to session
                    StateManager.PutStateManagerInSession(myStateManager);

#region 测试代码

if (myMap != null)
                    {
                        if (myMap.Layers["TempLayerAlias"] != null)
                        {
                            myMap.Layers.Remove("TempLayerAlias");
                        }
                    }
                    // Need to clean up "dirty" temp table left by other customer requests.
                    MapInfo.Engine.Session.Current.Catalog.CloseTable("TempTableAlias");
                    // Need to clear the DefautlSelection.
                    MapInfo.Engine.Session.Current.Selections.DefaultSelection.Clear();

// Creat a temp table and AddPintPointCommand will add features into it.
                    MapInfo.Data.TableInfoMemTable ti = new MapInfo.Data.TableInfoMemTable("TempTableAlias");
                    // Make the table mappable
                    ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateFeatureGeometryColumn(myMap.GetDisplayCoordSys()));
                    ti.Columns.Add(MapInfo.Data.ColumnFactory.CreateStyleColumn());

MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.CreateTable(ti);
                    // Create a new FeatureLayer based on the temp table, so we can see the temp table on the map.
                    myMap.Layers.Insert(0, new FeatureLayer(table, "templayer", "TempLayerAlias"));

IMapLayer lyr = myMap.Layers["TempLayerAlias"];
                    if (lyr == null) return;
                    FeatureLayer fLyr = lyr as FeatureLayer;

MapInfo.Geometry.DPoint point = new DPoint(100, 20);
                    MapInfo.Geometry.Point geoPoint = new MapInfo.Geometry.Point(myMap.GetDisplayCoordSys(), point);
                    
                    // 创建内置MapInfo符号图标
                    SimpleVectorPointStyle vStyle = new SimpleVectorPointStyle();
                    vStyle.Code = 67;
                    vStyle.Color = Color.Red;
                    vStyle.PointSize = Convert.ToInt16(48);
                    vStyle.Attributes = StyleAttributes.PointAttributes.BaseAll;
                    vStyle.SetApplyAll();

// Create a Feature which contains a Point geometry and insert it into temp table.
                    Feature feature = new Feature(geoPoint, vStyle);
                    MapInfo.Data.Key key = fLyr.Table.InsertFeature(feature);

//创建自定义位图样式
                    //位图相对于位置C:\Program Files\Common Files\MapInfo\MapXtreme\6.8.0\CustSymb
                    string fileName = @"AMBU1-32.BMP";
                    BitmapPointStyle bStyle = new BitmapPointStyle(fileName);
                    bStyle.PointSize = Convert.ToInt16(24);
                    bStyle.NativeSize = true;
                    bStyle.Attributes = StyleAttributes.PointAttributes.BaseAll;
                    bStyle.SetApplyAll();

point = new DPoint(140, 55);
                    geoPoint = new MapInfo.Geometry.Point(myMap.GetDisplayCoordSys(), point);
                    feature = new Feature(geoPoint, bStyle);
                    key = fLyr.Table.InsertFeature(feature);

//添加字体图样式
                    //FontPointStyle fStyle = new FontPointStyle();
                    //fStyle.Color = Color.Red;
                    //fStyle.Font.Name = "NewCom Vehicle";
                    //fStyle.PointSize = Convert.ToInt16(24);
                    //fStyle.Attributes = StyleAttributes.PointAttributes.BaseAll;
                    //fStyle.SetApplyAll();

FontPointStyle fStyle = new FontPointStyle();
                    fStyle.Code = 66;
                    fStyle.PointSize = 48;
                    fStyle.Color = System.Drawing.Color.Red;
                    fStyle.Font.Name = "Uniwill";
                    fStyle.Font.FontWeight = MapInfo.Styles.FontWeight.Bold;
                    fStyle.Angle = 900;

point = new DPoint(180, 85);
                    geoPoint = new MapInfo.Geometry.Point(myMap.GetDisplayCoordSys(), point);
                    feature = new Feature(geoPoint, fStyle);
                    key = fLyr.Table.InsertFeature(feature);

#endregion
                }

// Now Restore State
                StateManager.GetStateManagerFromSession().RestoreState();
            }
        }

其他部分的相关代码如下:

Code
        // At the time of unloading the page, save the state
        protected void Page_UnLoad(object sender, System.EventArgs e)
        {
            if (StateManager.IsManualState())
            {
                StateManager.GetStateManagerFromSession().SaveState();
            }
        }

private MapInfo.Mapping.Map GetMapObj()
        {
            MapInfo.Mapping.Map myMap = MapInfo.Engine.Session.Current.MapFactory[MapControl1.MapAlias];
            if (myMap == null)
            {
                myMap = MapInfo.Engine.Session.Current.MapFactory[0];
            }
            return myMap;
        }

以上得到的界面效果如下图所示,分别有3个对应的图标与之对应。

更多专业前端知识,请上 【猿2048】www.mk2048.com

MapXtreme2008中操作矢量符号和定制符号相关推荐

  1. ArcGIS中根据图层形状创建图例符号

    目录 一.激活"新建图例图面形状"工具 二.根据图层的整体形状创建符号 三.绘制形状符号 四.创建图例 虽然ArcGIS内容列表(TOC)中图层的符号(线.面图层)外观都非常一致, ...

  2. 【C 语言】数组与指针操作 ( 数组符号 [] 与 指针 * 符号 的 联系 与 区别 | 数组符号 [] 与 指针 * 符号 使用效果 基本等价 | 数组首地址 与 指针 本质区别 )

    文章目录 前言 一.数组符号 [] 与 指针 * 符号 使用效果 基本等价 二.数组首地址 与 指针 本质区别 前言 参考 [C 语言]指针 与 数组 ( 指针 | 数组 | 指针运算 | 数组访问方 ...

  3. matlab中的符号对象与符号运算

    符号对象(Symbolic Objects 不同于普通的数值计算)是Matlab中的一种特殊数据类型,它可以用来表示符号变量.表达式以及矩阵,利用符号对象能够在不考虑符号所对应的具体数值的情况下能够进 ...

  4. Asp.Net中几种相似的标记符号:解释及用法 还有许多细节

    1.Asp.Net中几种相似的标记符号: < %=...%>< %#... %>< % %>< %@ %>解释及用法 答: < %#... %&g ...

  5. C语言中的强符号与弱符号

    注意,强符号和弱符号都是针对定义来说的,不是针对符号的引用. 一.概述 在C语言中,函数和初始化的全局变量(包括显示初始化为0)是强符号,未初始化的全局变量是弱符号. 对于它们,下列三条规则使用: ① ...

  6. 浅谈一下嵌入式中的强符号和弱符号

    __attribute__  是一个编译器指令,其实是 GNU C 的一种机制,本质是一个编译器的指令,在声明的时候可以提供一些属性,在编译阶段起作用,来做多样化的错误检查和高级优化. 用于在 C.C ...

  7. c语言弱符号与函数指针,浅谈C语言中的强符号、弱符号、强引用和弱引用【转】...

    首先我表示很悲剧,在看<程序员的自我修养--链接.装载与库>之前我竟不知道C有强符号.弱符号.强引用和弱引用.在看到3.5.5节弱符号和强符号时,我感觉有些困惑,所以写下此篇,希望能和同样 ...

  8. CAD动态块操作实例:绘制剖面符号

    CAD动态块与普通的CAD图块相比,其图形夹点更多,设计师可以利用动态块的夹点对图形进行快速调整,自由拉伸长度.随心切换隐藏形态等.本节,给大家分享一下浩辰CAD软件中利用CAD动态块的极轴拉伸功能来 ...

  9. 如何更改Excel中某些单元格的货币符号

    If you're working with different currencies in one Excel spreadsheet, you'll need to change the curr ...

最新文章

  1. Windows Phone 7第一次亲密接触
  2. Spring Boot 2.5.5发布:开始支持Java 17了!
  3. C语言学习之用指针方法对10个整数按由大到小顺序排序
  4. 牛客网(剑指offer) 第六题 旋转数组的最小数字
  5. CSocket文件传输 分段传输的关键代码
  6. java calendar_Java Calendar after()方法与示例
  7. IE浏览器使用Validation Engine表单重复提交问题
  8. jQuery的页面加载事件
  9. CTFShow“萌心区“WP题解
  10. 从WAVE头文件里获取压缩方式
  11. 跑分cpu_跑分完爆骁龙 865?明年这些中端处理器真的要起飞
  12. 计算机网络实验二:网络基础编程实验
  13. 【Android开发笔记】4.简单基站定位程序
  14. 如何理解数据质量中准确性和一致性的区别?
  15. QT UI界面组件介绍
  16. 自学Python九 爬虫实战二(美图福利)
  17. 学计算机买什么电脑性价比高,学生用什么笔记本电脑好 性价比高的学生笔记本电脑...
  18. 渗透测试-[windows-MS08-067、MS10-046、MS17-010、MS12-020]
  19. 2021年了,来谈谈Flutter的未来
  20. 二分答案——一元三次方程求解(洛谷 P1024)

热门文章

  1. android 号码查联系人,Android联系人查询
  2. 【卷积码系列3】(n,k,m)卷积码的维特比译码实现(不使用MATLAB库函数)及性能对比(vitdec函数-代码见CSDN同名资源)
  3. Java面向对象(10)--super关键字
  4. 信号与系统 chapter11 LTI系统的响应
  5. cordic ip核 vivado_Xilinx Vivado CORDIC IP求解atan 反正切
  6. python打开串口失败_python 如何防止串口通信失败?
  7. nginx访问目录是没加/的重定向控制
  8. day10T1改错记
  9. 利用 %20 替换 空格
  10. (剑指Offer)面试题4:替换空格