public void TestRelationMultipolygonAreaOneOuter()
        {
            // tests a multipolygon containing one 'outer' member.
            var source = new MemorySnapshotDb(
                new Node()
            {
                Id        = 1,
                Latitude  = 0,
                Longitude = 0
            },
                new Node()
            {
                Id        = 2,
                Latitude  = 1,
                Longitude = 0
            },
                new Node()
            {
                Id        = 3,
                Latitude  = 0,
                Longitude = 1
            },
                new Way()
            {
                Id    = 1,
                Nodes = new long[]
                {
                    1, 2, 3, 1
                }
            },
                new Relation()
            {
                Id   = 1,
                Tags = new TagsCollection(
                    new Tag("type", "multipolygon")),
                Members = new RelationMember[]
                {
                    new RelationMember()
                    {
                        Id   = 1,
                        Role = "outer",
                        Type = OsmGeoType.Way
                    }
                }
            }).CreateSnapshotDb();

            var interpreter = new DefaultFeatureInterpreter();
            var features    = interpreter.Interpret(source.GetRelation(1), source);

            Assert.IsNotNull(features);
            Assert.AreEqual(1, features.Count);
            var feature = features[0];

            Assert.IsInstanceOf <LinearRing>(feature.Geometry);
            Assert.IsTrue(feature.Attributes.Contains("type", "multipolygon"));
        }
        public void TestRelationMultipolygonAreaOneOuterTwoPartialInners()
        {
            var source = new MemorySnapshotDb(
                new Node()
            {
                Id        = 1,
                Latitude  = 0,
                Longitude = 0
            },
                new Node()
            {
                Id        = 2,
                Latitude  = 0,
                Longitude = 1
            },
                new Node()
            {
                Id        = 3,
                Latitude  = 1,
                Longitude = 1
            },
                new Node()
            {
                Id        = 4,
                Latitude  = 1,
                Longitude = 0
            },
                new Node()
            {
                Id        = 5,
                Latitude  = 0.25f,
                Longitude = 0.25f
            },
                new Node()
            {
                Id        = 6,
                Latitude  = 0.25f,
                Longitude = 0.40f
            },
                new Node()
            {
                Id        = 7,
                Latitude  = 0.40f,
                Longitude = 0.40f
            },
                new Node()
            {
                Id        = 8,
                Latitude  = 0.40f,
                Longitude = 0.25f
            },
                new Way()
            {
                Id    = 1,
                Nodes = new long[]
                {
                    1, 2, 3, 4, 1
                }
            },
                new Way()
            {
                Id    = 2,
                Nodes = new long[]
                {
                    5, 6, 7
                }
            },
                new Way()
            {
                Id    = 3,
                Nodes = new long[]
                {
                    7, 8, 5
                }
            },
                new Relation()
            {
                Id   = 1,
                Tags = new TagsCollection(
                    new Tag("type", "multipolygon")),
                Members = new RelationMember[]
                {
                    new RelationMember()
                    {
                        Id   = 1,
                        Role = "outer",
                        Type = OsmGeoType.Way
                    },
                    new RelationMember()
                    {
                        Id   = 2,
                        Role = "inner",
                        Type = OsmGeoType.Way
                    },
                    new RelationMember()
                    {
                        Id   = 3,
                        Role = "inner",
                        Type = OsmGeoType.Way
                    }
                }
            }).CreateSnapshotDb();

            var interpreter = new DefaultFeatureInterpreter();
            var features    = interpreter.Interpret(source.GetRelation(1), source);

            Assert.IsNotNull(features);
            Assert.AreEqual(1, features.Count);
            var feature = features[0];

            Assert.IsInstanceOf <Polygon>(feature.Geometry);
            Polygon polygon = feature.Geometry as Polygon;

            Assert.IsNotNull(polygon.Holes);
            Assert.AreEqual(1, polygon.Holes.Count());
            Assert.IsTrue(feature.Attributes.Contains("type", "multipolygon"));
        }