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); }
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); }
public void BuildElevationSample() { MapMakerSettings mapMakerSettings = new MapMakerSettings(); mapMakerSettings.CharactersConversionDictionary.AddConversion('Č', "C"); mapMakerSettings.CharactersConversionDictionary.AddConversion('č', "c"); const string expression = @"name ++ "" sdsd"" ++ ele "" ($1f$elevation)"""; LabelExpressionParser parser = new LabelExpressionParser(); LabelExpression parsedExpression = parser.Parse(expression, 0); OsmNode osmNode = new OsmNode(1, 10, 10); osmNode.SetTag("name", "Veliki vrh Čačka"); osmNode.SetTag("ele", "1433"); string label = parsedExpression.BuildLabel(mapMakerSettings, osmNode, null); Assert.AreEqual("Veliki vrh Cacka sdsd (~[0x1f]1433)", label); }
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); }