/// <summary> /// Parses a multipolygon text. /// </summary> /// <param name="tokens">The list of tokens.</param> /// <param name="is3D">bool value indicating whether multipolygon being parsed has z-coordinate.</param> /// <param name="isMeasured">bool value indicating whether multipolygon being parsed has m-value.</param> /// <returns>A multipolygon specified by tokens.</returns> /// <remarks><![CDATA[<multipolygon text> ::= <empty set> | <left paren> <polygon text> {<comma> <polygon text>}* <right paren>]]></remarks> private static MultiPolygon ParseMultiPolygonText(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 MultiPolygon()); } WktReader.Expect(TokenType.LEFT_PARENTHESIS, tokens); MultiPolygon result = new MultiPolygon(WktReader.ParsePolygons(tokens, is3D, isMeasured)); WktReader.Expect(TokenType.RIGHT_PARENTHESIS, tokens); return(result); }