public void setInitialTagValueZoom(String tag, String val, int zoom, BinaryMapDataObject obj) { clearState(); object = obj; setIntFilter(ALL.R_MINZOOM, zoom); setIntFilter(ALL.R_MAXZOOM, zoom); setStringFilter(ALL.R_TAG, tag); setStringFilter(ALL.R_VALUE, val); }
public void setTagValueZoomLayer( String tag, String val, int zoom, int layer, BinaryMapDataObject obj) { object = obj; setIntFilter(ALL.R_MINZOOM, zoom); setIntFilter(ALL.R_MAXZOOM, zoom); setIntFilter(ALL.R_LAYER, layer); setStringFilter(ALL.R_TAG, tag); setStringFilter(ALL.R_VALUE, val); }
private void createTextDrawInfo( BinaryMapDataObject o, RenderingRuleSearchRequest render, RenderingContext rc, TagValuePair pair, float xMid, float yMid, Path path, PointF[] points, String name, String tagName) { render.setInitialTagValueZoom(pair.tag, pair.value, rc.zoom, o); render.setIntFilter(render.ALL.R_TEXT_LENGTH, name.length()); render.setStringFilter(render.ALL.R_NAME_TAG, tagName); if (render.search(RenderingRulesStorage.TEXT_RULES)) { if (render.getIntPropertyValue(render.ALL.R_TEXT_SIZE) > 0) { TextDrawInfo text = new TextDrawInfo(name); text.fillProperties(render, xMid, yMid); paintText.setTextSize(rc.getDensityValue(text.textSize)); Rect bs = new Rect(); paintText.getTextBounds(name, 0, name.length(), bs); text.bounds = new RectF(bs); text.bounds.inset(-rc.getDensityValue(3), -rc.getDensityValue(10)); boolean display = true; if (path != null) { text.drawOnPath = path; display = calculatePathToRotate( rc, text, points, render.getIntPropertyValue(render.ALL.R_TEXT_ON_PATH, 0) != 0); } if (text.drawOnPath == null) { text.bounds.offset(text.centerX, text.centerY); // shift to match alignment text.bounds.offset(-text.bounds.width() / 2, 0); } else { text.bounds.offset( text.centerX - text.bounds.width() / 2, text.centerY - text.bounds.height() / 2); } if (display) { rc.textToDraw.add(text); } } } }
private void drawPolyline( BinaryMapDataObject obj, RenderingRuleSearchRequest render, Canvas canvas, RenderingContext rc, TagValuePair pair, int layer, boolean drawOnlyShadow) { if (render == null || pair == null) { return; } int length = obj.getPointsLength(); if (length < 2) { return; } render.setInitialTagValueZoom(pair.tag, pair.value, rc.zoom, obj); render.setIntFilter(render.ALL.R_LAYER, layer); boolean rendered = render.search(RenderingRulesStorage.LINE_RULES); if (!rendered || !updatePaint(render, paint, 0, false, rc)) { return; } int oneway = 0; if (rc.zoom >= 16 && "highway".equals(pair.tag)) { // $NON-NLS-1$ if (obj.containsAdditionalType(obj.getMapIndex().onewayAttribute)) { oneway = 1; } else if (obj.containsAdditionalType(obj.getMapIndex().onewayReverseAttribute)) { oneway = -1; } } rc.visible++; Path path = null; float xMid = 0; float yMid = 0; int middle = obj.getPointsLength() / 2; PointF[] textPoints = null; if (!drawOnlyShadow) { textPoints = new PointF[length]; } for (int i = 0; i < length; i++) { PointF p = calcPoint(obj, i, rc); if (textPoints != null) { textPoints[i] = new PointF(p.x, p.y); } if (path == null) { path = new Path(); path.moveTo(p.x, p.y); } else { if (i == middle) { xMid = p.x; yMid = p.y; } path.lineTo(p.x, p.y); } } if (path != null) { if (drawOnlyShadow) { int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR); int shadowRadius = render.getIntPropertyValue(render.ALL.R_SHADOW_RADIUS); if (shadowColor == 0) { shadowColor = rc.shadowRenderingColor; } drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius); } else { boolean update = false; if (updatePaint(render, paint, -2, false, rc)) { update = true; canvas.drawPath(path, paint); } if (updatePaint(render, paint, -1, false, rc)) { update = true; canvas.drawPath(path, paint); } if (update) { updatePaint(render, paint, 0, false, rc); } canvas.drawPath(path, paint); if (updatePaint(render, paint, 1, false, rc)) { canvas.drawPath(path, paint); } if (updatePaint(render, paint, 2, false, rc)) { canvas.drawPath(path, paint); } } if (oneway != 0 && !drawOnlyShadow) { Paint[] paints = oneway == -1 ? getReverseOneWayPaints() : getOneWayPaints(); for (int i = 0; i < paints.length; i++) { canvas.drawPath(path, paints[i]); } } if (textPoints != null) { textRenderer.renderText(obj, render, rc, pair, xMid, yMid, path, textPoints); } } }