//将地图坐标系转换为经纬度投影
MapInfo.Geometry.CoordSys LonLat=cf.CreateFromMapBasicString("CoordSys Earth Projection 1, 0");
_map.SetDisplayCoordSys (LonLat);
//将非地球坐标下的查找点转换我经纬度投影下的点
MapInfo.Geometry.CoordinateTransform Transformer=cf.CreateCoordinateTransform(LonLat,Nonearth);
MapInfo.Geometry.DPoint dpt=Transformer.CoordSys2ToCoordSys1(pt);
//设置查找半径
Distance d = MapInfo.Mapping.SearchInfoFactory.ScreenToMapDistance(_map, 3);
SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchNearest(dpt, LonLat, d);
IResultSetFeatureCollection fc = _catalog.Search("MAP_AREA", si);
Session.Current.Selections.DefaultSelection.Add(fc);
}
finally
{
Cursor.Current = Cursors.Default;
}
nonearth问题在6.2中已经完全解决.
8.有两个MapControls,怎样使其中一个保存为.MWS
MapInfo.Persistence.WorkSpacePersistence wsp = new MapInfo.Persistence.WorkSpacePersistence();
System.IO.FileStream file = new System.IO.FileStream("C:\temp\Test.mws", System.IO.FileMode.CreateNew);
wsp.Save(this.mapControl2.Map.Clone() as MapInfo.Mapping.Map,file);
file.Close();
9.查看特定几个图层
假定让lyr1和lyr2两个图层充满整个地图窗口:
Table[] ts= new Table[2];
ts[0] = lyr1.Table;
ts[1] = lyr2.Table;
IMapLayerFilter iml = MapLayerFilterFactory.FilterByTable(ts);
MapLayerEnumerator mle = mapControl1.Map.Layers.GetMapLayerEnumerator(iml);
mapControl1.Map.SetView(mle);
10.//创建临时层
TableInfoMemTable tblInfoTemp = new TableInfoMemTable("Animation");
MapInfo.Data.Table tblTemp = cat.GetTable("Animation");
if (tblTemp != null) //Table exists close it
{
cat.CloseTable("Animation");
}
tblInfoTemp.Columns.Add(ColumnFactory.CreateFeatureGeometryColumn(MapControl1.Map.GetDisplayCoordSys()));
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-27878-5.html
可怜的伊拉克连反恐的自由也没有了