示例#1
0
        private void testGeometry()
        {
            MG_Point p = new MG_Point(100, 200);
            string type = p.Type.ToString();
            string wkt = p.AsWKT();
            string wkt_reduced = p.AsWKT_Reduced();
            byte[] wkb = p.AsWKB();

            MG_MultiPoint mp = new MG_MultiPoint();
            for (int i = 0; i < 10; i++)
            {
                MG_Point pp = new MG_Point(i, i);
                mp.Add(pp);
            }
            type = mp.Type.ToString();
            wkt = mp.AsWKT();
            wkt_reduced = mp.AsWKT_Reduced();
            wkb = mp.AsWKB();

            MG_LineString l = new MG_LineString();
            for (int i = 0; i < 10; i++)
            {
                MG_Point pp = new MG_Point(i, i);
                l.Add(pp);
            }
            type = l.Type.ToString();
            wkt = l.AsWKT();
            wkt_reduced = l.AsWKT_Reduced();
            wkb = l.AsWKB();

            MG_MultiLineString ml = new MG_MultiLineString();
            for (int i = 0; i < 5; i++)
            {
                MG_LineString l2 = new MG_LineString();
                for (int j = 0; j < 3; j++)
                {
                    MG_Point pp = new MG_Point(i, j);
                    l2.Add(pp);
                }
                ml.Add(l2);
            }
            type = ml.Type.ToString();
            wkt = ml.AsWKT();
            wkt_reduced = ml.AsWKT_Reduced();
            wkb = ml.AsWKB();

            MG_Polygon pg = new MG_Polygon();
            for (int i = 0; i < 5; i++)
            {
                MG_LineString l2 = new MG_LineString();
                for (int j = 0; j < 3; j++)
                {
                    MG_Point pp = new MG_Point(i, j);
                    l2.Add(pp);
                }
                pg.Add(l2);
            }
            type = pg.Type.ToString();
            wkt = pg.AsWKT();
            wkt_reduced = pg.AsWKT_Reduced();
            wkb = pg.AsWKB();
        }