static private int GetOsmObjectLayerNumber(OsmObjectBase osmObject) { if (osmObject.HasTag("layer")) { string layerString = osmObject.GetTagValue("layer"); try { int layer = int.Parse(layerString, System.Globalization.CultureInfo.InvariantCulture); return(layer); } // ignore invalid layer values catch (Exception) { } } // the default layer is 0 return(0); }
public void BuildLabel( MapMakerSettings mapMakerSettings, StringBuilder label, OsmObjectBase osmObject, OsmRelation parentRelation, Tag osmTag) { if (keyName.StartsWith("relation:", StringComparison.OrdinalIgnoreCase)) { string relationKeyName = keyName.Substring(9); if (parentRelation != null && parentRelation.HasTag(relationKeyName)) { // if there are no conditions attached, simply use the tag's value if (null == conditionalElement) { label.Append(parentRelation.GetTagValue(relationKeyName)); } else { // otherwise we must do some extra work conditionalElement.BuildLabel(mapMakerSettings, label, osmObject, parentRelation, parentRelation.GetTag(relationKeyName)); } } } else if (osmObject.HasTag(keyName)) { // if there are no conditions attached, simply use the tag's value if (null == conditionalElement) { label.Append(osmObject.GetTagValue(keyName)); } else { // otherwise we must do some extra work conditionalElement.BuildLabel(mapMakerSettings, label, osmObject, parentRelation, osmObject.GetTag(keyName)); } } }