惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
博客园 - Franky
MyScale Blog
MyScale Blog
L
LangChain Blog
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
Stack Overflow Blog
Stack Overflow Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
量子位
A
About on SuperTechFans
C
Check Point Blog
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
I
InfoQ
V
Visual Studio Blog
Vercel News
Vercel News
B
Blog
爱范儿
爱范儿
aimingoo的专栏
aimingoo的专栏
U
Unit 42

博客园 - 海燕一家

创业经验点滴 五(转) 关于淘宝 MAPINFO 的空间数据入库(ORACLE )与调用 [转]Mapx在C#中的应用 ArcGIS 代理产品价格以及折扣表、产品描述 MapInfo正版价格 ArcGIS 中国代理 MapInfo介绍(转) ArcInfo和MapInfo的比较 (转) 民用地图经纬度纠偏-高德系地图纠偏 [转载]关于火星坐标系统 关于火星坐标、偏移、加偏和纠偏、无偏的理解 创业经验点滴 四(转) 创业经验点滴 三(转) 面试那点事(转) 创业经验点滴 二(转) 创业经验点滴(转) iphone4s必装AppSync补丁教程使iOS5完全越狱 IOS 无证书真机调试教程(转) 详解C#委托,事件与回调函数(转)
转: C#+MAPX 添加线、文本、符号等图元
海燕一家 · 2012-10-18 · via 博客园 - 海燕一家

转: C#+MAPX 添加线、文本、符号等图元

1.添加线段MapXLib.Layer lyr;MapXLib.CoordSys coor = axMap1.DisplayCoordSys;//坐标lyr = axMap1.Layers.CreateLayer("temp_start", Type.Missing, 100, 10, coor);axMap1.Layers.AnimationLayer = lyr;//新建一个临时图层lyr.Editable = true;lyr.Visible = true; MapXLib.Point start = new MapXLib.PointClass();//新建起点MapXLib.Point end = new MapXLib.PointClass();//新建终点start.Set(node1.X, node1.Y);end.Set(node2.X, node2.Y); MapxLib.Feature LineObg;MapXLib.Points pts=new MapXlib.PointClass();MapXLib.Feature LineObj;MapXLib.Points pts = new MapXLib.PointsClass();pts.Add(start, 1);pts.Add(end, 2); LineObj = axMap1.FeatureFactory.CreateLine(pts, axMap1.DefaultStyle);lyr.AddFeature(LineObj, Type.Missing); 2.添加文本MapXLib.Layer lyr;lyr = axMap1.Layers.CreateLayer("temp_start", Type.Missing, 100, 10, coor);axMap1.Layers.AnimationLayer = lyr;//新建一个临时图层lyr.Editable = true;lyr.Visible = true; MapXLib.Style mystyle = new StyleClass();//文本格式mystyle.TextFont.Bold = false;mystyle.TextFont.Size = 0.1m;mystyle.TextFontColor = 0x0000FF; MapXLib.Feature TextObj;TextObj = axMap1.FeatureFactory.CreateText(middle, EdgeID.ToString(), Type.Missing, mystyle);//第一个参数为Point lyr.AddFeature(TextObj, Type.Missing); 3.添加符号MapXLib.Layer tempstar_lyr;MapXLib.CoordSys coor = axMap1.DisplayCoordSys;tempstar_lyr = axMap1.Layers.CreateLayer("temp_start", Type.Missing, 100, 10, coor);tempstar_lyr.Editable = true;tempstar_lyr.Visible = true;tempstar_lyr.AutoLabel = true;tempstar_lyr.OverrideStyle = true;tempstar_lyr.Style.SymbolFontColor = 0x0000FF;tempstar_lyr.Style.SymbolType = MapXLib.SymbolTypeConstants.miSymbolTypeVector;//选择符号样式tempstar_lyr.Style.SymbolVectorSize = 20; MapXLib.Feature SymbolObj=new FeatureClass();SymbolObj.Attach(axMap1.GetOcx());SymbolObj.KeyValue = "S";SymbolObj.Point = pt;tempstar_lyr.AddFeature(SymbolObj, Type.Missing);