private void SetGeometryProperties(Relation relation)
        {
            var relationHasInterestingTags = _tagClassifier.AreInteresting(relation.Tags, new Dictionary <string, object> {
                { "type", "anything" }
            }, false);

            relation.HasInterestingTags = relationHasInterestingTags;
            var outerCount = relation.Members.Count(m => m.Role == "outer");

            relation.IsSimpleMultiPolygon = outerCount == 1 && !relationHasInterestingTags;

            foreach (var member in relation.Members)
            {
                if (member.Type == "way")
                {
                    if (!relation.ResolvedWays.ContainsKey(member.Ref))
                    {
                        relation.IsGeometryIncomplete = true;
                        continue;
                    }
                    var way = relation.ResolvedWays[member.Ref];
                    way.IsReferencedByARelation = true;
                    var memberTags = way.Tags;
                    if (member.Role == "outer" && !_tagClassifier.AreInteresting(memberTags, relation.Tags))
                    {
                        way.IsMultipolygonOutline = true;
                    }
                    if (member.Role == "inner" && !_tagClassifier.AreInteresting(memberTags, relation.Tags))
                    {
                        way.IsMultipolygonOutline = true;
                    }
                    if (member.Role == "inner" && relation.ResolvedWays.Values.All(x => x.RoleInRelation != "outer"))
                    {
                        way.IsAnInnerWithoutAnOuter = true;
                    }
                    if (relation.IsSimpleMultiPolygon)
                    {
                        way.IsMultipolygonOutline = true;
                    }
                }
                if (member.Type == "node")// && !relation.IsMultiPolygon)
                {
                    // This relation won't be rendered as it's not tagged as a MultiPolygon, however thit node may be important
                    // so set this flag to force the node to be rendered
                    var node = relation.ResolvedNodes[member.Ref];
                    node.IsReferencedByARelation = true;
                }
            }

            if (relation.ResolvedWays.Values.Any(x => x.IsGeometryIncomplete) ||
                relation.ResolvedNodes.Values.Any(x => x.IsGeometryIncomplete))
            {
                relation.IsGeometryIncomplete = true;
            }
        }
 private void SetInterestingTags(IEnumerable <Node> nodes)
 {
     foreach (var node in nodes)
     {
         if (node.Tags != null && _tagClassifier.AreInteresting(node.Tags))
         {
             node.HasInterestingTags = true;
         }
     }
 }
Beispiel #3
0
 private void SetInterestingTags(IEnumerable <Way> ways)
 {
     foreach (var way in ways)
     {
         if (way.Tags != null && _tagClassifier.AreInteresting(way.Tags, way.Parent != null ? way.Parent.Tags : new Dictionary <string, object>()))
         {
             way.HasInterestingTags = true;
         }
     }
 }