b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

mapxtreme_mapxtreme 售价_判断点是否在面内(3)

电脑杂谈  发布时间:2017-03-08 04:07:58  来源:网络整理

tables[1]=Connection.Catalog.OpenTable(@"G:\Shengjie_p.TAB");

mapControl1.Map.Load(new MapInfo.Mapping.MapTableLoader(tables));

4、问:如何在MapXtreme2004桌面应用程序中的任务栏上显示出鼠标的坐标?

答:代码如下:

1、添加mapControl1的MouseMove事件;

2、该事件及其中代码如下:

public void MapControl1_MouseMove(object sender, MouseEventArgs e)

{

System.Drawing.PointF DisplayPoint = new PointF(e.X,e.Y);

MapInfo.Geometry.DPoint MapPoint = new MapInfo.Geometry.DPoint();

MapInfo.Geometry.DisplayTransform converter = this.mapControl1.Map.DisplayTransform;

converter.FromDisplay(DisplayPoint, out MapPoint);

mapxtreme 售价_mapxtreme_判断点是否在面内

this.statusBar1.Text = "Cursor Location: " + MapPoint.x.ToString() + ", " + MapPoint.y.ToString();

}

5、问:如何使用代码修改桌面应用程序的坐标系统?(TOP)

答:代码如下:

Map map = mapControl1.Map;

MapInfo.Geometry.CoordSys coordSys = Session.Current.CoordSysFactory.CreateLongLat(DatumID.WGS84);

map.SetDisplayCoordSys(coordSys);

6、问:在C#中如何使用SpatialWare提供的用户自定义函数(UDFs)?

答:代码如下:以测量中的两个点之间的距离为例。

string connectionstring = "Integrated Security=SSPI;database=MYWEBGIS;server=(local);Connect Timeout=30";

SqlConnection connection = new SqlConnection(connectionstring);

connection.Open();

SqlCommand command = connection.CreateCommand();

command.CommandText = "select dbo.HG_SphericalDistance(a.SW_GEOMETRY, l.SW_GEOMETRY,'km') AS Expr1 from CH_SHENGHUI a, CH_SHENGHUI l where a.NAME = '北京' and l.NAME = '合肥'";

SqlDataReader reader = command.ExecuteReader();

while(reader.Read()){

textBox1.Text= reader["Expr1"].ToString();

}

reader.Close();

connection.Close();

这里需要注意的就是,在SQL语句中使用SpatialWare的函数时,一定要在前面加上dbo.,否则运行时就会出错。具体语句可以在SQL Server 2000企业管理器中调试后再拷贝到程序中即可。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-36378-3.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    每日福利
    热点图片
    拼命载入中...