示例#1
0
        public void APITestDeleteBoundingBox()
        {
            // intialize the connection.
            APIConnection api_instance = new APIConnection("http://api06.dev.openstreetmap.org/",
                "osmsharp", "osmsharp");

            // get all objects in the box.
            GeoCoordinateBox box = new GeoCoordinateBox(new GeoCoordinate(-0.494497, -24.119325),
                new GeoCoordinate(-0.494497, -24.119325));
            box = box.Resize(0.001f); // create a box around the usual test coordinates.
            List<SimpleOsmGeo> box_objects = api_instance.BoundingBoxGet(box);

            // delete all objects.
            long changeset_id = api_instance.ChangeSetOpen("delete test objects again");

            foreach (SimpleOsmGeo geo_object in box_objects)
            {
                switch(geo_object.Type)
                {
                    case SimpleOsmGeoType.Relation:
                        api_instance.RelationDelete(geo_object as SimpleRelation);
                        break;
                }
            }

            foreach (SimpleOsmGeo geo_object in box_objects)
            {
                switch (geo_object.Type)
                {
                    case SimpleOsmGeoType.Way:
                        api_instance.WayDelete(geo_object as SimpleWay);
                        break;
                }
            }

            foreach (SimpleOsmGeo geo_object in box_objects)
            {
                switch (geo_object.Type)
                {
                    case SimpleOsmGeoType.Node:
                        api_instance.NodeDelete(geo_object as SimpleNode);
                        break;
                }
            }
        }