using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ESRI.ArcGIS.Analyst3D;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.DataSourcesGDB;
using ESRI.ArcGIS.Geodatabase;
namespace _3DTerrianDesignSystem
{
static class TinNodeOperation
{
/// <summary>
/// 改变某一TinNode的X和Y坐标
/// </summary>
/// <param name="tinNode"></param>
/// <param name="x"></param>
/// <param name="y"></param>
public static void tinNode_ChangeXY(ITinNode tinNode, double x, double y)
{
ITin tin = tinNode.TheTin;
ITinFeatureEdit tinFeatEdit = (ITinFeatureEdit)tin;
//定义移动点的位置
WKSPoint newPoint = new WKSPoint();
newPoint.X = x;
newPoint.Y = y;
if (tinFeatEdit.StartInMemoryEditing())
{
ITinAdvanced tinAdvanced = (ITinAdvanced)tin;
ITinEdge tinEdge = tinAdvanced.GetEdge(1);
ITinFeatureSeed pSeed = (ITinFeatureSeed)tinEdge;
pSeed.UseTagValue = false;
tinFeatEdit.MoveVertex(tinNode, pSeed, newPoint, false);
}
}
/// <summary>
/// 改变某一TinNode的Z坐标
/// </summary>
/// <param name="tinNode"></param>
/// <param name="z"></param>
public static void tinNode_ChangeZ(ITinNode tinNode, double z)
{
ITin tin = tinNode.TheTin;
ITinEdit pTinEdit = (ITinEdit)tin;
pTinEdit.SetNodeZ(tinNode.Index, z);
}
/// <summary>
/// 改变某一TinNode的XYZ坐标
/// </summary>
/// <param name="tinNode"></param>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="z"></param>
public static void tinNode_ChangeXYZ(ITinNode tinNode, double x, double y, double z)
{
tinNode_ChangeXY(tinNode, x, y);
tinNode_ChangeZ(tinNode, z);
}
/// <summary>
/// 删除某一TinNode
/// </summary>
/// <param name="tinNode"></param>
public static void tinNode_Delete(ITinNode tinNode)
{
ITin tin = tinNode.TheTin;
ITinFeatureEdit tinFeatEdit = (ITinFeatureEdit)tin;
if (tinFeatEdit.StartInMemoryEditing())
{
ITinAdvanced tinAdvanced = (ITinAdvanced)tin;
ITinEdge tinEdge = tinAdvanced.GetEdge(1);
ITinFeatureSeed pSeed = (ITinFeatureSeed)tinEdge;
pSeed.UseTagValue = false;
tinFeatEdit.DeleteVertex(tinNode, pSeed);
}
}
/// <summary>
/// 添加TinNode
/// </summary>
/// <param name="tin"></param>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="z"></param>
public static void tinNode_Add(ITin tin, double x, double y, double z)
{
ITinFeatureEdit tinFeatEdit = (ITinFeatureEdit)tin;
IPoint pPoint = new PointClass();
pPoint.X = x;
pPoint.Y = y;
pPoint.Z = z;
tinFeatEdit.AddPointZ(pPoint, 0, null);
}
}
}
01-18
3343
10-30