Exemplo n.º 1
0
        public LineString ReadLineString(DimensionType dimension)
        {
            string[]   linePoints = readGroup('(', ')', m_buffer, ref m_currIndex).Split(',');
            LineString line       = new LineString();

            foreach (string pt in linePoints)
            {
                line.AddGeometry(ReadCoordinate(dimension, pt));
            }

            return(line);
        }
Exemplo n.º 2
0
        public MultiLineString ReadMultiLineString(DimensionType dimension)
        {
            string groups = readGroup('(', ')', m_buffer, ref m_currIndex);

            string[]        lines     = readSubGroups('(', ')', groups);
            MultiLineString multiLine = new MultiLineString();

            foreach (string line in lines)
            {
                LineString tmpLine = new LineString();
                string[]   points  = line.Replace("(", "").Replace(")", "").Split(',');
                foreach (string point in points)
                {
                    tmpLine.AddGeometry(ReadCoordinate(dimension, point));
                }
                multiLine.AddGeometry(tmpLine);
            }
            return(multiLine);
        }
Exemplo n.º 3
0
        public void CreateMultiLineString(DimensionType dimension, bool negative)
        {
            setupBase <MultiLineString>(dimension, GeometryType.MULTILINESTRING);

            int nlines = m_random.Next(1, 5);

            m_arr.AddBytes(intToBytes(nlines));

            //Create lines
            for (int i = 0; i < nlines; i++)
            {
                this.wkt  += "(";
                this.ewkt += "(";
                LineString tmpls = new LineString();

                int npoints = m_random.Next(2, 4);
                m_arr.AddBytes(intToBytes(npoints));
                for (int j = 0; j < npoints; j++)
                {
                    addCoordinate(dimension, out Point pt, negative);
                    tmpls.AddGeometry(pt);

                    if (j < npoints - 1)
                    {
                        this.wkt  += ",";
                        this.ewkt += ",";
                    }
                }

                (this.Validation as MultiLineString).AddGeometry(tmpls);

                if (i < nlines - 1)
                {
                    this.wkt  += "),";
                    this.ewkt += "),";
                }
            }

            this.wkt       += "))";
            this.ewkt      += "))";
            this.wkb_big    = m_arr.BigEndian.ToArray();
            this.wkb_little = m_arr.LittleEndian.ToArray();
        }
Exemplo n.º 4
0
        public LineString ReadLineString(DimensionType dimension)
        {
            //read the n points
            LineString line = new LineString();

            if (!canRead())
            {
                return(line);
            }

            int nPoints = ReadNextInt();

            for (int i = 0; i < nPoints; i++)
            {
                line.AddGeometry(ReadPoint(dimension));
            }

            return(line);
        }