MapXtreme 画线问题
下面这段画线的代码的作用是在地图上根据鼠标的位置画出一条直线现在的问题是我画的线在地图上看不到,是哪里出错了?
/// 鼠标画线
/// </summary>
/// <param name="last">结束点的坐标</param>
/// <param name="new1">开始点的坐标</param>
public void CreateLine(DPoint last, DPoint new1)
{
try
{
MapInfo.Mapping.Map map = null;
if (MapInfo.Engine.Session.Current.MapFactory.Count == 0 ||
(map = MapInfo.Engine.Session.Current.MapFactory[0]) == null)
{
return;
}
MultiCurve multicurve = MultiCurve.CreateLine(mapControl1.Map.GetDisplayCoordSys(), last, new1);
Feature f = new Feature(multicurve, new MapInfo.Styles.SimpleLineStyle());
MapInfo.Mapping.FeatureLayer workingLayer = (MapInfo.Mapping.FeatureLayer)map.Layers[0];
if (workingLayer != null)
{
(workingLayer.Table as ITableFeatureCollection).Clear();
workingLayer.Table.InsertFeature(f);
}
}
catch (System.Runtime.InteropServices.COMException badCast)
{
}
} --------------------编程问答-------------------- 你要是确定线写进.tab文件,就试试table.Refresh(); --------------------编程问答-------------------- 靠,n年前的贴。
补充:企业软件 , 地理信息系统