Ejemplo n.º 1
0
        /// <summary>
        /// Converts the Geography Markup representation.
        /// </summary>
        /// <param name="geometry">The geometry.</param>
        /// <returns>The GM representation of the <paramref name="geometry" /> in XElement.</returns>
        private static XElement CreateGMXElement(IMultiLineString geometry)
        {
            XElement multiLineStringElement = new XElement(_nameSpace + "MultiLineString", new XAttribute(XNamespace.Xmlns + "gml", _nameSpace));

            for (int i = 0; i < geometry.Count(); ++i)
            {
                XElement lineStringMemberElement = new XElement(_nameSpace + "LineStringMember");
                lineStringMemberElement.Add(CreateGMXElement(geometry[i]));
                multiLineStringElement.Add(lineStringMemberElement);
            }

            return(multiLineStringElement);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts the Geography Markup representation.
        /// </summary>
        /// <param name="geometry">The geometry.</param>
        /// <returns>The GM representation of the <paramref name="geometry" /> in string.</returns>
        private static String CreateGMString(IMultiLineString geometry, Boolean isRoot = false)
        {
            StringBuilder builder = new StringBuilder();

            if (isRoot)
            {
                builder.Append(@"<gml:MultiLineString xmlns:gml=""http://www.opengis.net/gml"">");
            }
            else
            {
                builder.Append("<gml:MultiLineString>");
            }
            for (int i = 0; i < geometry.Count(); ++i)
            {
                builder.Append("<gml:LineStringMember>");
                builder.Append(CreateGMString(geometry[i] as ILineString));
                builder.Append("</gml:LineStringMember>");
            }
            builder.Append("</gml:MultiLineString>");

            return(builder.ToString());
        }