/// <summary> /// Parses a point tagged text. /// </summary> /// <param name="tokens">The list of tokens.</param> /// <param name="is3D">bool value indicating whether point being parsed has z-coordinate.</param> /// <param name="isMeasured">bool value indicating whether point beeing parsed has m-value.</param> /// <returns>A point specified by tokens</returns> /// <remarks><![CDATA[<empty set> | <left paren> <point> <right paren> ]]></remarks> private static Point ParsePointText(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 Point()); } WktReader.Expect(TokenType.LEFT_PARENTHESIS, tokens); Point result = new Point(WktReader.ParseCoordinate(tokens, is3D, isMeasured)); WktReader.Expect(TokenType.RIGHT_PARENTHESIS, tokens); return(result); }
/// <summary> /// Parses a series of coordinate. /// </summary> /// <param name="tokens">The list of tokens.</param> /// <param name="is3D">bool value indicating whether coordinate being parsed had z-coordinate.</param> /// <param name="isMeasured">bool value indicating whether coordinate beeing parsed has m-value.</param> /// <returns>A list of coordinates specified by tokens.</returns> private static IEnumerable <Coordinate> ParseCoordinates(WktTokensBuffer tokens, bool is3D, bool isMeasured) { List <Coordinate> coordinates = new List <Coordinate>(); coordinates.Add(WktReader.ParseCoordinate(tokens, is3D, isMeasured)); WktToken t = tokens.Peek(true); while (t.Type == TokenType.COMMA) { tokens.GetToken(true); WktReader.Expect(TokenType.WHITESPACE, tokens); coordinates.Add(WktReader.ParseCoordinate(tokens, is3D, isMeasured)); t = tokens.Peek(true); } return(coordinates); }