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

转: 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);

转载于:https://www.cnblogs.com/islkeng/archive/2012/10/18/2729848.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值