implement rendering

git-svn-id: https://osmand.googlecode.com/svn/trunk@501 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-09-15 15:17:56 +00:00
parent 53d8e49c1d
commit 428fab7854
6 changed files with 440 additions and 342 deletions

View file

@ -54,11 +54,10 @@ public class MapRenderingTypes {
// TODO place text : (ref - shield) // TODO place text : (ref - shield)
// TODO coastline // TODO coastline
// TODO render : bridge (common way), tunnel, hw, railway : construction, proposed public final static int HIGHWAY = 1;
public final static int HIGHWAY = 1; //TODO REVIEW,traffic
public final static int BARRIER = 2; public final static int BARRIER = 2;
public final static int WATERWAY = 3; public final static int WATERWAY = 3;
public final static int RAILWAY = 4;//TODO RENDER public final static int RAILWAY = 4;
public final static int AEROWAY = 5; public final static int AEROWAY = 5;
public final static int AERIALWAY = 6; public final static int AERIALWAY = 6;
public final static int POWER = 7; public final static int POWER = 7;

View file

@ -30,6 +30,7 @@ import android.graphics.RectF;
import android.graphics.Shader; import android.graphics.Shader;
import android.graphics.Bitmap.Config; import android.graphics.Bitmap.Config;
import android.graphics.Paint.Align; import android.graphics.Paint.Align;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Style; import android.graphics.Paint.Style;
import android.graphics.Shader.TileMode; import android.graphics.Shader.TileMode;
import android.text.TextPaint; import android.text.TextPaint;
@ -38,9 +39,8 @@ import android.util.FloatMath;
public class OsmandRenderer implements Comparator<MapRenderObject> { public class OsmandRenderer implements Comparator<MapRenderObject> {
private static final Log log = LogUtil.getLog(OsmandRenderer.class); private static final Log log = LogUtil.getLog(OsmandRenderer.class);
private Paint paintStroke;
private TextPaint paintText; private TextPaint paintText;
private Paint paintFill; private Paint paint;
private Paint paintFillEmpty; private Paint paintFillEmpty;
private Paint paintIcon; private Paint paintIcon;
@ -48,11 +48,6 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
/// Colors /// Colors
private int clFillScreen = Color.rgb(241, 238, 232); private int clFillScreen = Color.rgb(241, 238, 232);
private PathEffect arrowDashEffect1 = new DashPathEffect(new float[] { 0, 12, 10, 152 }, 0);
private PathEffect arrowDashEffect2 = new DashPathEffect(new float[] { 0, 12, 9, 153 }, 1);
private PathEffect arrowDashEffect3 = new DashPathEffect(new float[] { 0, 18, 2, 154 }, 1);
private PathEffect arrowDashEffect4 = new DashPathEffect(new float[] { 0, 18, 1, 155 }, 1);
private Map<String, PathEffect> dashEffect = new LinkedHashMap<String, PathEffect>(); private Map<String, PathEffect> dashEffect = new LinkedHashMap<String, PathEffect>();
private Map<Integer, Shader> shaders = new LinkedHashMap<Integer, Shader>(); private Map<Integer, Shader> shaders = new LinkedHashMap<Integer, Shader>();
private Map<Integer, Bitmap> cachedIcons = new LinkedHashMap<Integer, Bitmap>(); private Map<Integer, Bitmap> cachedIcons = new LinkedHashMap<Integer, Bitmap>();
@ -100,34 +95,64 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
// use to calculate points // use to calculate points
PointF tempPoint = new PointF(); PointF tempPoint = new PointF();
// use to set rendering properties
int color = Color.BLACK;
// polyline props // polyline props
boolean showText = true; boolean showText = true;
PathEffect pathEffect = null;
int shadowLayer = 0;
int shadowColor = 0;
float strokeWidth = 0;
float secondStrokeWidth = 0; RenderingPaintProperties main = new RenderingPaintProperties();
int secondColor = 0; RenderingPaintProperties second = new RenderingPaintProperties();
PathEffect secondEffect = null; RenderingPaintProperties third = new RenderingPaintProperties();
RenderingPaintProperties[] adds = null;
// polygon props }
boolean showPolygon = true;
int colorAround = 0;
int widthAround = 1;
Shader shader = null;
/* package*/ static class RenderingPaintProperties {
int color;
float strokeWidth;
int shadowLayer;
int shadowColor;
boolean fillArea;
PathEffect pathEffect;
Shader shader;
Cap cap;
public void emptyLine(){
color = 0;
strokeWidth = 0;
cap = Cap.BUTT;
pathEffect = null;
fillArea = false;
shader = null;
shadowColor = 0;
shadowLayer = 0;
}
public void updatePaint(Paint p){
p.setStyle(fillArea ? Style.FILL_AND_STROKE : Style.STROKE);
p.setColor(color);
p.setShader(shader);
p.setShadowLayer(shadowLayer, 0, 0, shadowColor);
if (!fillArea) {
p.setStrokeCap(cap);
p.setPathEffect(pathEffect);
p.setStrokeWidth(strokeWidth);
}
}
public void emptyArea(){
color = 0;
strokeWidth = 0;
cap = Cap.BUTT;
fillArea = false;
shader = null;
pathEffect = null;
shadowColor = 0;
shadowLayer = 0;
}
} }
public OsmandRenderer(Context context){ public OsmandRenderer(Context context){
this.context = context; this.context = context;
paintStroke = new Paint();
paintStroke.setStyle(Style.STROKE);
paintStroke.setStrokeWidth(2);
paintStroke.setColor(Color.BLACK);
paintStroke.setAntiAlias(true);
paintIcon = new Paint(); paintIcon = new Paint();
paintIcon.setStyle(Style.STROKE); paintIcon.setStyle(Style.STROKE);
@ -138,11 +163,8 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
paintText.setTextAlign(Align.CENTER); paintText.setTextAlign(Align.CENTER);
paintText.setAntiAlias(true); paintText.setAntiAlias(true);
paintFill = new Paint(); paint = new Paint();
paintFill.setStyle(Style.FILL_AND_STROKE); paint.setAntiAlias(true);
paintFill.setStrokeWidth(2);
paintFill.setColor(Color.LTGRAY);
paintFill.setAntiAlias(true);
paintFillEmpty = new Paint(); paintFillEmpty = new Paint();
paintFillEmpty.setStyle(Style.FILL); paintFillEmpty.setStyle(Style.FILL);
@ -304,28 +326,23 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
return rc.tempPoint; return rc.tempPoint;
} }
private PointF drawPolygon(MapRenderObject obj, Canvas canvas, RenderingContext rc) { private PointF drawPolygon(MapRenderObject obj, Canvas canvas, RenderingContext rc) {
Paint paint = paintFill;
float xText = 0; float xText = 0;
float yText = 0; float yText = 0;
int zoom = rc.zoom; int zoom = rc.zoom;
Path path = null; Path path = null;
int type = MapRenderingTypes.getObjectType(obj.getType()); int type = MapRenderingTypes.getObjectType(obj.getType());
int subtype = MapRenderingTypes.getPolygonSubType(obj.getType()); int subtype = MapRenderingTypes.getPolygonSubType(obj.getType());
rc.color = Color.rgb(245, 245, 245); rc.main.emptyArea();
rc.shader = null; rc.second.emptyLine();
rc.colorAround = 0; rc.main.color = Color.rgb(245, 245, 245);
rc.showPolygon = true;
PolygonRenderer.renderPolygon(rc, zoom, type, subtype, this); PolygonRenderer.renderPolygon(rc, zoom, type, subtype, this);
if(!rc.showPolygon){ if(!rc.main.fillArea){
return null; return null;
} }
paint.setColor(rc.color);
for (int i = 0; i < obj.getPointsLength(); i++) { for (int i = 0; i < obj.getPointsLength(); i++) {
PointF p = calcPoint(obj, i, rc); PointF p = calcPoint(obj, i, rc);
xText += p.x; xText += p.x;
@ -341,13 +358,11 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
if (path != null) { if (path != null) {
xText /= obj.getPointsLength(); xText /= obj.getPointsLength();
yText /= obj.getPointsLength(); yText /= obj.getPointsLength();
paint.setShader(rc.shader); rc.main.updatePaint(paint);
canvas.drawPath(path, paint);
if(rc.second.strokeWidth != 0){
rc.second.updatePaint(paint);
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
if(rc.colorAround != 0){
paintStroke.setPathEffect(null);
paintStroke.setColor(rc.colorAround);
paintStroke.setStrokeWidth(1);
canvas.drawPath(path, paintStroke);
} }
String name = obj.getName(); String name = obj.getName();
if(name != null){ if(name != null){
@ -490,9 +505,13 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
private void drawPolyline(MapRenderObject obj, Canvas canvas, RenderingContext rc) { private void drawPolyline(MapRenderObject obj, Canvas canvas, RenderingContext rc) {
int type = MapRenderingTypes.getObjectType(obj.getType()); int type = MapRenderingTypes.getObjectType(obj.getType());
int subtype = MapRenderingTypes.getPolylineSubType(obj.getType()); int subtype = MapRenderingTypes.getPolylineSubType(obj.getType());
rc.main.emptyLine();
rc.second.emptyLine();
rc.third.emptyLine();
rc.adds = null;
PolylineRenderer.renderPolyline(type, subtype, obj.getType(), rc, this); PolylineRenderer.renderPolyline(type, subtype, obj.getType(), rc, this);
if(rc.strokeWidth == 0){ if(rc.main.strokeWidth == 0){
return; return;
} }
int length = obj.getPointsLength(); int length = obj.getPointsLength();
@ -539,32 +558,24 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
yPrev = p.y; yPrev = p.y;
} }
if (path != null) { if (path != null) {
paintStroke.setPathEffect(rc.pathEffect); rc.main.updatePaint(paint);
if(paintStroke.getShader() != null){ canvas.drawPath(path, paint);
paintStroke.setShader(null); if (rc.second.strokeWidth != 0) {
rc.second.updatePaint(paint);
canvas.drawPath(path, paint);
if (rc.third.strokeWidth != 0) {
rc.third.updatePaint(paint);
canvas.drawPath(path, paint);
} }
paintStroke.setShadowLayer(rc.shadowLayer, 0, 0, rc.shadowColor);
paintStroke.setColor(rc.color);
paintStroke.setStrokeWidth(rc.strokeWidth);
canvas.drawPath(path, paintStroke);
if (rc.secondStrokeWidth > 0) {
paintStroke.setPathEffect(rc.secondEffect);
paintStroke.setShader(null);
if (rc.shadowLayer != 0) {
paintStroke.setShadowLayer(0, 0, 0, 0);
} }
paintStroke.setColor(rc.secondColor); if (rc.adds != null) {
paintStroke.setStrokeWidth(rc.secondStrokeWidth); for (int i = 0; i < rc.adds.length; i++) {
canvas.drawPath(path, paintStroke); rc.adds[i].updatePaint(paint);
canvas.drawPath(path, paint);
} }
if(type == MapRenderingTypes.HIGHWAY && rc.zoom >= 16 && MapRenderingTypes.isOneWayWay(obj.getType())){
if (rc.shadowLayer != 0) {
paintStroke.setShadowLayer(0, 0, 0, 0);
}
drawOneWayDirections(canvas, path);
} }
if (obj.getName() != null && rc.showText) { if (obj.getName() != null && rc.showText) {
float w = rc.strokeWidth + 3; float w = rc.main.strokeWidth + 3;
if(w < 10){ if(w < 10){
w = 10; w = 10;
} }
@ -592,33 +603,13 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
text.drawOnPath = path; text.drawOnPath = path;
text.textColor = Color.BLACK; text.textColor = Color.BLACK;
text.textSize = w; text.textSize = w;
text.vOffset = rc.strokeWidth / 2 - 1; text.vOffset = rc.main.strokeWidth / 2 - 1;
rc.textToDraw.add(text); rc.textToDraw.add(text);
} }
} }
} }
} }
public void drawOneWayDirections(Canvas canvas, Path path){
paintStroke.setColor(0xff6c70d5);
paintStroke.setStrokeWidth(1);
paintStroke.setPathEffect(arrowDashEffect1);
canvas.drawPath(path, paintStroke);
paintStroke.setStrokeWidth(2);
paintStroke.setPathEffect(arrowDashEffect2);
canvas.drawPath(path, paintStroke);
paintStroke.setStrokeWidth(3);
paintStroke.setPathEffect(arrowDashEffect3);
canvas.drawPath(path, paintStroke);
paintStroke.setStrokeWidth(4);
paintStroke.setPathEffect(arrowDashEffect4);
canvas.drawPath(path, paintStroke);
}
} }

View file

@ -10,7 +10,8 @@ public class PointRenderer {
*/ */
public static int getPointBitmap(int zoom, int type, int subType) { public static int getPointBitmap(int zoom, int type, int subType) {
int resId = 0; int resId = 0;
if(type == MapRenderingTypes.HIGHWAY){ switch (type) {
case MapRenderingTypes.HIGHWAY: {
if (zoom >= 16) { if (zoom >= 16) {
if (subType == 38) { if (subType == 38) {
if (zoom > 16) { if (zoom > 16) {
@ -27,7 +28,9 @@ public class PointRenderer {
resId = R.drawable.h_mini_round; resId = R.drawable.h_mini_round;
} }
} }
} else if(type == MapRenderingTypes.RAILWAY){ }
break;
case MapRenderingTypes.RAILWAY: {
if (subType == 13) { if (subType == 13) {
if (zoom == 12) { if (zoom == 12) {
resId = R.drawable.h_halt; resId = R.drawable.h_halt;
@ -49,7 +52,9 @@ public class PointRenderer {
resId = R.drawable.h_level_crossing2; resId = R.drawable.h_level_crossing2;
} }
} }
} else if(type == MapRenderingTypes.AEROWAY){ }
break;
case MapRenderingTypes.AEROWAY: {
if (subType == 1) { if (subType == 1) {
if (zoom >= 10 && zoom <= 14) { if (zoom >= 10 && zoom <= 14) {
resId = R.drawable.h_aerodrome; resId = R.drawable.h_aerodrome;
@ -59,13 +64,17 @@ public class PointRenderer {
resId = R.drawable.h_airport; resId = R.drawable.h_airport;
} }
} }
} else if(type == MapRenderingTypes.WATERWAY){ }
break;
case MapRenderingTypes.WATERWAY: {
if (subType == 8) { if (subType == 8) {
if (zoom > 14) { if (zoom > 14) {
resId = R.drawable.h_lock_gate; resId = R.drawable.h_lock_gate;
} }
} }
} else if(type == MapRenderingTypes.AERIALWAY){ }
break;
case MapRenderingTypes.AERIALWAY: {
if (subType == 7) { if (subType == 7) {
if (zoom == 13 || zoom == 14) { if (zoom == 13 || zoom == 14) {
resId = R.drawable.h_halt; resId = R.drawable.h_halt;
@ -73,7 +82,9 @@ public class PointRenderer {
resId = R.drawable.h_station_small; resId = R.drawable.h_station_small;
} }
} }
} else if(type == MapRenderingTypes.POWER){ }
break;
case MapRenderingTypes.POWER: {
if (zoom > 14) { if (zoom > 14) {
if (subType == 1) { if (subType == 1) {
resId = R.drawable.h_power_tower; resId = R.drawable.h_power_tower;
@ -81,7 +92,9 @@ public class PointRenderer {
resId = R.drawable.h_power_wind; resId = R.drawable.h_power_wind;
} }
} }
} else if (type == MapRenderingTypes.MAN_MADE) { }
break;
case MapRenderingTypes.MAN_MADE: {
if (subType == 25) { if (subType == 25) {
if (zoom >= 16) { if (zoom >= 16) {
resId = R.drawable.h_tower_water; resId = R.drawable.h_tower_water;
@ -95,7 +108,9 @@ public class PointRenderer {
resId = R.drawable.h_windmill; resId = R.drawable.h_windmill;
} }
} }
} else if(type == MapRenderingTypes.SHOP){ }
break;
case MapRenderingTypes.SHOP: {
if (zoom > 15) { if (zoom > 15) {
switch (subType) { switch (subType) {
case 27: case 27:
@ -129,10 +144,11 @@ public class PointRenderer {
resId = R.drawable.h_shop_convenience; resId = R.drawable.h_shop_convenience;
break; break;
} }
} }
} else if(type == MapRenderingTypes.TOURISM){ }
break;
case MapRenderingTypes.TOURISM: {
if (zoom > 15) { if (zoom > 15) {
switch (subType) { switch (subType) {
case 4: case 4:
@ -166,7 +182,9 @@ public class PointRenderer {
break; break;
} }
} }
} else if(type == MapRenderingTypes.NATURAL){ }
break;
case MapRenderingTypes.NATURAL: {
if (subType == 13) { if (subType == 13) {
if (zoom > 10) { if (zoom > 10) {
resId = R.drawable.h_peak; resId = R.drawable.h_peak;
@ -186,7 +204,9 @@ public class PointRenderer {
resId = R.drawable.h_tree2; resId = R.drawable.h_tree2;
} }
} }
} else if(type == MapRenderingTypes.HISTORIC){ }
break;
case MapRenderingTypes.HISTORIC: {
if (zoom > 15) { if (zoom > 15) {
if (subType == 6) { if (subType == 6) {
resId = R.drawable.h_memorial; resId = R.drawable.h_memorial;
@ -196,7 +216,9 @@ public class PointRenderer {
} }
} }
} else if(type == MapRenderingTypes.BARRIER){ }
break;
case MapRenderingTypes.BARRIER: {
if (subType == 21) { if (subType == 21) {
if (zoom >= 15) { if (zoom >= 15) {
resId = R.drawable.h_gate2; resId = R.drawable.h_gate2;
@ -210,7 +232,9 @@ public class PointRenderer {
resId = R.drawable.h_bollard; resId = R.drawable.h_bollard;
} }
} }
} else if(type == MapRenderingTypes.EMERGENCY){ }
break;
case MapRenderingTypes.EMERGENCY: {
if (zoom > 15) { if (zoom > 15) {
if (subType == 10) { if (subType == 10) {
resId = R.drawable.h_firestation; resId = R.drawable.h_firestation;
@ -218,7 +242,9 @@ public class PointRenderer {
resId = R.drawable.h_sosphone; resId = R.drawable.h_sosphone;
} }
} }
} else if(type == MapRenderingTypes.AMENITY_SUSTENANCE){ }
break;
case MapRenderingTypes.AMENITY_SUSTENANCE: {
if (zoom > 15) { if (zoom > 15) {
switch (subType) { switch (subType) {
case 1: case 1:
@ -242,7 +268,9 @@ public class PointRenderer {
break; break;
} }
} }
} else if(type == MapRenderingTypes.AMENITY_EDUCATION){ }
break;
case MapRenderingTypes.AMENITY_EDUCATION: {
if (zoom > 15) { if (zoom > 15) {
if (subType == 2) { if (subType == 2) {
resId = R.drawable.h_school; resId = R.drawable.h_school;
@ -250,7 +278,9 @@ public class PointRenderer {
resId = R.drawable.h_library; resId = R.drawable.h_library;
} }
} }
} else if (type == MapRenderingTypes.AMENITY_TRANSPORTATION) { }
break;
case MapRenderingTypes.AMENITY_TRANSPORTATION: {
if (subType == 1 || subType == 2) { if (subType == 1 || subType == 2) {
if (zoom > 14) { if (zoom > 14) {
resId = R.drawable.h_parking; resId = R.drawable.h_parking;
@ -272,7 +302,9 @@ public class PointRenderer {
resId = R.drawable.h_bus_station; resId = R.drawable.h_bus_station;
} }
} }
} else if (type == MapRenderingTypes.AMENITY_FINANCE) { }
break;
case MapRenderingTypes.AMENITY_FINANCE: {
if (subType == 1) { if (subType == 1) {
if (zoom > 16) { if (zoom > 16) {
resId = R.drawable.h_atm; resId = R.drawable.h_atm;
@ -282,7 +314,9 @@ public class PointRenderer {
resId = R.drawable.h_bank; resId = R.drawable.h_bank;
} }
} }
} else if (type == MapRenderingTypes.AMENITY_HEALTHCARE) { }
break;
case MapRenderingTypes.AMENITY_HEALTHCARE: {
if (subType == 1) { if (subType == 1) {
if (zoom > 15) { if (zoom > 15) {
resId = R.drawable.h_pharmacy; resId = R.drawable.h_pharmacy;
@ -292,7 +326,9 @@ public class PointRenderer {
resId = R.drawable.h_hospital; resId = R.drawable.h_hospital;
} }
} }
} else if (type == MapRenderingTypes.AMENITY_ENTERTAINMENT) { }
break;
case MapRenderingTypes.AMENITY_ENTERTAINMENT: {
if (zoom >= 15) { if (zoom >= 15) {
if (subType == 3) { if (subType == 3) {
resId = R.drawable.h_cinema; resId = R.drawable.h_cinema;
@ -300,7 +336,9 @@ public class PointRenderer {
resId = R.drawable.h_theatre; resId = R.drawable.h_theatre;
} }
} }
} else if(type == MapRenderingTypes.AMENITY_OTHER){ }
break;
case MapRenderingTypes.AMENITY_OTHER: {
if (zoom > 16) { if (zoom > 16) {
switch (subType) { switch (subType) {
case 10: case 10:
@ -340,6 +378,7 @@ public class PointRenderer {
} }
} }
} }
}
return resId; return resId;
} }
} }

View file

@ -11,293 +11,298 @@ public class PolygonRenderer {
if (type == MapRenderingTypes.HIGHWAY) { if (type == MapRenderingTypes.HIGHWAY) {
if (subtype == MapRenderingTypes.PL_HW_SERVICE || subtype == MapRenderingTypes.PL_HW_UNCLASSIFIED if (subtype == MapRenderingTypes.PL_HW_SERVICE || subtype == MapRenderingTypes.PL_HW_UNCLASSIFIED
|| subtype == MapRenderingTypes.PL_HW_RESIDENTIAL) { || subtype == MapRenderingTypes.PL_HW_RESIDENTIAL) {
rc.colorAround = Color.rgb(194, 194, 194); rc.second.color = Color.rgb(194, 194, 194);
rc.color = Color.WHITE; rc.second.strokeWidth = 1;
rc.main.color= Color.WHITE;
} else if(subtype == MapRenderingTypes.PL_HW_PEDESTRIAN || subtype == MapRenderingTypes.PL_HW_FOOTWAY){ } else if(subtype == MapRenderingTypes.PL_HW_PEDESTRIAN || subtype == MapRenderingTypes.PL_HW_FOOTWAY){
rc.color = Color.rgb(236, 236, 236); rc.main.color = Color.rgb(236, 236, 236);
rc.colorAround = Color.rgb(176, 176, 176); rc.second.color = Color.rgb(176, 176, 176);
rc.second.strokeWidth = 1;
} }
} else if (type == MapRenderingTypes.RAILWAY) { } else if (type == MapRenderingTypes.RAILWAY) {
if(subtype == 13){ if(subtype == 13){
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.color = 0xffd4aaaa; rc.main.color = 0xffd4aaaa;
} }
} else if (type == MapRenderingTypes.WATERWAY) { } else if (type == MapRenderingTypes.WATERWAY) {
if(subtype == 3){ if(subtype == 3){
rc.showPolygon = zoom >= 7; rc.main.fillArea = zoom >= 7;
rc.color = 0xffb5d0d0; rc.main.color = 0xffb5d0d0;
} else if(subtype == 4 || subtype == 7 || subtype == 13){ } else if(subtype == 4 || subtype == 7 || subtype == 13){
rc.showPolygon = zoom >= 10; rc.main.fillArea = zoom >= 10;
rc.color = 0xffb5d0d0; rc.main.color = 0xffb5d0d0;
} }
} else if (type == MapRenderingTypes.AEROWAY) { } else if (type == MapRenderingTypes.AEROWAY) {
if(subtype == 1 || subtype == 10){ if(subtype == 1 || subtype == 10){
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0x80cccccc; rc.main.color = 0x80cccccc;
} else if(subtype == 2){ } else if(subtype == 2){
rc.showPolygon = zoom >= 15; rc.main.fillArea = zoom >= 15;
rc.color = 0xffcc99ff; rc.main.color = 0xffcc99ff;
} else if(subtype == 9){ } else if(subtype == 9){
// apron // apron
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.color = 0xffe9d1ff; rc.main.color = 0xffe9d1ff;
} }
} else if (type == MapRenderingTypes.POWER) { } else if (type == MapRenderingTypes.POWER) {
if(subtype == 5 || subtype == 6){ if(subtype == 5 || subtype == 6){
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.color = 0xffbbbbbb; rc.main.color = 0xffbbbbbb;
} }
} else if (type == MapRenderingTypes.MAN_MADE) { } else if (type == MapRenderingTypes.MAN_MADE) {
rc.showPolygon = zoom > 15; rc.main.fillArea = zoom > 15;
if (subtype == MapRenderingTypes.SUBTYPE_BUILDING) { if (subtype == MapRenderingTypes.SUBTYPE_BUILDING) {
rc.color = Color.rgb(188, 169, 169); rc.main.color = Color.rgb(188, 169, 169);
} else if (subtype == MapRenderingTypes.SUBTYPE_GARAGES) { } else if (subtype == MapRenderingTypes.SUBTYPE_GARAGES) {
rc.color = Color.rgb(221, 221, 221); rc.main.color = Color.rgb(221, 221, 221);
} }
} else if (type == MapRenderingTypes.TOURISM) { } else if (type == MapRenderingTypes.TOURISM) {
if (subtype == 2 || subtype == 7) { if (subtype == 2 || subtype == 7) {
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.color = 0xfff2caea; rc.main.color = 0xfff2caea;
if(subtype == 7){ if(subtype == 7){
rc.colorAround = 0xff734a08; rc.second.color = 0xff734a08;
rc.pathEffect = o.getDashEffect("9_3"); //$NON-NLS-1$ rc.second.pathEffect = o.getDashEffect("9_3"); //$NON-NLS-1$
if(zoom <= 15){ if(zoom <= 15){
rc.strokeWidth = 1; rc.second.strokeWidth = 1;
} else { } else {
rc.strokeWidth = 2; rc.second.strokeWidth = 2;
} }
} }
} else if(subtype >= 4 && subtype <= 6){ } else if(subtype >= 4 && subtype <= 6){
rc.showPolygon = zoom >= 15; rc.main.fillArea = zoom >= 15;
rc.color = 0xa0ccff99; rc.main.color = 0xa0ccff99;
} else if(subtype == 8){ } else if(subtype == 8){
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.shader = o.getShader(R.drawable.h_zoo); rc.main.shader = o.getShader(R.drawable.h_zoo);
} }
} else if (type == MapRenderingTypes.NATURAL) { } else if (type == MapRenderingTypes.NATURAL) {
switch(subtype){ switch(subtype){
case 2 : case 2 :
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.shader = o.getShader(R.drawable.h_beach); rc.main.shader = o.getShader(R.drawable.h_beach);
case 5: case 5:
// TODO coastline // TODO coastline
break; break;
case 7: case 7:
rc.showPolygon = zoom >= 8; rc.main.fillArea = zoom >= 8;
rc.shader = o.getShader(R.drawable.h_glacier); rc.main.shader = o.getShader(R.drawable.h_glacier);
if(zoom >= 10){ if(zoom >= 10){
rc.colorAround = 0xff99ccff; rc.second.color = 0xff99ccff;
rc.widthAround = 2; rc.second.strokeWidth = 2;
} }
break; break;
case 8: case 8:
rc.showPolygon = zoom >= 10; rc.main.fillArea = zoom >= 10;
rc.color = 0xffffffc0; rc.main.color = 0xffffffc0;
break; break;
case 9: case 9:
rc.showPolygon = zoom >= 11; rc.main.fillArea = zoom >= 11;
rc.color = 0xfff2efe9; rc.main.color = 0xfff2efe9;
break; break;
case 11: case 11:
case 22: case 22:
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.shader = o.getShader(R.drawable.h_marsh); rc.main.shader = o.getShader(R.drawable.h_marsh);
break; break;
case 12 : case 12 :
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.shader = o.getShader(R.drawable.h_mud); rc.main.shader = o.getShader(R.drawable.h_mud);
break; break;
case 16 : case 16 :
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.shader = o.getShader(R.drawable.h_scrub); rc.main.shader = o.getShader(R.drawable.h_scrub);
break; break;
case 21: case 21:
rc.showPolygon = zoom >= 7; rc.main.fillArea = zoom >= 7;
rc.color = 0xffb5d0d0; rc.main.color = 0xffb5d0d0;
break; break;
case 23 : case 23 :
rc.showPolygon = zoom >= 8; rc.main.fillArea = zoom >= 8;
rc.color = 0xffaed1a0; rc.main.color = 0xffaed1a0;
break; break;
} }
} else if (type == MapRenderingTypes.LANDUSE) { } else if (type == MapRenderingTypes.LANDUSE) {
switch (subtype) { switch (subtype) {
case 1: case 1:
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.color = 0xffc8b084; rc.main.color = 0xffc8b084;
break; break;
case 2: case 2:
rc.showPolygon = zoom >= 10; rc.main.fillArea = zoom >= 10;
rc.color = 0xffb5d0d0; rc.main.color = 0xffb5d0d0;
break; break;
case 4: case 4:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
if(zoom >= 12 && zoom <= 14){ if(zoom >= 12 && zoom <= 14){
rc.color = 0xffaacbaf; rc.main.color = 0xffaacbaf;
} else if (zoom > 14) { } else if (zoom > 14) {
rc.shader = o.getShader(R.drawable.h_grave_yard); rc.main.shader = o.getShader(R.drawable.h_grave_yard);
} }
break; break;
case 5: case 5:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xffefc8c8; rc.main.color = 0xffefc8c8;
break; break;
case 3: case 3:
case 6: case 6:
case 13: case 13:
case 16: case 16:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xff9d9d6c; rc.main.color = 0xff9d9d6c;
break; break;
case 7: case 7:
rc.showPolygon = zoom >= 11; rc.main.fillArea = zoom >= 11;
rc.color = 0xffead8bd; rc.main.color = 0xffead8bd;
break; break;
case 9: case 9:
rc.showPolygon = zoom >= 11; rc.main.fillArea = zoom >= 11;
rc.color = 0xffddbf92; rc.main.color = 0xffddbf92;
break; break;
case 10: case 10:
if(zoom < 8){ if(zoom < 8){
rc.showPolygon = false; rc.main.fillArea = false;
} else if(zoom <= 13){ } else if(zoom <= 13){
rc.color = 0xff8dc56c; rc.main.color = 0xff8dc56c;
} else { } else {
rc.shader = o.getShader(R.drawable.h_forest); rc.main.shader = o.getShader(R.drawable.h_forest);
} }
break; break;
case 11 : case 11 :
rc.color = Color.rgb(223, 209, 214); rc.main.color = Color.rgb(223, 209, 214);
break; break;
case 12: case 12:
case 17: case 17:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xffcfeca8; rc.main.color = 0xffcfeca8;
break; break;
case 15: case 15:
case 20: case 20:
rc.color = 0xffdfd1d6; rc.main.color = 0xffdfd1d6;
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
break; break;
case 18: case 18:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xa0ffa8a8; rc.main.color = 0xa0ffa8a8;
break; break;
case 19: case 19:
rc.showPolygon = zoom >= 10; rc.main.fillArea = zoom >= 10;
rc.shader = o.getShader(R.drawable.h_orchard); rc.main.shader = o.getShader(R.drawable.h_orchard);
break; break;
case 21: case 21:
rc.color = 0xffcfeca8; rc.main.color = 0xffcfeca8;
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
break; break;
case 22 : case 22 :
rc.showPolygon = zoom >= 7; rc.main.fillArea = zoom >= 7;
rc.color = 0xffb5d0d0; rc.main.color = 0xffb5d0d0;
break; break;
case 23: case 23:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xffdddddd; rc.main.color = 0xffdddddd;
break; break;
case 24: case 24:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xffcfeca8; rc.main.color = 0xffcfeca8;
if(zoom >= 15){ if(zoom >= 15){
rc.colorAround = Color.RED; rc.second.color = Color.RED;
rc.second.strokeWidth = 1;
} }
break; break;
case 26: case 26:
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.shader = o.getShader(R.drawable.h_quarry2); rc.main.shader = o.getShader(R.drawable.h_quarry2);
break; break;
case 27: case 27:
rc.showPolygon = zoom >= 10; rc.main.fillArea = zoom >= 10;
if(zoom < 14){ if(zoom < 14){
rc.color = 0xffabdf96; rc.main.color = 0xffabdf96;
} else { } else {
rc.shader = o.getShader(R.drawable.h_vineyard); rc.main.shader = o.getShader(R.drawable.h_vineyard);
} }
break; break;
} }
} else if (type == MapRenderingTypes.MILITARY) { } else if (type == MapRenderingTypes.MILITARY) {
if(subtype == 3){ if(subtype == 3){
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.color = 0xffff8f8f; rc.main.color = 0xffff8f8f;
} else if(subtype == 4){ } else if(subtype == 4){
rc.showPolygon = zoom >= 10; rc.main.fillArea = zoom >= 10;
rc.shader = o.getShader(R.drawable.h_danger); rc.main.shader = o.getShader(R.drawable.h_danger);
} }
} else if (type == MapRenderingTypes.LEISURE) { } else if (type == MapRenderingTypes.LEISURE) {
switch (subtype) { switch (subtype) {
case 2: case 2:
case 4: case 4:
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.color = 0xff33cc99; rc.main.color = 0xff33cc99;
break; break;
case 3: case 3:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xffb5e3b5; rc.main.color = 0xffb5e3b5;
break; break;
case 5: case 5:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.colorAround = 0xff888888; rc.second.color = 0xff888888;
rc.widthAround = 1; rc.second.strokeWidth = 1;
rc.color = 0xff74dcba; rc.main.color = 0xff74dcba;
break; break;
case 6: case 6:
rc.color = 0xff8ad3af; rc.main.color = 0xff8ad3af;
rc.showPolygon = zoom >= 13; rc.main.fillArea = zoom >= 13;
rc.colorAround = 0xff888888; rc.second.color = 0xff888888;
rc.widthAround = 1; rc.second.strokeWidth = 1;
break; break;
case 11: case 11:
if(zoom < 8){ if(zoom < 8){
rc.showPolygon = false; rc.main.fillArea = false;
} else if(zoom >= 8 && zoom <= 12){ } else if(zoom >= 8 && zoom <= 12){
rc.showPolygon = true; rc.main.fillArea = true;
rc.color = 0xffabdf96; rc.main.color = 0xffabdf96;
} else { } else {
rc.showPolygon = true; rc.main.fillArea = true;
rc.shader = o.getShader(R.drawable.h_nr); rc.main.shader = o.getShader(R.drawable.h_nr);
} }
break; break;
case 12: case 12:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xb0b6fdb6; rc.main.color = 0xb0b6fdb6;
break; break;
case 13: case 13:
rc.color = 0xffccfff1; rc.main.color = 0xffccfff1;
rc.showPolygon = zoom >= 15; rc.main.fillArea = zoom >= 15;
break; break;
case 14: case 14:
case 15: case 15:
rc.showPolygon = zoom >= 12; rc.main.fillArea = zoom >= 12;
rc.color = 0xffcfeca8; rc.main.color = 0xffcfeca8;
break; break;
} }
} else if (type == MapRenderingTypes.AMENITY_HEALTHCARE) { } else if (type == MapRenderingTypes.AMENITY_HEALTHCARE) {
if (subtype == 2) { if (subtype == 2) {
rc.showPolygon = zoom >= 15; rc.main.fillArea = zoom >= 15;
rc.color = 0xfff0f0d8; rc.main.color = 0xfff0f0d8;
rc.colorAround = Color.rgb(212, 168, 158); rc.second.color = Color.rgb(212, 168, 158);
rc.second.strokeWidth = 1;
} }
} else if (type == MapRenderingTypes.AMENITY_TRANSPORTATION) { } else if (type == MapRenderingTypes.AMENITY_TRANSPORTATION) {
if (subtype == 1 || subtype == 2) { if (subtype == 1 || subtype == 2) {
rc.color = Color.rgb(246, 238, 183); rc.main.color = Color.rgb(246, 238, 183);
} }
} else if (type == MapRenderingTypes.AMENITY_ENTERTAINMENT) { } else if (type == MapRenderingTypes.AMENITY_ENTERTAINMENT) {
if (subtype == 3) { if (subtype == 3) {
rc.color = Color.rgb(204, 153, 153); rc.main.color = Color.rgb(204, 153, 153);
} }
} else if (type == MapRenderingTypes.AMENITY_EDUCATION) { } else if (type == MapRenderingTypes.AMENITY_EDUCATION) {
if(subtype == 1 || subtype == 2 || subtype == 3 || subtype == 5){ if(subtype == 1 || subtype == 2 || subtype == 3 || subtype == 5){
rc.showPolygon = zoom >= 15; rc.main.fillArea = zoom >= 15;
rc.color = 0xfff0f0d8; rc.main.color = 0xfff0f0d8;
rc.colorAround = Color.rgb(212, 168, 158); rc.second.color = Color.rgb(212, 168, 158);
rc.second.strokeWidth = 1;
} else { } else {
// draw as building education // draw as building education
rc.color = Color.rgb(188, 169, 169); rc.main.color = Color.rgb(188, 169, 169);
} }
} }
} }

View file

@ -2,24 +2,24 @@ package net.osmand.render;
import net.osmand.osm.MapRenderingTypes; import net.osmand.osm.MapRenderingTypes;
import net.osmand.render.OsmandRenderer.RenderingContext; import net.osmand.render.OsmandRenderer.RenderingContext;
import net.osmand.render.OsmandRenderer.RenderingPaintProperties;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.PathEffect; import android.graphics.PathEffect;
import android.graphics.Paint.Cap;
public class PolylineRenderer { public class PolylineRenderer {
public static void renderPolyline(int type, int subtype, int objType, RenderingContext rc, OsmandRenderer o){ public static void renderPolyline(int type, int subtype, int objType, RenderingContext rc, OsmandRenderer o){
int zoom = rc.zoom; int zoom = rc.zoom;
int color = Color.BLACK;
boolean showText = true; boolean showText = true;
int color = Color.BLACK;
PathEffect pathEffect = null; PathEffect pathEffect = null;
float strokeWidth = zoom >= 15 ? 1 : 0;
int shadowLayer = 0; int shadowLayer = 0;
int shadowColor = 0; int shadowColor = 0;
float strokeWidth = zoom >= 15 ? 1 : 0;
float secondStrokeWidth = 0;
int secondColor = 0;
PathEffect secondEffect = null;
switch (type) { switch (type) {
case MapRenderingTypes.HIGHWAY: { case MapRenderingTypes.HIGHWAY: {
@ -111,9 +111,9 @@ public class PolylineRenderer {
if (hwType == MapRenderingTypes.PL_HW_CONSTRUCTION || hwType == MapRenderingTypes.PL_HW_PROPOSED) { if (hwType == MapRenderingTypes.PL_HW_CONSTRUCTION || hwType == MapRenderingTypes.PL_HW_PROPOSED) {
strokeWidth = zoom >= 15 ? (zoom == 15 ? 6 : 8) : 0; strokeWidth = zoom >= 15 ? (zoom == 15 ? 6 : 8) : 0;
color = 0xff99cccc; color = 0xff99cccc;
secondColor = Color.WHITE; rc.second.color = Color.WHITE;
secondStrokeWidth = strokeWidth - 1; rc.second.strokeWidth = strokeWidth - 1;
secondEffect = o.getDashEffect("8_6"); //$NON-NLS-1$ rc.second.pathEffect = o.getDashEffect("8_6"); //$NON-NLS-1$
} else { } else {
if (hwType == MapRenderingTypes.PL_HW_TRACK) { if (hwType == MapRenderingTypes.PL_HW_TRACK) {
strokeWidth = zoom >= 14 ? 2f : 0; strokeWidth = zoom >= 14 ? 2f : 0;
@ -166,12 +166,26 @@ public class PolylineRenderer {
} }
} }
} }
if(bridge && zoom > 12){ if(bridge && zoom > 14){
if(secondStrokeWidth == 0){ if(rc.second.strokeWidth == 0){
shadowLayer = 2; rc.second.color = color;
shadowColor = Color.BLACK; rc.second.strokeWidth = strokeWidth;
rc.second.pathEffect = pathEffect;
strokeWidth += 2;
color = Color.BLACK;
pathEffect = null;
if(rc.second.pathEffect == null){
rc.second.cap = Cap.SQUARE;
} else {
color = 0x88ffffff;
} }
} }
}
if(type == MapRenderingTypes.HIGHWAY && rc.zoom >= 16 && MapRenderingTypes.isOneWayWay(objType)){
rc.adds = getOneWayProperties();
}
if (tunnel && zoom > 12 && carRoad) { if (tunnel && zoom > 12 && carRoad) {
pathEffect = o.getDashEffect("4_4"); //$NON-NLS-1$ pathEffect = o.getDashEffect("4_4"); //$NON-NLS-1$
} }
@ -197,27 +211,32 @@ public class PolylineRenderer {
} else if(zoom == 13){ } else if(zoom == 13){
color = 0xff999999; color = 0xff999999;
strokeWidth = 3; strokeWidth = 3;
secondColor = Color.WHITE; rc.second.color = Color.WHITE;
secondStrokeWidth = 1; rc.second.strokeWidth = 1;
secondEffect = o.getDashEffect("8_12"); //$NON-NLS-1$ rc.second.pathEffect = o.getDashEffect("8_12"); //$NON-NLS-1$
} else { } else {
color = 0xff999999; color = 0xff999999;
strokeWidth = 3; strokeWidth = 3;
secondColor = Color.WHITE; rc.second.color = Color.WHITE;
secondStrokeWidth = 1; rc.second.strokeWidth = 1;
if(tunnel){ if(tunnel){
// TODO tunnel rc.second.strokeWidth = 3;
rc.second.pathEffect = o.getDashEffect("4_4"); //$NON-NLS-1$
} else if(bridge){ } else if(bridge){
// TODO bridge rc.third.color = color;
secondStrokeWidth = 5; rc.third.strokeWidth = 1;
strokeWidth = 7; rc.third.pathEffect = o.getDashEffect("12_8_1_0"); //$NON-NLS-1$
rc.second.strokeWidth = 4;
strokeWidth = 5;
color = Color.BLACK ;
} else { } else {
secondEffect = o.getDashEffect("0_11_8_1"); //$NON-NLS-1$ rc.second.strokeWidth = 1;
rc.second.pathEffect = o.getDashEffect("0_11_8_1"); //$NON-NLS-1$
} }
} }
} else if(subtype == 2 ) { } else if(subtype == 2 ) {
color = 0xff44444; color = 0xff444444;
if(zoom < 13){ if(zoom < 13){
strokeWidth = 0; strokeWidth = 0;
} else if(zoom < 15){ } else if(zoom < 15){
@ -248,9 +267,9 @@ public class PolylineRenderer {
if(bridge){ if(bridge){
strokeWidth = 4.5f; strokeWidth = 4.5f;
color = Color.BLACK; color = Color.BLACK;
secondStrokeWidth = 2; rc.second.strokeWidth = 2;
secondColor = Color.GRAY; rc.second.color = Color.GRAY;
secondEffect =o.getDashEffect("4_2"); //$NON-NLS-1$ rc.second.pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
} else { } else {
strokeWidth = 2; strokeWidth = 2;
color = Color.GRAY; color = Color.GRAY;
@ -273,9 +292,9 @@ public class PolylineRenderer {
} else { } else {
color = 0xff999999; color = 0xff999999;
strokeWidth = 3; strokeWidth = 3;
secondColor = Color.WHITE; rc.second.color = Color.WHITE;
secondStrokeWidth = 1; rc.second.strokeWidth = 1;
secondEffect = o.getDashEffect("0_1_8_1"); //$NON-NLS-1$ rc.second.pathEffect = o.getDashEffect("0_1_8_1"); //$NON-NLS-1$
} }
} else if (subtype == 8 || subtype == 11) { } else if (subtype == 8 || subtype == 11) {
if(zoom < 15){ if(zoom < 15){
@ -286,8 +305,8 @@ public class PolylineRenderer {
if(tunnel){ if(tunnel){
strokeWidth = 5; strokeWidth = 5;
pathEffect = o.getDashEffect("5_3"); //$NON-NLS-1$ pathEffect = o.getDashEffect("5_3"); //$NON-NLS-1$
secondColor = 0xffcccccc; rc.second.color = 0xffcccccc;
secondStrokeWidth = 3; rc.second.strokeWidth = 3;
} }
} }
} else if (subtype == 10) { } else if (subtype == 10) {
@ -383,8 +402,8 @@ public class PolylineRenderer {
} }
if(zoom > 12 && MapRenderingTypes.getWayLayer(objType) == 1){ if(zoom > 12 && MapRenderingTypes.getWayLayer(objType) == 1){
pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$ pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
secondStrokeWidth = strokeWidth - 2; rc.second.strokeWidth = strokeWidth - 2;
secondColor = Color.WHITE; rc.second.color = Color.WHITE;
} }
} }
break; break;
@ -454,9 +473,19 @@ public class PolylineRenderer {
} }
} }
if(MapRenderingTypes.getWayLayer(objType) == 2 && zoom > 12){ if(MapRenderingTypes.getWayLayer(objType) == 2 && zoom > 12){
if(secondStrokeWidth == 0){ if(rc.second.strokeWidth == 0){
shadowLayer = 2; rc.second.color = color;
shadowColor = Color.BLACK; rc.second.strokeWidth = strokeWidth;
rc.second.pathEffect = pathEffect;
strokeWidth += 2;
color = Color.BLACK;
pathEffect = null;
if(rc.second.pathEffect == null){
rc.second.cap = Cap.SQUARE;
} else {
color = Color.GRAY;
}
} }
} }
} }
@ -592,14 +621,49 @@ public class PolylineRenderer {
break; break;
} }
rc.color = color; rc.main.color = color;
rc.pathEffect = pathEffect; rc.main.pathEffect = pathEffect;
rc.shadowColor = shadowColor; rc.main.shadowColor = shadowColor;
rc.shadowLayer = shadowLayer; rc.main.shadowLayer = shadowLayer;
rc.main.strokeWidth = strokeWidth;
rc.showText = showText; rc.showText = showText;
rc.strokeWidth = strokeWidth;
rc.secondColor = secondColor;
rc.secondEffect = secondEffect;
rc.secondStrokeWidth = secondStrokeWidth;
} }
private static RenderingPaintProperties[] oneWay = null;
public static RenderingPaintProperties[] getOneWayProperties(){
if(oneWay == null){
PathEffect arrowDashEffect1 = new DashPathEffect(new float[] { 0, 12, 10, 152 }, 0);
PathEffect arrowDashEffect2 = new DashPathEffect(new float[] { 0, 12, 9, 153 }, 1);
PathEffect arrowDashEffect3 = new DashPathEffect(new float[] { 0, 18, 2, 154 }, 1);
PathEffect arrowDashEffect4 = new DashPathEffect(new float[] { 0, 18, 1, 155 }, 1);
oneWay = new RenderingPaintProperties[4];
oneWay[0] = new RenderingPaintProperties();
oneWay[0].emptyLine();
oneWay[0].color = 0xff6c70d5;
oneWay[0].strokeWidth = 1;
oneWay[0].pathEffect = arrowDashEffect1;
oneWay[1] = new RenderingPaintProperties();
oneWay[1].emptyLine();
oneWay[1].color = 0xff6c70d5;
oneWay[1].strokeWidth = 2;
oneWay[1].pathEffect = arrowDashEffect2;
oneWay[2] = new RenderingPaintProperties();
oneWay[2].emptyLine();
oneWay[2].color = 0xff6c70d5;
oneWay[2].strokeWidth = 3;
oneWay[2].pathEffect = arrowDashEffect3;
oneWay[3] = new RenderingPaintProperties();
oneWay[3].emptyLine();
oneWay[3].color = 0xff6c70d5;
oneWay[3].strokeWidth = 4;
oneWay[3].pathEffect = arrowDashEffect4;
}
return oneWay;
}
} }

View file

@ -243,8 +243,8 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
public void setZoom(float zoom){ public void setZoom(float zoom){
if ((map == null && zoom < 22) || if ((map == null && zoom < 22 && zoom > 0) ||
((map.getMaximumZoomSupported() + OVERZOOM_IN) >= zoom && map.getMinimumZoomSupported() <= zoom)) { (map != null && (map.getMaximumZoomSupported() + OVERZOOM_IN) >= zoom && map.getMinimumZoomSupported() <= zoom)) {
animatedDraggingThread.stopAnimating(); animatedDraggingThread.stopAnimating();
this.zoom = zoom; this.zoom = zoom;
refreshMap(); refreshMap();