Notes of Editing Tin

Document created by pengdlzn on Dec 17, 2014Last modified by pengdlzn on Feb 6, 2015
Version 7Show Document
  • View in full screen mode

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.

Attachments

    Outcomes