Exemplo n.º 1
0
        public void BuildLabelWithRelationTagsAndConditionals()
        {
            const string expression = @"relation:name ""blabla""";

            LabelExpressionParser parser           = new LabelExpressionParser();
            LabelExpression       parsedExpression = parser.Parse(expression, 0);

            OsmObjectMother mother = new OsmObjectMother();

            mother
            .AddRelation();

            MapMakerSettings mapMakerSettings = new MapMakerSettings();
            string           label            = parsedExpression.BuildLabel(mapMakerSettings, mother.CurrentObject, mother.CurrentRelation);

            Assert.AreEqual(String.Empty, label);
        }
Exemplo n.º 2
0
        public void BuildVariousLabels(string labelExpression, string expectedLabel)
        {
            LabelExpressionParser parser           = new LabelExpressionParser();
            LabelExpression       parsedExpression = parser.Parse(labelExpression, 0);

            OsmObjectMother mother = new OsmObjectMother();

            mother
            .AddRelation()
            .Tag("name", "Relation")
            .AddWay(5)
            .Tag("name", "Way")
            .AddToRelation("friend");

            MapMakerSettings mapMakerSettings = new MapMakerSettings();
            string           label            = parsedExpression.BuildLabel(mapMakerSettings, mother.CurrentObject, mother.CurrentRelation);

            Assert.AreEqual(expectedLabel, label);
        }
Exemplo n.º 3
0
        public void BuildLabelWithRelationTags()
        {
            const string expression = @"relation:name ++ name";

            LabelExpressionParser parser           = new LabelExpressionParser();
            LabelExpression       parsedExpression = parser.Parse(expression, 0);

            OsmObjectMother mother = new OsmObjectMother();

            mother
            .AddRelation()
            .Tag("name", "My name is Relation")
            .AddWay(5)
            .Tag("name", "My name is Way")
            .AddToRelation("friend");

            MapMakerSettings mapMakerSettings = new MapMakerSettings();
            string           label            = parsedExpression.BuildLabel(mapMakerSettings, mother.CurrentObject, mother.CurrentRelation);

            Assert.AreEqual("My name is RelationMy name is Way", label);
        }