improve rendering

git-svn-id: https://osmand.googlecode.com/svn/trunk@499 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-09-13 19:03:43 +00:00
parent 4d147ca9cb
commit fe72139b86
4 changed files with 96 additions and 71 deletions

View file

@ -554,6 +554,7 @@ public class MapRenderingTypes {
// 2. barrier
register("barrier", "hedge", BARRIER, 1, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("natural", "hedge", BARRIER, 1, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "fence", BARRIER, 2, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "wall", BARRIER, 3, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "ditch", BARRIER, 1, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -666,6 +667,7 @@ public class MapRenderingTypes {
register(1, "man_made", "pier", MAN_MADE, 9, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("man_made", "pipeline", MAN_MADE, 10, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("man_made", "reservoir_covered", MAN_MADE, 11, POLYGON_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("man_made", "embankment", MAN_MADE, 12, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("man_made", "beacon", MAN_MADE, 15, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("man_made", "crane", MAN_MADE, 16, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -887,7 +889,7 @@ public class MapRenderingTypes {
register("natural", "bay", NATURAL, 1, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "natural", "beach", NATURAL, 2, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "natural", "cave_entrance", NATURAL, 3, POLYGON_WITH_CENTER_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
registerRules(1, "natural", "cliff", NATURAL, 4, POLYGON_TYPE, POINT_TYPE, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("natural", "cliff", NATURAL, 4, POINT_TYPE, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("natural", "fell", NATURAL, 6, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(2, "natural", "glacier", NATURAL, 7, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "natural", "heath", NATURAL, 8, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -16,13 +16,14 @@ public class PolylineRenderer {
int shadowLayer = 0;
int shadowColor = 0;
float strokeWidth = zoom >= 15 ? 1 : 0;
if (type == MapRenderingTypes.HIGHWAY) {
switch (type) {
case MapRenderingTypes.HIGHWAY: {
int hwType = subtype;
boolean carRoad = true;
if (hwType == MapRenderingTypes.PL_HW_TRUNK) {
color = Color.rgb(168, 218, 168);
} else if (hwType == MapRenderingTypes.PL_HW_MOTORWAY) {
color = Color.rgb(128,155,192);
color = Color.rgb(128, 155, 192);
} else if (hwType == MapRenderingTypes.PL_HW_PRIMARY) {
color = Color.rgb(235, 152, 154);
} else if (hwType == MapRenderingTypes.PL_HW_SECONDARY) {
@ -69,11 +70,11 @@ public class PolylineRenderer {
strokeWidth = 2f;
}
} else if (hwType == MapRenderingTypes.PL_HW_TRUNK || hwType == MapRenderingTypes.PL_HW_MOTORWAY) {
if(zoom >= 7){
if (zoom >= 7) {
strokeWidth = 3.5f;
} else if(zoom == 6){
} else if (zoom == 6) {
strokeWidth = 2;
} else if(zoom == 5){
} else if (zoom == 5) {
strokeWidth = 1;
} else {
strokeWidth = 0;
@ -92,10 +93,10 @@ public class PolylineRenderer {
}
} else {
int layer = MapRenderingTypes.getWayLayer(objType);
if(layer == 1){
if (layer == 1) {
pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
}
if (zoom < 15) {
if (zoom < 15) {
strokeWidth = 4.5f;
} else if (zoom < 16) {
strokeWidth = 6;
@ -108,15 +109,16 @@ public class PolylineRenderer {
} else if (zoom >= 19) {
strokeWidth = 20;
}
if (hwType == MapRenderingTypes.PL_HW_SERVICE) {
strokeWidth -= 2;
}
if (hwType == MapRenderingTypes.PL_HW_SERVICE) {
strokeWidth -= 2;
}
}
}
showText = (carRoad && zoom > 12) || zoom > 16;
} else if(type == MapRenderingTypes.RAILWAY){
if(zoom < 10){
}
break;
case MapRenderingTypes.RAILWAY: {
if (zoom < 10) {
if (subtype == 2) {
color = 0xffaaaaaa;
if (zoom < 7) {
@ -152,9 +154,10 @@ public class PolylineRenderer {
color = Color.rgb(153, 153, 153);
}
}
} else if(type == MapRenderingTypes.WATERWAY){
if(zoom <= 10){
}
break;
case MapRenderingTypes.WATERWAY: {
if (zoom <= 10) {
strokeWidth = 0;
// draw rivers & canals
if (subtype == 2 || subtype == 4) {
@ -178,8 +181,8 @@ public class PolylineRenderer {
case 2:
case 4:
color = 0xffb5d0d0;
if(zoom < 13){
if (zoom < 13) {
strokeWidth = 2;
} else {
int layer = MapRenderingTypes.getWayLayer(objType);
@ -202,9 +205,9 @@ public class PolylineRenderer {
case 5:
case 6:
color = 0xffb5d0d0;
if(zoom < 13){
if (zoom < 13) {
strokeWidth = 0;
} else if(zoom < 15){
} else if (zoom < 15) {
strokeWidth = 1;
} else {
int layer = MapRenderingTypes.getWayLayer(objType);
@ -214,9 +217,9 @@ public class PolylineRenderer {
strokeWidth = 2;
}
break;
case 11:
if(zoom < 15){
if (zoom < 15) {
strokeWidth = 0;
} else {
strokeWidth = 2;
@ -224,7 +227,7 @@ public class PolylineRenderer {
}
break;
case 12:
if(zoom >= 13){
if (zoom >= 13) {
strokeWidth = 2;
} else {
strokeWidth = 0;
@ -234,23 +237,32 @@ public class PolylineRenderer {
break;
}
}
} else if(type == MapRenderingTypes.BARRIER){
if(subtype == 5){
}
break;
case MapRenderingTypes.BARRIER: {
if (subtype == 5) {
color = Color.GRAY;
if(zoom == 14){
if (zoom == 14) {
strokeWidth = 4;
} else if(zoom == 15){
} else if (zoom == 15) {
strokeWidth = 6;
} else if(zoom > 15){
} else if (zoom > 15) {
strokeWidth = 9;
} else {
strokeWidth = 0;
}
} else {
strokeWidth = zoom >= 16 ? 1 : 0;
color = Color.BLACK;
if (subtype == 1) {
strokeWidth = zoom >= 16 ? 3 : 0;
color = 0xffaed1a0;
} else {
strokeWidth = zoom >= 16 ? 1 : 0;
color = Color.BLACK;
}
}
} else if(type == MapRenderingTypes.POWER){
}
break;
case MapRenderingTypes.POWER: {
if (zoom >= 14) {
if (subtype == 3) {
color = Color.rgb(186, 186, 186);
@ -262,50 +274,56 @@ public class PolylineRenderer {
} else {
strokeWidth = 0;
}
} else if(type == MapRenderingTypes.AERIALWAY){
}
break;
case MapRenderingTypes.AERIALWAY: {
// TODO shader on path doesn't work
if(zoom >= 12){
if(subtype == 1 || subtype == 2){
if (zoom >= 12) {
if (subtype == 1 || subtype == 2) {
color = Color.rgb(186, 186, 186);
strokeWidth = 2;
//paint.setShader(getShader(R.drawable.h_cable_car));
} else if(subtype == 3 || subtype == 4 || subtype == 5){
// paint.setShader(getShader(R.drawable.h_cable_car));
} else if (subtype == 3 || subtype == 4 || subtype == 5) {
color = Color.rgb(186, 186, 186);
strokeWidth = 2;
//paint.setShader(getShader(R.drawable.h_chair_lift));
// paint.setShader(getShader(R.drawable.h_chair_lift));
}
}
} else if(type == MapRenderingTypes.MAN_MADE){
if(subtype == 8){
}
break;
case MapRenderingTypes.MAN_MADE: {
if (subtype == 8) {
// breakwater, groyone
color = 0xffaaaaaa;
if(zoom < 12){
if (zoom < 12) {
strokeWidth = 0;
} else if(zoom < 14){
} else if (zoom < 14) {
strokeWidth = 1;
} else if(zoom < 16){
} else if (zoom < 16) {
strokeWidth = 2;
} else {
strokeWidth = 4;
}
} else if(subtype == 9){
} else if (subtype == 9) {
// pier
color = 0xfff2efe9;
if(zoom < 12){
if (zoom < 12) {
strokeWidth = 0;
} else if(zoom < 14){
} else if (zoom < 14) {
strokeWidth = 1;
} else if(zoom < 16){
} else if (zoom < 16) {
strokeWidth = 3;
} else {
strokeWidth = 6;
}
}
} else if(type == MapRenderingTypes.LEISURE){
if(subtype == 8){
if(zoom < 13){
}
break;
case MapRenderingTypes.LEISURE: {
if (subtype == 8) {
if (zoom < 13) {
strokeWidth = 0;
} else if(zoom < 16){
} else if (zoom < 16) {
color = Color.BLUE;
strokeWidth = 1;
pathEffect = o.getDashEffect("6_2"); //$NON-NLS-1$
@ -314,7 +332,7 @@ public class PolylineRenderer {
strokeWidth = 2;
pathEffect = o.getDashEffect("6_2"); //$NON-NLS-1$
}
} else if(subtype == 5){
} else if (subtype == 5) {
if (zoom >= 13) {
color = 0xff888888;
strokeWidth = 1;
@ -322,9 +340,11 @@ public class PolylineRenderer {
strokeWidth = 0;
}
}
} else if(type == MapRenderingTypes.ADMINISTRATIVE){
}
break;
case MapRenderingTypes.ADMINISTRATIVE: {
color = 0xFF800080;
if(subtype == 29 || subtype == 30){
if (subtype == 29 || subtype == 30) {
// admin level 9, 10
if (zoom > 12) {
pathEffect = o.getDashEffect("3_2"); //$NON-NLS-1$
@ -335,42 +355,42 @@ public class PolylineRenderer {
} else {
strokeWidth = 0;
}
} else if(subtype == 28 || subtype == 27){
} else if (subtype == 28 || subtype == 27) {
// admin level 7, 8
if(zoom > 11){
if (zoom > 11) {
pathEffect = o.getDashEffect("5_2"); //$NON-NLS-1$
strokeWidth = 2;
} else {
strokeWidth = 0;
}
} else if(subtype == 25 || subtype == 26){
} else if (subtype == 25 || subtype == 26) {
// admin level 5, 6
if(zoom > 10){
if (zoom > 10) {
pathEffect = subtype == 25 ? o.getDashEffect("6_3_2_3_2_3") : o.getDashEffect("6_3_2_3"); //$NON-NLS-1$ //$NON-NLS-2$
strokeWidth = 2;
} else {
strokeWidth = 0;
}
} else if(subtype == 24){
} else if (subtype == 24) {
// admin level 4
pathEffect = o.getDashEffect("4_3"); //$NON-NLS-1$
if(zoom >= 4 && zoom <= 6){
if (zoom >= 4 && zoom <= 6) {
strokeWidth = 0.6f;
} else if(zoom >= 7 && zoom <= 10){
} else if (zoom >= 7 && zoom <= 10) {
strokeWidth = 2;
} else if(zoom > 10){
} else if (zoom > 10) {
strokeWidth = 3;
} else {
strokeWidth = 0;
}
} else if(subtype == 23 || subtype == 22){
} else if (subtype == 23 || subtype == 22) {
// admin level 2, 3
if(zoom >= 4 && zoom <= 6){
if (zoom >= 4 && zoom <= 6) {
strokeWidth = 2;
} else if(zoom >= 7 && zoom <= 9){
} else if (zoom >= 7 && zoom <= 9) {
strokeWidth = 3;
} else if(zoom > 9){
if(subtype == 22){
} else if (zoom > 9) {
if (subtype == 22) {
strokeWidth = 6;
} else {
strokeWidth = 5;
@ -379,11 +399,14 @@ public class PolylineRenderer {
} else {
strokeWidth = 0;
}
}
}
}
}
break;
default:
break;
}
rc.color = color;
rc.pathEffect = pathEffect;
rc.shadowColor = shadowColor;