Exemple #1
0
        /// <summary>
        /// Parses multiple Points separated by comma.
        /// </summary>
        /// <param name="tokens">The list of tokens.</param>
        /// <param name="is3D">bool value indicating whether point being parsed had z-coordinate.</param>
        /// <param name="isMeasured">bool value indicating whether point being parsed has m-value.</param>
        /// <returns>A list of point specified by tokens.</returns>
        private static List <Point> ParsePoints(WktTokensBuffer tokens, bool is3D, bool isMeasured)
        {
            List <Point> points = new List <Point>();

            points.Add(WktReader.ParsePointText(tokens, is3D, isMeasured));

            WktToken t = tokens.Peek(true);

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

            return(points);
        }
Exemple #2
0
        /// <summary>
        /// Parses a point tagged text.
        /// </summary>
        /// <param name="tokens">The list of tokens.</param>
        /// <returns>A point specified by tokens.</returns>
        /// <remarks><![CDATA[Point tagged text format: <point tagged text> ::=  point {z}{m} <point text>]]></remarks>
        private static Point ParsePointTaggedText(WktTokensBuffer tokens)
        {
            WktReader.Expect("point", 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.ParsePointText(tokens, is3D, isMeasured));
        }