Select to view content in your preferred language

How convert an OGC polygon to an ADF polygon

2969
0
04-11-2013 12:08 AM
Labels (1)
guoxiaoyi
Emerging Contributor
Hi,guys,so far i have no idea how to get correctly polygon,which convert form OGC object.you know,in the OGC standard,the polygon just have only one exterior ring,but there are multiple rings in ADF object.I had to put the ADF's collection of Rings to OGC's ExteriorRing property.it partly works well,Somehow,i still can't get a correct polygon when the object is a complex polygon.
Is there another more appropriate object to replace this?
i don't know my description is clear or not?thanks in advance.

for (int i = 0; i < adf_polygon.Rings.Count; i++)
                {
                    //Adding exterior ring into coordinate collection.
                    foreach (ESRI.ArcGIS.ADF.Web.Geometry.Point exPt in adf_polygon.Rings.Points)
                    {
                        exteriorCoords.Add(new Coordinate(exPt.X, exPt.Y));
                    }
                    
                    for (int j = 0; j < adf_polygon.Rings.Holes.Count; j++)
                    {
                        List<ICoordinate> coords = new List<ICoordinate>();
                        foreach (ESRI.ArcGIS.ADF.Web.Geometry.Point pt in adf_polygon.Rings.Holes.Points)
                        {
                            coords.Add(new Coordinate(pt.X, pt.Y));
                        }
                        ILinearRing hole = new LinearRing(coords);
                        interiorHoles.Add(hole);
                    }
                }
                ILinearRing exteriorRing = new LinearRing(exteriorCoords);
                ogc_polygon= new Polygon(exteriorRing,interiorHoles);
0 Kudos
0 Replies