public void traverseRules(Rule.RuleVisitor visitor) { for (Rule rule : this.rulesList) { rule.apply(visitor); } }
void destroy() { for (RenderInstruction ri : this.renderInstructions) { ri.destroy(); } for (Rule sr : this.subRules) { sr.destroy(); } }
void matchNode(RenderCallback renderCallback, final RenderContext renderContext, List<RenderInstruction> matchingList, PointOfInterest pointOfInterest) { if (matchesNode(pointOfInterest.tags, renderContext.rendererJob.tile.zoomLevel)) { for (int i = 0, n = this.renderInstructions.size(); i < n; ++i) { this.renderInstructions.get(i).renderNode(renderCallback, renderContext, pointOfInterest); matchingList.add(this.renderInstructions.get(i)); } for (int i = 0, n = this.subRules.size(); i < n; ++i) { this.subRules.get(i).matchNode(renderCallback, renderContext, matchingList, pointOfInterest); } } }
void matchWay(RenderCallback renderCallback, PolylineContainer way, Tile tile, Closed closed, List<RenderInstruction> matchingList, final RenderContext renderContext) { if (matchesWay(way.getTags(), tile.zoomLevel, closed)) { for (int i = 0, n = this.renderInstructions.size(); i < n; ++i) { this.renderInstructions.get(i).renderWay(renderCallback, renderContext, way); matchingList.add(this.renderInstructions.get(i)); } for (int i = 0, n = this.subRules.size(); i < n; ++i) { this.subRules.get(i).matchWay(renderCallback, way, tile, closed, matchingList, renderContext); } } }
Rule rule = new RuleBuilder(qName, pullParser, this.ruleStack).build(); if (!this.ruleStack.empty() && isVisible(rule)) { this.currentRule.addSubRule(rule); this.relativePathPrefix); if (isVisible(area)) { this.currentRule.addRenderingInstruction(area); Caption caption = new Caption(this.graphicFactory, this.displayModel, qName, pullParser, symbols); if (isVisible(caption)) { this.currentRule.addRenderingInstruction(caption); this.level++); if (isVisible(circle)) { this.currentRule.addRenderingInstruction(circle); this.relativePathPrefix); if (isVisible(line)) { this.currentRule.addRenderingInstruction(line); pullParser, this.relativePathPrefix); if (isVisible(lineSymbol)) { this.currentRule.addRenderingInstruction(lineSymbol); PathText pathText = new PathText(this.graphicFactory, this.displayModel, qName, pullParser); if (isVisible(pathText)) { this.currentRule.addRenderingInstruction(pathText); this.relativePathPrefix);
void complete() { this.rulesList.trimToSize(); this.hillShadings.trimToSize(); for (int i = 0, n = this.rulesList.size(); i < n; ++i) { this.rulesList.get(i).onComplete(); } }
void scaleStrokeWidth(float scaleFactor, byte zoomLevel) { for (int i = 0, n = this.renderInstructions.size(); i < n; ++i) { this.renderInstructions.get(i).scaleStrokeWidth(scaleFactor, zoomLevel); } for (int i = 0, n = this.subRules.size(); i < n; ++i) { this.subRules.get(i).scaleStrokeWidth(scaleFactor, zoomLevel); } }
private synchronized void matchWay(RenderCallback renderCallback, final RenderContext renderContext, Closed closed, PolylineContainer way) { MatchingCacheKey matchingCacheKey = new MatchingCacheKey(way.getTags(), way.getUpperLeft().zoomLevel, closed); List<RenderInstruction> matchingList = this.wayMatchingCache.get(matchingCacheKey); if (matchingList != null) { // cache hit for (int i = 0, n = matchingList.size(); i < n; ++i) { matchingList.get(i).renderWay(renderCallback, renderContext, way); } return; } // cache miss matchingList = new ArrayList<RenderInstruction>(); for (int i = 0, n = this.rulesList.size(); i < n; ++i) { this.rulesList.get(i).matchWay(renderCallback, way, way.getUpperLeft(), closed, matchingList, renderContext); } this.wayMatchingCache.put(matchingCacheKey, matchingList); }
/** * Matches a node with the given parameters against this RenderTheme. * * @param renderCallback the callback implementation which will be executed on each match. * @param renderContext * @param poi the point of interest. */ public synchronized void matchNode(RenderCallback renderCallback, final RenderContext renderContext, PointOfInterest poi) { MatchingCacheKey matchingCacheKey = new MatchingCacheKey(poi.tags, renderContext.rendererJob.tile.zoomLevel, Closed.NO); List<RenderInstruction> matchingList = this.poiMatchingCache.get(matchingCacheKey); if (matchingList != null) { // cache hit for (int i = 0, n = matchingList.size(); i < n; ++i) { matchingList.get(i).renderNode(renderCallback, renderContext, poi); } return; } // cache miss matchingList = new ArrayList<RenderInstruction>(); for (int i = 0, n = this.rulesList.size(); i < n; ++i) { this.rulesList.get(i).matchNode(renderCallback, renderContext, matchingList, poi); } this.poiMatchingCache.put(matchingCacheKey, matchingList); }
void matchWay(RenderCallback renderCallback, PolylineContainer way, Tile tile, Closed closed, List<RenderInstruction> matchingList, final RenderContext renderContext) { if (matchesWay(way.getTags(), tile.zoomLevel, closed)) { for (int i = 0, n = this.renderInstructions.size(); i < n; ++i) { this.renderInstructions.get(i).renderWay(renderCallback, renderContext, way); matchingList.add(this.renderInstructions.get(i)); } for (int i = 0, n = this.subRules.size(); i < n; ++i) { this.subRules.get(i).matchWay(renderCallback, way, tile, closed, matchingList, renderContext); } } }
Rule rule = new RuleBuilder(qName, pullParser, this.ruleStack).build(); if (!this.ruleStack.empty() && isVisible(rule)) { this.currentRule.addSubRule(rule); this.relativePathPrefix); if (isVisible(area)) { this.currentRule.addRenderingInstruction(area); Caption caption = new Caption(this.graphicFactory, this.displayModel, qName, pullParser, symbols); if (isVisible(caption)) { this.currentRule.addRenderingInstruction(caption); this.level++); if (isVisible(circle)) { this.currentRule.addRenderingInstruction(circle); this.relativePathPrefix); if (isVisible(line)) { this.currentRule.addRenderingInstruction(line); pullParser, this.relativePathPrefix); if (isVisible(lineSymbol)) { this.currentRule.addRenderingInstruction(lineSymbol); PathText pathText = new PathText(this.graphicFactory, this.displayModel, qName, pullParser); if (isVisible(pathText)) { this.currentRule.addRenderingInstruction(pathText); this.relativePathPrefix);
void onComplete() { MATCHERS_CACHE_KEY.clear(); MATCHERS_CACHE_VALUE.clear(); this.renderInstructions.trimToSize(); this.subRules.trimToSize(); for (int i = 0, n = this.subRules.size(); i < n; ++i) { this.subRules.get(i).onComplete(); } }
/** * Scales the stroke width of this RenderTheme by the given factor for a given zoom level * * @param scaleFactor the factor by which the stroke width should be scaled. * @param zoomLevel the zoom level to which this is applied. */ public synchronized void scaleStrokeWidth(float scaleFactor, byte zoomLevel) { if (!strokeScales.containsKey(zoomLevel) || scaleFactor != strokeScales.get(zoomLevel)) { for (int i = 0, n = this.rulesList.size(); i < n; ++i) { Rule rule = this.rulesList.get(i); if (rule.zoomMin <= zoomLevel && rule.zoomMax >= zoomLevel) { rule.scaleStrokeWidth(scaleFactor * this.baseStrokeWidth, zoomLevel); } } strokeScales.put(zoomLevel, scaleFactor); } }
private synchronized void matchWay(RenderCallback renderCallback, final RenderContext renderContext, Closed closed, PolylineContainer way) { MatchingCacheKey matchingCacheKey = new MatchingCacheKey(way.getTags(), way.getUpperLeft().zoomLevel, closed); List<RenderInstruction> matchingList = this.wayMatchingCache.get(matchingCacheKey); if (matchingList != null) { // cache hit for (int i = 0, n = matchingList.size(); i < n; ++i) { matchingList.get(i).renderWay(renderCallback, renderContext, way); } return; } // cache miss matchingList = new ArrayList<RenderInstruction>(); for (int i = 0, n = this.rulesList.size(); i < n; ++i) { this.rulesList.get(i).matchWay(renderCallback, way, way.getUpperLeft(), closed, matchingList, renderContext); } this.wayMatchingCache.put(matchingCacheKey, matchingList); }
/** * Matches a node with the given parameters against this RenderTheme. * * @param renderCallback the callback implementation which will be executed on each match. * @param renderContext * @param poi the point of interest. */ public synchronized void matchNode(RenderCallback renderCallback, final RenderContext renderContext, PointOfInterest poi) { MatchingCacheKey matchingCacheKey = new MatchingCacheKey(poi.tags, renderContext.rendererJob.tile.zoomLevel, Closed.NO); List<RenderInstruction> matchingList = this.poiMatchingCache.get(matchingCacheKey); if (matchingList != null) { // cache hit for (int i = 0, n = matchingList.size(); i < n; ++i) { matchingList.get(i).renderNode(renderCallback, renderContext, poi); } return; } // cache miss matchingList = new ArrayList<RenderInstruction>(); for (int i = 0, n = this.rulesList.size(); i < n; ++i) { this.rulesList.get(i).matchNode(renderCallback, renderContext, matchingList, poi); } this.poiMatchingCache.put(matchingCacheKey, matchingList); }
void matchNode(RenderCallback renderCallback, final RenderContext renderContext, List<RenderInstruction> matchingList, PointOfInterest pointOfInterest) { if (matchesNode(pointOfInterest.tags, renderContext.rendererJob.tile.zoomLevel)) { for (int i = 0, n = this.renderInstructions.size(); i < n; ++i) { this.renderInstructions.get(i).renderNode(renderCallback, renderContext, pointOfInterest); matchingList.add(this.renderInstructions.get(i)); } for (int i = 0, n = this.subRules.size(); i < n; ++i) { this.subRules.get(i).matchNode(renderCallback, renderContext, matchingList, pointOfInterest); } } }
void complete() { this.rulesList.trimToSize(); this.hillShadings.trimToSize(); for (int i = 0, n = this.rulesList.size(); i < n; ++i) { this.rulesList.get(i).onComplete(); } }
/** * Must be called when this RenderTheme gets destroyed to clean up and free resources. */ public void destroy() { this.poiMatchingCache.clear(); this.wayMatchingCache.clear(); for (Rule r : this.rulesList) { r.destroy(); } }
void scaleStrokeWidth(float scaleFactor, byte zoomLevel) { for (int i = 0, n = this.renderInstructions.size(); i < n; ++i) { this.renderInstructions.get(i).scaleStrokeWidth(scaleFactor, zoomLevel); } for (int i = 0, n = this.subRules.size(); i < n; ++i) { this.subRules.get(i).scaleStrokeWidth(scaleFactor, zoomLevel); } }
public void traverseRules(Rule.RuleVisitor visitor) { for (Rule rule : this.rulesList) { rule.apply(visitor); } }