Exemplo n.º 1
0
        private void MatchWay(RenderCallback renderCallback, RenderContext renderContext, Closed closed, PolylineContainer way)
        {
            lock (this)
            {
                MatchingCacheKey matchingCacheKey = new MatchingCacheKey(way.Tags, way.Tile.ZoomLevel, closed);

                IList <RenderInstruction> matchingList = this.wayMatchingCache.Get(matchingCacheKey);
                if (matchingList != null)
                {
                    // cache hit
                    for (int i = 0, n = matchingList.Count; i < n; ++i)
                    {
                        matchingList[i].RenderWay(renderCallback, renderContext, way);
                    }
                    return;
                }

                // cache miss
                matchingList = new List <RenderInstruction>();
                for (int i = 0, n = this.rulesList.Count; i < n; ++i)
                {
                    this.rulesList[i].MatchWay(renderCallback, way, way.Tile, closed, matchingList, renderContext);
                }

                this.wayMatchingCache.Add(matchingCacheKey, matchingList);
            }
        }
Exemplo n.º 2
0
 internal override bool MatchesWay(IList <Tag> tags, sbyte zoomLevel, Closed closed)
 {
     return(this.zoomMin <= zoomLevel && this.zoomMax >= zoomLevel && this.elementMatcher.Matches(Element.WAY) && this.closedMatcher.Matches(closed) && this.keyMatcher.Matches(tags) && this.valueMatcher.Matches(tags));
 }
Exemplo n.º 3
0
 internal virtual void MatchWay(RenderCallback renderCallback, PolylineContainer way, Tile tile, Closed closed, IList <RenderInstruction> matchingList, RenderContext renderContext)
 {
     if (MatchesWay(way.Tags, tile.ZoomLevel, closed))
     {
         for (int i = 0, n = this.renderInstructions.Count; i < n; ++i)
         {
             this.renderInstructions[i].RenderWay(renderCallback, renderContext, way);
             matchingList.Add(this.renderInstructions[i]);
         }
         for (int i = 0, n = this.subRules.Count; i < n; ++i)
         {
             this.subRules[i].MatchWay(renderCallback, way, tile, closed, matchingList, renderContext);
         }
     }
 }
Exemplo n.º 4
0
 public bool Matches(Closed closed)
 {
     return(true);
 }
Exemplo n.º 5
0
 internal abstract bool MatchesWay(IList <Tag> tags, sbyte zoomLevel, Closed closed);