public TriMesh CreateTIN(ILayer tinLayer)
{
ITinLayer pTinLayer = (ITinLayer)tinLayer;
ITin pTinEdit = pTinLayer.Dataset;
ITinAdvanced pTinAdv = pTin as ITinAdvanced;
if (pTinAdv == null)
{
return null;
}
TriMesh trimesh = new TriMesh();
for (int i = 1; i <= pTinAdv.DataTriangleCount; i++)
{
ITinTriangle pTinTri = pTinAdv.GetTriangle(i);//triangle的index是从1开始的
ITinNode n0 = pTinTri.get_Node(0);
ITinNode n1 = pTinTri.get_Node(1);
ITinNode n2 = pTinTri.get_Node(2);
trimesh.AddTriangle(n0.X, n0.Y, n0.Z, n1.X, n1.Y, n1.Z, n2.X, n2.Y, n2.Z);
}
return trimesh;//返回自定义的三角网数据类型
}