public void TestOneNodeOneWayAndOneRelation() { var ring = new LineairRing(new GeoCoordinate(0, -1), new GeoCoordinate(1, 1), new GeoCoordinate(-1, 1), new GeoCoordinate(0, -1)); var filter = new OsmStreamFilterPoly(ring); filter.RegisterSource(new OsmGeo[] { Node.Create(1, 0, 0), Way.Create(1, 1, 2), Relation.Create(1, new RelationMember() { MemberId = 1, MemberType = OsmGeoType.Node, MemberRole = string.Empty }) }); var list = new List <OsmGeo>( filter); Assert.AreEqual(3, list.Count); Assert.AreEqual(1, list[0].Id); Assert.AreEqual(OsmGeoType.Node, list[0].Type); Assert.AreEqual(1, list[1].Id); Assert.AreEqual(OsmGeoType.Way, list[1].Type); Assert.AreEqual(1, list[2].Id); Assert.AreEqual(OsmGeoType.Relation, list[2].Type); }
public void TestOneNode() { var ring = new LineairRing(new GeoCoordinate(0, -1), new GeoCoordinate(1, 1), new GeoCoordinate(-1, 1), new GeoCoordinate(0, -1)); var filter = new OsmStreamFilterPoly(ring); filter.RegisterSource(new OsmGeo[] { Node.Create(1, 0, 0), Node.Create(2, 10, 10) }); var list = new List <OsmGeo>( filter); Assert.AreEqual(1, list.Count); Assert.AreEqual(1, list[0].Id); }
public void TestNodeAfterWay() { var ring = new LineairRing(new GeoCoordinate(0, -1), new GeoCoordinate(1, 1), new GeoCoordinate(-1, 1), new GeoCoordinate(0, -1)); var filter = new OsmStreamFilterPoly(ring); filter.RegisterSource(new OsmGeo[] { Way.Create(1, 1, 2), Node.Create(2, 10, 10) }); Assert.Catch <OsmStreamNotSortedException>(() => { var list = new List <OsmGeo>( filter); }); }
public void TestGetMetaData() { var ring = new LineairRing(new GeoCoordinate(0, -1), new GeoCoordinate(1, 1), new GeoCoordinate(-1, 1), new GeoCoordinate(0, -1)); var source = (new OsmGeo[0]).ToOsmStreamSource(); source.Meta.Add("source", "enumeration"); var filter = new OsmStreamFilterPoly(ring); filter.RegisterSource(source); var meta = filter.GetAllMeta(); Assert.IsTrue(meta.ContainsKeyValue("source", "enumeration")); Assert.IsTrue(meta.ContainsKeyValue("poly", OsmSharp.Geo.Streams.GeoJson.GeoJsonConverter.ToGeoJson(ring))); }
public void TestWayAfterRelation() { var ring = new LineairRing(new GeoCoordinate(0, -1), new GeoCoordinate(1, 1), new GeoCoordinate(-1, 1), new GeoCoordinate(0, -1)); var filter = new OsmStreamFilterPoly(ring); filter.RegisterSource(new OsmGeo[] { Relation.Create(1, new RelationMember() { MemberId = 1, MemberType = OsmGeoType.Node, MemberRole = string.Empty }), Way.Create(1, 1, 2) }); Assert.Catch <OsmStreamNotSortedException>(() => { var list = new List <OsmGeo>( filter); }); }