Exemple #1
0
        /// <summary>
        /// Parses a linestring text.
        /// </summary>
        /// <param name="tokens">The list of tokens.</param>
        /// <param name="is3D">bool value indicating whether linestring being parsed has z-coordinate.</param>
        /// <param name="isMeasured">bool value indicating whether linestring being parsed has m-value.</param>
        /// <returns>A linestring specified by tokens.</returns>
        /// <remarks><![CDATA[<empty set> | <left paren> <point> {<comma> <point>}* <right paren>]]></remarks>
        private static LineString ParseLineStringText(WktTokensBuffer tokens, bool is3D, bool isMeasured)
        {
            WktToken t = tokens.Peek(true);

            if (t.Type == TokenType.STRING && t.Value.ToUpperInvariant() == "EMPTY")
            {
                tokens.GetToken(true);
                return(new LineString());
            }

            WktReader.Expect(TokenType.LEFT_PARENTHESIS, tokens);
            IEnumerable <Coordinate> coords = WktReader.ParseCoordinates(tokens, is3D, isMeasured);

            WktReader.Expect(TokenType.RIGHT_PARENTHESIS, tokens);

            return(new LineString(coords));
        }