예제 #1
0
        /// <summary>
        /// Parses multiple LineStrings separated by comma.
        /// </summary>
        /// <param name="tokens">The list of tokens.</param>
        /// <param name="is3D">bool value indicating whether linestring being parsed had z-coordinate.</param>
        /// <param name="isMeasured">bool value indicating whether linestring being parsed has m-value.</param>
        /// <returns>A list of linestrings specified by tokens.</returns>
        private static List <LineString> ParseLineStrings(WktTokensBuffer tokens, bool is3D, bool isMeasured)
        {
            List <LineString> linestrigns = new List <LineString>();

            linestrigns.Add(WktReader.ParseLineStringText(tokens, is3D, isMeasured));

            WktToken t = tokens.Peek(true);

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

            return(linestrigns);
        }
예제 #2
0
        /// <summary>
        /// Parses a linestring tagged text.
        /// </summary>
        /// <param name="tokens">The list of tokens.</param>
        /// <returns>A linestring specified by tokens.</returns>
        /// <remarks><![CDATA[<linestring tagged text> ::=  linestring {z}{m} <linestring text>]]></remarks>
        private static LineString ParseLineStringTaggedText(WktTokensBuffer tokens)
        {
            WktReader.Expect("linestring", 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.ParseLineStringText(tokens, is3D, isMeasured));
        }