Exemplo n.º 1
0
        public void UsingObjectInMoreThanOneRelation()
        {
            osmObjectMother
            .AddRelation()
            .Tag("type", "route")
            .AddWay(5)
            .AddToRelation("dictator");

            long wayId = osmObjectMother.CurrentObject.ObjectId;

            // add the way to another relation
            osmObjectMother
            .AddRelation()
            .Tag("type", "somethingelse")
            .SelectWay(wayId)
            .AddToRelation("otherrole");

            RenderingRulesMother rulesMother =
                new RenderingRulesMother()
                .AddLineRule()
                .AddRelationSelectors("type", "route")
                .AddLineRule()
                .AddRelationSelectors("type", "somethingelse");

            OsmDataSource osmFile = new OsmDataSource(testDataProvider, SerializersRegistry);

            string mapContent = GenerateMap(rulesMother, osmFile);

            Assert.AreEqual(2, GetCountOf(mapContent, "[POLYLINE]"));
        }
Exemplo n.º 2
0
        public void Multipolygon()
        {
            RenderingRulesMother rulesMother =
                new RenderingRulesMother()
                .AddAreaRule()
                .AddSelectors("{{tag|natural|water}}");

            OsmDataSource osmFile = new OsmDataSource(
                new OsmFileData(@"..\..\..\..\Data\Samples\KosmosProjects\Bled\Bled.osm", FileSystem), SerializersRegistry);

            string mapContent = GenerateMap(rulesMother, osmFile);

            Assert.AreEqual(1, GetCountOf(mapContent, "[POLYGON]"));
            Assert.AreEqual(2, GetCountOf(mapContent, "Data"));
        }
Exemplo n.º 3
0
        private string GenerateMap(RenderingRulesMother rulesMother, OsmDataSource osmFile)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                polishMapFileCreator.Expect(c => c.CreatePolishMapFile()).Return(stream);

                settings.RenderingRules = rulesMother.Rules;

                osmFile.AnalyzeData(settings);
                osmFile.GeneratePolishMapFiles(runner, polishMapFileCreator);

                string mapContent = GetMapContentFromStream(stream);
                return(mapContent);
            }
        }
Exemplo n.º 4
0
        public void IfBackgroundColorIsSetThenRenderBackgroundPolygon()
        {
            osmObjectMother
            .AddNode()
            .AddNode()
            .AddNode();

            RenderingRulesMother rulesMother =
                new RenderingRulesMother()
                .SetOptions(o => o.LandBackgroundColor  = new GisColor(0x218CFF))
                .SetOptions(o => o.ForceBackgroundColor = true);

            OsmDataSource osmFile = new OsmDataSource(testDataProvider, SerializersRegistry);

            string mapContent = GenerateMap(rulesMother, osmFile);

            Assert.AreEqual(1, GetCountOf(mapContent, "[POLYGON]"));
        }
Exemplo n.º 5
0
        public void RenderCycleRouteRelation()
        {
            osmObjectMother
            .AddRelation()
            .Tag("type", "route")
            .AddWay(5)
            .AddToRelation("dictator");

            RenderingRulesMother rulesMother =
                new RenderingRulesMother()
                .AddLineRule()
                .AddRelationSelectors("type", "route");

            OsmDataSource osmFile = new OsmDataSource(testDataProvider, SerializersRegistry);

            string mapContent = GenerateMap(rulesMother, osmFile);

            Assert.AreEqual(1, GetCountOf(mapContent, "[POLYLINE]"));
        }
Exemplo n.º 6
0
        public void MixedModeSelector()
        {
            osmObjectMother
            .AddRelation()
            .Tag("type", "route")
            .AddWay(5)
            .Tag("highway", "footway")
            .AddToRelation("dictator")
            .AddWay(5)
            .Tag("highway", "footway");

            RenderingRulesMother rulesMother =
                new RenderingRulesMother()
                .AddLineRule()
                .AddSelectors("relation:{{tag|type|route}} or {{tag|highway|footway}}");

            OsmDataSource osmFile = new OsmDataSource(testDataProvider, SerializersRegistry);

            string mapContent = GenerateMap(rulesMother, osmFile);

            Assert.AreEqual(2, GetCountOf(mapContent, "[POLYLINE]"));
        }