1. if you want to create a constrained Delaunay triangultaion and you do not want any edge to be densified:
var pEnv = pPolygon.Envelope; ITinEdit TinEdit = new TinClass(); TinEdit.InitNew(pEnv); ITinEdit2 TinEdit2 = TinEdit as ITinEdit2; TinEdit2.SetToConstrainedDelaunay();
2. what is the difference between hard and soft in esriTinSurfaceType or esriTinEdgeType?
see:15375 - What is the difference between TIN hard and soft breaklines?
3. what are the differences between line, clip, erase in ITinEdit?
line: normal
clip: delete the data outside a specified polygon, at the same time the data area is bounded by this polygon
erase: delete the data inside a specified polygon, at the same time the data area is bounded by this polygon
an edge on the boundary is not inside data area.
What if there are many polygons? I don't know yet.
4. methods of ITinFeatureEdit:
AddPolygon: insert a polygon into a Tin so that the edges of this Polygon will be integrated into the Tin (only in the data area). Before using this method, you should have already create Tin.
AddPolygonZ: insert a polygon into a Tin so that the edges of this Polygon will be integrated into the Tin.
We can take it as that, AddPolygon is used to make some rules for existing Tin, but AddPolygonZ is used as an element to create Tin. This should be analogous to AddPolyline and AddPolylineZ, I guess.
5. my example
//generates some points IPoint ipt1 = new PointClass(); ipt1.PutCoords(0, 0); ipt1.Z = 0; IPoint ipt2 = new PointClass(); ipt2.PutCoords(1, 0); ipt2.Z = 0; IPoint ipt3 = new PointClass(); ipt3.PutCoords(0.8, 0.8); ipt3.Z = 0; IPoint ipt4 = new PointClass(); ipt4.PutCoords(0, 1); ipt4.Z = 0; IPoint ipt5 = new PointClass(); ipt5.PutCoords(0, 0); ipt5.Z = 0; //generate a polygon IPointCollection pCol = new PolygonClass(); pCol.AddPoint(ipt1); pCol.AddPoint(ipt2); pCol.AddPoint(ipt3); pCol.AddPoint(ipt4); pCol.AddPoint(ipt5); IPolygon pPolygon = pCol as IPolygon; //set the environment of TIN var pEnv = pPolygon.Envelope; ITinEdit TinEdit = new TinClass(); TinEdit.InitNew(pEnv); ITinEdit2 TinEdit2 = TinEdit as ITinEdit2; TinEdit2.SetToConstrainedDelaunay(); //each point of pPolygon must have Z value, that is, Z must not be NaN ITinFeatureEdit pTinFeatureEdit = TinEdit as ITinFeatureEdit; pTinFeatureEdit.AddPolygonZ(pPolygon, esriTinEdgeType.esriTinHardEdge, 1, 1, 1, null); //add the polygon as the constraint //each point of pPolygon must have Z value, that is, Z must not be NaN TinEdit.AddShape(pPolygon, esriTinSurfaceType.esriTinHardClip, 0); //get TinEdge form TIN ITinAdvanced2 ptinadvanced2 = TinEdit as ITinAdvanced2; List<ITinEdge> ITinEdgeLt = new List<ITinEdge>(ptinadvanced2.DataEdgeCount); for (int i = 0; i < ptinadvanced2.EdgeCount; i++) { ITinEdge ptinedge = ptinadvanced2.GetEdge(i + 1); if (ptinedge.IsInsideDataArea) { ITinEdgeLt.Add(ptinedge); } }
If you want to construct a TIN for a mixture of points and polygons, you should first add the polygons into the TIN. If you add the points first, then the TIN will be constructed according to these points and many TIN edges are also constructed. Now if you add a polygon, then an edge of this polygon could intersect an existing TIN edge. In this case, ArcObjects would simply split both the edge and the existing TIN edge by inserting a new TIN node.
Any suggestions would be appreciated.
you also can create a incremental diagram Voronoi:
for example on add point in tin you can use pseudo code:
IPoint pt = yourPointClass
pt.Z = 0;
ITinNode tinNode = new TinNodeClass();
tinFeatureEdit.AddPointZ(pt, 0, tinNode);
IPolygon pg = tinNode.GetVoronoiRegion(yourMaxExtent);
get adjacent point of point added:
ITinNodeArray a = tinNode.GetAdjacentNodes();
//remove feature with index in ITinNodeArray from featureclass polygon Voronoi
IFeatureCursor pCur = fcVoronoi.Search(qf, false); // not recycling
IFeature pFeat = pCur.NextFeature();
do
{
pFeat.Delete();
pFeat = pCur.NextFeature();
} while (pFeat != null);
//and add new polygon Voronoi
foreach (index of Node in ITinNodeArray)
{
ITinNode tinNodeCurrent = tinNodeCollection.GetNode(index);
IPolygon pgCurrent = tinNodeCurrent.GetVoronoiRegion(yourMaxExtent);
if ((pgCurrent != null) && (!pgCurrent.IsEmpty))
{
feature = fcVoronoi.CreateFeature();
feature.Shape = pgCurrent;
feature.set_Value(idxId, tinNodeCurrent.Index);
feature.Store();
}
}