NullReferenceException with simple MapCss
aafloy opened this issue · 0 comments
aafloy commented
I'm trying to construct my own mapcss file, and I'm having problems with loading this with OsmSharp. The parsing itself is fine (since I get a cssfile from the code below), but the interpreter is returning a NullReferenceException (se below). I've worked around this issue by removing the generic way css clause, but this should work fine though?
Example code:
var cssfile = OsmSharp.UI.Map.Styles.MapCSS.v0_2.Domain.MapCSSFile.FromString(mapcss);
var geometryInterpreter = new OsmSharp.Osm.Interpreter.SimpleGeometryInterpreter();
var interpreter = new OsmSharp.UI.Map.Styles.MapCSS.MapCSSInterpreter(cssfile,
new OsmSharp.UI.Map.Styles.MapCSS.MapCSSDictionaryImageSource(), geometryInterpreter);
MapCss file:
canvas {
background-color: white;
default-points: false;
default-lines: false;
}
way {
color: black;
width: 1;
}
way[highway=motorway] {
color: orange;
}
Exception stack trace for the NullReferenceException:
at OsmSharp.UI.Map.Styles.MapCSS.v0_2.Domain.SelectorRuleTagValueComparison.AddRelevantKeysTo(ICollection`1 relevantKeys)
at OsmSharp.UI.Map.Styles.MapCSS.MapCSSInterpreter.PrepareForProcessing()
at OsmSharp.UI.Map.Styles.MapCSS.MapCSSInterpreter..ctor(MapCSSFile mapCSSFile, IMapCSSImageSource imageSource, GeometryInterpreter geometryInterpreter)
at RenderTest.Form1..ctor() in K:\Testing\RenderTest\RenderTest\Form1.cs:line 80
at RenderTest.Program.Main() in K:\Testing\RenderTest\RenderTest\Program.cs:line 21