internal static com.epl.geometry.Geometry PointTaggedText(int import_flags, com.epl.geometry.WktParser wkt_parser)
        {
            com.epl.geometry.Point point = new com.epl.geometry.Point();
            int current_token            = wkt_parser.NextToken();

            if (current_token == com.epl.geometry.WktParser.WktToken.attribute_z)
            {
                point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                wkt_parser.NextToken();
            }
            else
            {
                if (current_token == com.epl.geometry.WktParser.WktToken.attribute_m)
                {
                    point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                    wkt_parser.NextToken();
                }
                else
                {
                    if (current_token == com.epl.geometry.WktParser.WktToken.attribute_zm)
                    {
                        point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                        point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                        wkt_parser.NextToken();
                    }
                }
            }
            // At start of PointText
            current_token = wkt_parser.CurrentToken();
            if (current_token != com.epl.geometry.WktParser.WktToken.empty)
            {
                wkt_parser.NextToken();
                double x = wkt_parser.CurrentNumericLiteral();
                wkt_parser.NextToken();
                double y = wkt_parser.CurrentNumericLiteral();
                wkt_parser.NextToken();
                point.SetXY(x, y);
                if (wkt_parser.HasZs())
                {
                    double z = wkt_parser.CurrentNumericLiteral();
                    wkt_parser.NextToken();
                    point.SetZ(z);
                }
                if (wkt_parser.HasMs())
                {
                    double m = wkt_parser.CurrentNumericLiteral();
                    wkt_parser.NextToken();
                    point.SetM(m);
                }
            }
            return(point);
        }
        internal static int LineStringText(bool b_ring, com.epl.geometry.AttributeStreamOfDbl zs, com.epl.geometry.AttributeStreamOfDbl ms, com.epl.geometry.AttributeStreamOfDbl position, com.epl.geometry.AttributeStreamOfInt32 paths, com.epl.geometry.AttributeStreamOfInt8 path_flags
                                           , com.epl.geometry.WktParser wkt_parser)
        {
            // At start of LineStringText
            int current_token = wkt_parser.CurrentToken();
            int point_count   = 0;

            if (current_token == com.epl.geometry.WktParser.WktToken.empty)
            {
                return(point_count);
            }
            bool   b_start_path = true;
            double startx       = com.epl.geometry.NumberUtils.TheNaN;
            double starty       = com.epl.geometry.NumberUtils.TheNaN;
            double startz       = com.epl.geometry.NumberUtils.TheNaN;
            double startm       = com.epl.geometry.NumberUtils.TheNaN;

            current_token = wkt_parser.NextToken();
            while (current_token != com.epl.geometry.WktParser.WktToken.right_paren)
            {
                // At start of x
                double x = wkt_parser.CurrentNumericLiteral();
                wkt_parser.NextToken();
                double y = wkt_parser.CurrentNumericLiteral();
                wkt_parser.NextToken();
                double z = com.epl.geometry.NumberUtils.TheNaN;
                double m = com.epl.geometry.NumberUtils.TheNaN;
                if (wkt_parser.HasZs())
                {
                    z = wkt_parser.CurrentNumericLiteral();
                    wkt_parser.NextToken();
                }
                if (wkt_parser.HasMs())
                {
                    m = wkt_parser.CurrentNumericLiteral();
                    wkt_parser.NextToken();
                }
                current_token = wkt_parser.CurrentToken();
                bool b_add_point = true;
                if (b_ring && point_count >= 2 && current_token == com.epl.geometry.WktParser.WktToken.right_paren)
                {
                    // If the last point in the ring is not equal to the start
                    // point, then let's add it.
                    if ((startx == x || (com.epl.geometry.NumberUtils.IsNaN(startx) && com.epl.geometry.NumberUtils.IsNaN(x))) && (starty == y || (com.epl.geometry.NumberUtils.IsNaN(starty) && com.epl.geometry.NumberUtils.IsNaN(y))) && (!wkt_parser.HasZs() || startz == z || (com.epl.geometry.NumberUtils
                                                                                                                                                                                                                                                                                    .IsNaN(startz) && com.epl.geometry.NumberUtils.IsNaN(z))) && (!wkt_parser.HasMs() || startm == m || (com.epl.geometry.NumberUtils.IsNaN(startm) && com.epl.geometry.NumberUtils.IsNaN(m))))
                    {
                        b_add_point = false;
                    }
                }
                if (b_add_point)
                {
                    if (b_start_path)
                    {
                        b_start_path = false;
                        startx       = x;
                        starty       = y;
                        startz       = z;
                        startm       = m;
                    }
                    point_count++;
                    AddToStreams(zs, ms, position, x, y, z, m);
                }
            }
            if (point_count == 1)
            {
                point_count++;
                AddToStreams(zs, ms, position, startx, starty, startz, startm);
            }
            paths.Add(position.Size() / 2);
            path_flags.Add(unchecked ((byte)0));
            return(point_count);
        }