Ejemplo n.º 1
0
        public void APITestDeleteBoundingBox()
        {
            // intialize the connection.
            var apiInstance = new APIConnection("http://api06.dev.openstreetmap.org/",
                "osmsharp", "osmsharp");

            // get all objects in the box.
            var 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<OsmGeo> boxObjects = apiInstance.BoundingBoxGet(box);

            // delete all objects.
            apiInstance.ChangeSetOpen("delete test objects again");

            foreach (OsmGeo geoObject in boxObjects)
            {
                switch(geoObject.Type)
                {
                    case OsmGeoType.Relation:
                        apiInstance.RelationDelete(geoObject as Relation);
                        break;
                }
            }

            foreach (OsmGeo geoObject in boxObjects)
            {
                switch (geoObject.Type)
                {
                    case OsmGeoType.Way:
                        apiInstance.WayDelete(geoObject as Way);
                        break;
                }
            }

            foreach (OsmGeo geoObject in boxObjects)
            {
                switch (geoObject.Type)
                {
                    case OsmGeoType.Node:
                        apiInstance.NodeDelete(geoObject as Node);
                        break;
                }
            }
        }