關鍵性代碼整理

來源:互聯網
上載者:User

 

利用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);

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.