关键性代码整理

 

利用AO将平面坐标转换成大地坐标
//利用AO将平面坐标转换成大地坐标
ISpatialReferenceFactory2 pfactory = new SpatialReferenceEnvironmentClass();
IProjectedCoordinateSystem flatref
= pfactory.CreateProjectedCoordinateSystem(54013);
IGeographicCoordinateSystem earthref
= pfactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_NAD1983);
IPoint pt
= new PointClass();
double x = Convert.ToDouble(txtX.Text);
double y = Convert.ToDouble(txtY.Text);
pt.PutCoords(x, y);
IGeometry geo
= (IGeometry)pt;
geo.SpatialReference
= flatref;
geo.Project(earthref);

plan.FlyTo(pt.X, pt.Y,
1000, 10000, 0, 0, "FlyToLocation");
MessageBox.Show(pt.X
+ " " + pt.Y);
Skyline通过对象名称对对象进行定位
//通过对象名称对对象进行定位
int itemID = infoTree.FindItem("[Free Hand Drawings]\\Triplane");
string objID = infoTree.GetTerraObjectID(itemID);
plan.FlyToObject(objID, ActionCode.AC_FLYTO);
根据数据库中内容生成二级目录
//根据数据库中内容生成二级目录
OleDbConnection conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\Data.mdb");
conn.Open();

OleDbDataAdapter oda
=new OleDbDataAdapter("select * from Type",conn);
DataSet dsType
=new DataSet();
oda.Fill(dsType);
DataView dvType
=dsType.Tables[0].DefaultView;

foreach(DataRowView drv in dvType)
{
TreeNode node
=new TreeNode();
node.Text
=drv["Name"].ToString();

int ID=(int)drv["ID"];
oda.SelectCommand.CommandText
="select * from Content where TypeID="+ID;
DataSet dsContent
=new DataSet();
oda.Fill(dsContent);
if (dsContent.Tables[0].Rows.Count > 0)
{
DataView dvContent
= dsContent.Tables[0].DefaultView;
foreach (DataRowView i_drv in dvContent)
{
TreeNode i_node
= new TreeNode();

i_node.Text
= i_drv["Content"].ToString();
node.Nodes.Add(i_node);
}
}
trvContent.Nodes.Add(node);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值