Exemple #1
0
        /// <summary>
        /// Parses series of polygons.
        /// </summary>
        /// <param name="tokens">The list of tokens.</param>
        /// <param name="is3D">bool value indicating whether polygon being parsed has z-coordinate.</param>
        /// <param name="isMeasured">bool value indicating whether polygon being parsed has m-value.</param>
        /// <returns>A list of polygons specified by tokens.</returns>
        private static IEnumerable <Polygon> ParsePolygons(WktTokensBuffer tokens, bool is3D, bool isMeasured)
        {
            List <Polygon> polygons = new List <Polygon>();

            polygons.Add(WktReader.ParsePolygonText(tokens, is3D, isMeasured));

            WktToken t = tokens.Peek(true);

            while (t.Type == TokenType.COMMA)
            {
                tokens.GetToken(true);
                polygons.Add(WktReader.ParsePolygonText(tokens, is3D, isMeasured));
                t = tokens.Peek(true);
            }

            return(polygons);
        }
Exemple #2
0
        /// <summary>
        /// Parses a polygon tagged text.
        /// </summary>
        /// <param name="tokens">The list of tokens.</param>
        /// <returns>A polygon specified by tokens.</returns>
        /// <remarks><![CDATA[<polygon tagged text> ::=  polygon {z}{m} <polygon text>]]></remarks>
        private static Polygon ParsePolygonTaggedText(WktTokensBuffer tokens)
        {
            WktReader.Expect("polygon", tokens);
            WktReader.Expect(TokenType.WHITESPACE, tokens);

            bool is3D       = false;
            bool isMeasured = false;

            WktToken t = tokens.Peek(true);

            if (WktReader.TryParseDimensions(t, out is3D, out isMeasured))
            {
                tokens.GetToken(true);
                WktReader.Expect(TokenType.WHITESPACE, tokens);
            }

            return(WktReader.ParsePolygonText(tokens, is3D, isMeasured));
        }