ESRI.ArcGIS.Client.Toolkit.DataSources.Kml.KmlToFeatureDefinition.ExtractLinearRing C# (CSharp) Method

ExtractLinearRing() private static method

Extracts a linear ring from the input element and applies style information to the placemark descriptor.
private static ExtractLinearRing ( KMLStyle kmlStyle, System.Xml.Linq.XElement geomElement ) : PlacemarkDescriptor
kmlStyle KMLStyle KML Style information.
geomElement System.Xml.Linq.XElement Linear ring geometry information.
return PlacemarkDescriptor
        private static PlacemarkDescriptor ExtractLinearRing(KMLStyle kmlStyle, XElement geomElement)
        {
            XNamespace kmlNS = geomElement.Name.Namespace;
            XElement coord = geomElement.Element(kmlNS + "coordinates");
            if (coord != null)
            {
                // Extract coordinates and build geometry
                ESRI.ArcGIS.Client.Geometry.PointCollection pts = ExtractCoordinates(coord);
                if (pts != null && pts.Count > 0)
                {
                    var polyline = new Polyline();
                    polyline.Paths.Add(pts);

                    // Create symbol and use style information
                    LineSymbolDescriptor sym = new LineSymbolDescriptor();
                    sym.style = kmlStyle;

                    // Create feature descriptor from geometry and other information
                    return new PlacemarkDescriptor()
                    {
                        Geometry = polyline,
                        Symbol = sym
                    };
                }
            }

            return null;
        }