Exemple #1
0
        public void CreateLineStringTest(DimensionType dimension, bool negative)
        {
            this.Type      = GeometryType.LINESTRING;
            this.Dimension = dimension;
            m_arr          = new BinaryArray();
            m_arr.AddBytes(intToBytes((int)this.Type + (int)dimension));

            this.wkt        = GeometryType.LINESTRING.ToString() + " " + dimension.WktEncode() + "(";
            this.ewkt       = "SRID=4326;" + this.Type.ToString() + " " + dimension.WktEncode() + "(";
            this.Validation = new LineString();

            int npoints = m_random.Next(2, Generator.MaxPoints);

            m_arr.AddBytes(intToBytes(npoints));

            for (int i = 0; i < npoints; i++)
            {
                addCoordinate(dimension, out Point pt, negative);
                (this.Validation as LineString).Points.Add(pt);

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

            this.wkt       += ")";
            this.ewkt      += ")";
            this.wkb_big    = m_arr.BigEndian.ToArray();
            this.wkb_little = m_arr.LittleEndian.ToArray();
        }
Exemple #2
0
        void setupBase <T>(DimensionType dimension, GeometryType geometry) where T : Geometry, new()
        {
            this.Type      = geometry;
            this.Dimension = dimension;
            m_arr          = new BinaryArray();
            m_arr.AddBytes(intToBytes((int)this.Type + (int)dimension));

            this.wkt        = geometry.ToString() + " " + dimension.WktEncode() + "(";
            this.ewkt       = "SRID=4326;" + this.Type.ToString() + " " + dimension.WktEncode() + "(";
            this.Validation = new T();
        }
Exemple #3
0
        public void CreateEmpty(GeometryType geometry, DimensionType dimension)
        {
            this.Type      = geometry;
            this.Dimension = dimension;

            //Array to store the byte form
            m_arr = new BinaryArray();
            m_arr.AddBytes(intToBytes((int)geometry + (int)dimension));

            this.wkt  = geometry.ToString() + " " + dimension.WktEncode() + " EMPTY";
            this.ewkt = "SRID=4326;" + geometry.ToString() + " " + dimension.WktEncode() + " EMPTY";

            this.wkb_big    = m_arr.BigEndian.ToArray();
            this.wkb_little = m_arr.LittleEndian.ToArray();

            this.Validation = Activator.CreateInstance(geometry.GetEquivalentType()) as Geometry;
        }
Exemple #4
0
        public void CreatePointTest(DimensionType dimension, bool negative)
        {
            this.Type      = GeometryType.POINT;
            this.Dimension = dimension;
            m_arr          = new BinaryArray();
            m_arr.AddBytes(intToBytes((int)this.Type + (int)dimension));

            this.wkt  = "POINT " + dimension.WktEncode() + "(";
            this.ewkt = "SRID=4326;" + this.Type.ToString() + " " + dimension.WktEncode() + "(";

            addCoordinate(dimension, out Point pt, negative);

            this.wkt       += ")";
            this.ewkt      += ")";
            this.wkb_big    = m_arr.BigEndian.ToArray();
            this.wkb_little = m_arr.LittleEndian.ToArray();

            Validation = pt;
        }