improve rendering

git-svn-id: https://osmand.googlecode.com/svn/trunk@495 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-09-08 21:58:55 +00:00
parent f829722b51
commit a0ec94cde3
33 changed files with 348 additions and 145 deletions

View file

@ -37,7 +37,7 @@ public class ToDoConstants {
// + 11!! Investigate ResourceManager close methods and clear cache when Map switches !!! (MAP SWITCH, update settings)
// + 12! When switch to map check that indexes were loaded !!
// + 14. Rotate vector map
// 15. Draw layers -> icons -> text. See intersects of double streets.
// 15. Draw layers -> icons -> text (+) See intersects of double streets.
// 16. Internet access bits
// 11. Move JUnidecode on client save space for some indexes adn

View file

@ -51,31 +51,32 @@ public class MapRenderingTypes {
public final static int MASK_4 = (1 << 4) - 1;
public final static int MASK_10 = (1 << 10) - 1;
public final static int HIGHWAY = 1;
public final static int BARRIER = 2; //+R
public final static int WATERWAY = 3;
public final static int RAILWAY = 4;
public final static int AEROWAY = 5;
public final static int AERIALWAY = 6; //+R
public final static int POWER = 7; //+R
public final static int MAN_MADE = 8;
public final static int LEISURE = 9; //+R
public final static int OFFICE = 10; //+R
public final static int SHOP = 11; //+R
public final static int EMERGENCY = 12; //+R
public final static int TOURISM = 13; //+R
public final static int HISTORIC = 14; //+R
public final static int LANDUSE = 15; //+R
public final static int MILITARY = 16;
public final static int NATURAL = 17;
public final static int AMENITY_SUSTENANCE = 18; //+R
public final static int AMENITY_EDUCATION = 19; //+R
public final static int AMENITY_TRANSPORTATION = 20; //+R
public final static int AMENITY_FINANCE = 21; //+R
public final static int AMENITY_HEALTHCARE = 22; //+R
public final static int AMENITY_ENTERTAINMENT = 23;//+R
public final static int AMENITY_OTHER = 24; //+R
public final static int ADMINISTRATIVE = 25;
// TODO Find TextSymbolizer rules
public final static int HIGHWAY = 1; //TODO R
public final static int BARRIER = 2;
public final static int WATERWAY = 3; //TODO R layer-water_features.xml.inc, layer-water.xml.inc
public final static int RAILWAY = 4;//TODO R
public final static int AEROWAY = 5; //TODO R
public final static int AERIALWAY = 6;
public final static int POWER = 7;
public final static int MAN_MADE = 8; //TODO R
public final static int LEISURE = 9;
public final static int OFFICE = 10;
public final static int SHOP = 11;
public final static int EMERGENCY = 12;
public final static int TOURISM = 13;
public final static int HISTORIC = 14;
public final static int LANDUSE = 15;
public final static int MILITARY = 16; //TODO R
public final static int NATURAL = 17;//TODO R
public final static int AMENITY_SUSTENANCE = 18;
public final static int AMENITY_EDUCATION = 19;
public final static int AMENITY_TRANSPORTATION = 20;
public final static int AMENITY_FINANCE = 21;
public final static int AMENITY_HEALTHCARE = 22;
public final static int AMENITY_ENTERTAINMENT = 23;
public final static int AMENITY_OTHER = 24;
public final static int ADMINISTRATIVE = 25;//TODO R
public final static int ROUTE = 26; //NOT DONE YET
public final static int SPORT = 27; //+no icons
@ -430,7 +431,7 @@ public class MapRenderingTypes {
register("highway", "bridleway", HIGHWAY, PL_HW_BRIDLEWAY, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "byway", HIGHWAY, PL_HW_BYWAY, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "steps", HIGHWAY, PL_HW_STEPS, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "ford", HIGHWAY, PL_HW_FORD, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "ford", HIGHWAY, PL_HW_FORD, POLYLINE_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "construction", HIGHWAY, PL_HW_CONSTRUCTION, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "proposed", HIGHWAY, PL_HW_PROPOSED, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -463,6 +464,7 @@ public class MapRenderingTypes {
register("barrier", "ditch", BARRIER, 1, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "retaining_wall", BARRIER, 4, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "city_wall", BARRIER, 5, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("historic", "city_walls", BARRIER, 5, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "bollard", BARRIER, 6, POLYLINE_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "cycle_barrier", BARRIER, 16, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "block", BARRIER, 17, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -470,6 +472,7 @@ public class MapRenderingTypes {
register("barrier", "toll_booth", BARRIER, 19, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "entrance", BARRIER, 20, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "gate", BARRIER, 21, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "gate", BARRIER, 21, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "lift_gate", BARRIER, 22, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "stile", BARRIER, 23, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("barrier", "horse_stile", BARRIER, 24, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -524,6 +527,7 @@ public class MapRenderingTypes {
register("aeroway", "runway", AEROWAY, 7, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aeroway", "taxiway", AEROWAY, 8, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aeroway", "apron", AEROWAY, 9, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aeroway", "airport", AEROWAY, 10, POLYGON_WITH_CENTER_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aeroway", "gate", AEROWAY, 12, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aeroway", "windsock", AEROWAY, 13, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -533,7 +537,7 @@ public class MapRenderingTypes {
register("aerialway", "chair_lift", AERIALWAY, 3, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aerialway", "mixed_lift", AERIALWAY, 4, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aerialway", "drag_lift", AERIALWAY, 5, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aerialway", "gondola", AERIALWAY, 6, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aerialway", "goods", AERIALWAY, 6, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
registerAsBuilding("aerialway", "station", AERIALWAY, 7); //$NON-NLS-1$ //$NON-NLS-2$
register("aerialway", "pylon", AERIALWAY, 8, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("aerialway", "goods", AERIALWAY, 9, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -633,6 +637,7 @@ public class MapRenderingTypes {
register("shop", "charity", SHOP, 11, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("shop", "chemist", SHOP, 12, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("shop", "clothes", SHOP, 13, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("shop", "fashion", SHOP, 13, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("shop", "computer", SHOP, 14, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("shop", "confectionery", SHOP, 15, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("shop", "convenience", SHOP, 16, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -777,7 +782,7 @@ public class MapRenderingTypes {
register("natural", "bay", NATURAL, 1, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("natural", "beach", NATURAL, 2, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("natural", "cave_entrance", NATURAL, 3, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("natural", "cave_entrance", NATURAL, 3, POLYGON_WITH_CENTER_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
registerRules("natural", "cliff", NATURAL, 4, POLYGON_TYPE, 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("natural", "glacier", NATURAL, 7, POLYGON_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -868,7 +873,7 @@ public class MapRenderingTypes {
registerAsBuilding("amenity", "courthouse", AMENITY_OTHER, 5); //$NON-NLS-1$ //$NON-NLS-2$
registerAsBuilding("amenity", "crematorium", AMENITY_OTHER, 6); //$NON-NLS-1$ //$NON-NLS-2$
registerAsBuilding("amenity", "embassy", AMENITY_OTHER, 7); //$NON-NLS-1$ //$NON-NLS-2$
register("amenity", "embassy", AMENITY_OTHER, 7, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("amenity", "grave_yard", AMENITY_OTHER, 8, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("amenity", "hunting_stand", AMENITY_OTHER, 9, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("amenity", "police", AMENITY_OTHER, 10, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -887,6 +892,8 @@ public class MapRenderingTypes {
register("amenity", "fountain", AMENITY_OTHER, 23, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("amenity", "bench", AMENITY_OTHER, 24, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("amenity", "clock", AMENITY_OTHER, 25, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("amenity", "place_of_worship", AMENITY_OTHER, 26, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
// "amenity", "place_of_worship"
// 25. administrative
register("place", "continent", ADMINISTRATIVE, 41, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

View file

@ -59,11 +59,15 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
private int clPedestrianRoad = Color.rgb(250, 128, 115);
private PathEffect dashEffect2_2 = new DashPathEffect(new float[]{2,2}, 1);
private PathEffect dashEffect4_4 = new DashPathEffect(new float[]{4,4}, 1);
private PathEffect dashEffect3_2 = new DashPathEffect(new float[]{3,2}, 1);
private PathEffect dashEffect4_2 = new DashPathEffect(new float[]{4,2}, 1);
private PathEffect dashEffect4_3 = new DashPathEffect(new float[]{4,3}, 1);
private PathEffect dashEffect6_2 = new DashPathEffect(new float[]{6,2}, 1);
private PathEffect dashEffect5_2 = new DashPathEffect(new float[]{5,2}, 1);
private PathEffect dashEffect6_3 = new DashPathEffect(new float[]{6,3}, 1);
private PathEffect dashEffect7_7 = new DashPathEffect(new float[]{7,7}, 1);
private PathEffect dashEffect5_2_2_2 = new DashPathEffect(new float[]{5,2,2,2}, 1);
private PathEffect dashEffect6_3_2_3 = new DashPathEffect(new float[]{6,3,2,3,}, 1);
private PathEffect dashEffect6_3_2_3_2_3 = new DashPathEffect(new float[]{6,3,2,3,2,3}, 1);
private Map<Integer, Shader> shaders = new LinkedHashMap<Integer, Shader>();
@ -326,7 +330,6 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
case 27:
shader = getShader(R.drawable.h_vineyard);
break;
}
} else if (type == MapRenderingTypes.LEISURE) {
colorAround = Color.rgb(147, 207, 170);
@ -410,15 +413,23 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
}
String name = obj.getName();
if(name != null){
float textSize = 16;
boolean accept = zoom > 17;
if(zoom > 15){
accept = name.length() < 4;
} else if(zoom > 16){
if(zoom > 15 && zoom <= 16){
accept = name.length() < 4;
textSize = 10;
} else if(zoom <= 17){
accept = name.length() < 8;
textSize = 12;
}
if(accept){
canvas.drawText(name, xText, yText, paintText);
TextDrawInfo text = new TextDrawInfo();
text.textSize = textSize;
text.textWrap = 20;
text.centerX = xText;
text.centerY = yText;
text.text = name;
textToDraw.add(text);
}
}
return new PointF(xText, yText);
@ -532,154 +543,209 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
if(obj.getPointsLength() == 0){
return;
}
Path path = null;
float pathRotate = 0;
float xLength = 0;
float yLength = 0;
Paint paint = paintStroke;
int type = MapRenderingTypes.getObjectType(obj.getType());
int subtype = MapRenderingTypes.getPolylineSubType(obj.getType());
boolean showText = true;
boolean showLine = true;
paint.setPathEffect(null);
paint.setShadowLayer(0, 0, 0, 0);
paint.setColor(Color.BLACK);
paint.setStrokeWidth(1);
PathEffect pathEffect = null;
int color = Color.BLACK;
int shadowLayer = 0;
int shadowColor = 0;
float strokeWidth = zoom >= 15 ? 1 : 0;
if (type == MapRenderingTypes.HIGHWAY) {
int hwType = subtype;
boolean carRoad = true;
if (hwType == MapRenderingTypes.PL_HW_TRUNK) {
paint.setColor(clTrunkRoad);
color = clTrunkRoad;
} else if (hwType == MapRenderingTypes.PL_HW_MOTORWAY) {
paint.setColor(clMotorwayRoad);
color = clMotorwayRoad;
} else if (hwType == MapRenderingTypes.PL_HW_PRIMARY) {
paint.setColor(clPrimaryRoad);
color = clPrimaryRoad;
} else if (hwType == MapRenderingTypes.PL_HW_SECONDARY) {
paint.setColor(clSecondaryRoad);
color = clSecondaryRoad;
} else if (hwType == MapRenderingTypes.PL_HW_TERTIARY) {
paint.setColor(clTertiaryRoad);
paint.setShadowLayer(2, 0, 0, Color.rgb(186, 186, 186));
color = clTertiaryRoad;
shadowLayer = 2;
shadowColor = Color.rgb(186, 186, 186);
} else if (hwType == MapRenderingTypes.PL_HW_SERVICE || hwType == MapRenderingTypes.PL_HW_UNCLASSIFIED
|| hwType == MapRenderingTypes.PL_HW_RESIDENTIAL) {
paint.setShadowLayer(1, 0, 0, Color.rgb(194, 194, 194));
paint.setColor(clRoadColor);
shadowLayer = 1;
shadowColor = Color.rgb(194, 194, 194);
color = clRoadColor;
} else if (hwType == MapRenderingTypes.PL_HW_PEDESTRIAN) {
paint.setShadowLayer(1, 0, 0, Color.rgb(176, 176, 176));
paint.setColor(Color.rgb(236, 236, 236));
shadowLayer = 1;
shadowColor = Color.rgb(176, 176, 176);
color = Color.rgb(236, 236, 236);
} else {
carRoad = false;
paint.setStrokeWidth(2);
paint.setPathEffect(dashEffect2_2);
strokeWidth = 2;
pathEffect = dashEffect2_2;
if (hwType == MapRenderingTypes.PL_HW_TRACK || hwType == MapRenderingTypes.PL_HW_PATH) {
paint.setColor(clTrackRoad);
paint.setPathEffect(dashEffect6_2);
color = clTrackRoad;
pathEffect = dashEffect6_2;
} else if (hwType == MapRenderingTypes.PL_HW_CYCLEWAY || hwType == MapRenderingTypes.PL_HW_BRIDLEWAY) {
paint.setColor(clCycleWayRoad);
color = clCycleWayRoad;
} else {
paint.setColor(clPedestrianRoad);
color = clPedestrianRoad;
}
}
if (carRoad) {
if (zoom < 16) {
paint.setStrokeWidth(6);
strokeWidth = 6;
} else if (zoom == 16) {
paint.setStrokeWidth(8);
strokeWidth = 8;
} else if (zoom == 17) {
paint.setStrokeWidth(13);
strokeWidth = 13;
} else if (zoom >= 18) {
paint.setStrokeWidth(16);
strokeWidth = 16;
} else if (zoom >= 19) {
paint.setStrokeWidth(20);
strokeWidth = 20;
}
if (hwType == MapRenderingTypes.PL_HW_SERVICE) {
paint.setStrokeWidth(paint.getStrokeWidth() - 2);
strokeWidth -= 2;
}
}
showText = carRoad || zoom > 16;
} else if(type == MapRenderingTypes.BARRIER){
showLine = zoom >= 16;
// if(subtype == 2){
paint.setColor(Color.rgb(137, 136, 132));
// }
paint.setStrokeWidth(1);
if(subtype == 5){
color = Color.GRAY;
if(zoom == 14){
strokeWidth = 4;
} else if(zoom == 15){
strokeWidth = 6;
} else if(zoom > 15){
strokeWidth = 9;
} else {
strokeWidth = 0;
}
} else {
strokeWidth = zoom >= 16 ? 1 : 0;
color = Color.BLACK;
}
} else if(type == MapRenderingTypes.POWER){
if(subtype == 3){
paint.setColor(Color.rgb(186, 186, 186));
paint.setStrokeWidth(2);
} else if(subtype == 4){
paint.setColor(Color.rgb(186, 186, 186));
paint.setStrokeWidth(1);
if (zoom >= 14) {
if (subtype == 3) {
color = Color.rgb(186, 186, 186);
strokeWidth = zoom == 14 ? 1 : 2;
} else if (subtype == 4) {
color = Color.rgb(186, 186, 186);
strokeWidth = 1;
}
} else {
strokeWidth = 0;
}
} else if(type == MapRenderingTypes.AERIALWAY){
// TODO effect circles between line
paint.setStrokeWidth(2);
paint.setColor(Color.rgb(186, 186, 186));
} else if(type == MapRenderingTypes.ADMINISTRATIVE){
if(subtype == 29 || subtype == 30){
showLine = zoom > 12;
paint.setColor(Color.rgb(170, 86, 170));
paint.setPathEffect(dashEffect2_2);
paint.setStrokeWidth(2);
if(zoom > 16){
paint.setStrokeWidth(3);
}
} else if(subtype == 28 || subtype == 27){
showLine = zoom > 11;
paint.setColor(Color.rgb(208, 167, 201));
paint.setStrokeWidth(2);
paint.setPathEffect(dashEffect6_3);
} else if(subtype == 26 || subtype == 25){
showLine = zoom > 10;
paint.setColor(Color.rgb(169, 193, 156));
paint.setStrokeWidth(2);
paint.setPathEffect(dashEffect5_2_2_2);
} else if(subtype == 24 || subtype == 23){
showLine = zoom > 5;
paint.setColor(Color.rgb(141, 67, 137));
if (zoom > 11) {
paint.setPathEffect(dashEffect5_2_2_2);
paint.setStrokeWidth(3);
} else {
paint.setPathEffect(dashEffect4_4);
paint.setStrokeWidth(2);
// TODO shader on path doesn't work
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){
color = Color.rgb(186, 186, 186);
strokeWidth = 2;
//paint.setShader(getShader(R.drawable.h_chair_lift));
}
}
} else if(type == MapRenderingTypes.ADMINISTRATIVE){
color = 0xFF800080;
if(subtype == 29 || subtype == 30){
// admin level 9, 10
if (zoom > 12) {
pathEffect = dashEffect3_2;
strokeWidth = 2;
if (zoom > 16) {
strokeWidth = 3;
}
} else {
strokeWidth = 0;
}
} else if(subtype == 28 || subtype == 27){
// admin level 7, 8
if(zoom > 11){
pathEffect = dashEffect5_2;
strokeWidth = 2;
} else {
strokeWidth = 0;
}
strokeWidth = 2;
pathEffect = dashEffect6_3;
} else if(subtype == 25 || subtype == 26){
// admin level 5, 6
if(zoom > 10){
pathEffect = subtype == 25 ? dashEffect6_3_2_3_2_3 : dashEffect6_3_2_3;
strokeWidth = 2;
} else {
strokeWidth = 0;
}
} else if(subtype == 24){
// admin level 4
pathEffect = dashEffect4_3;
if(zoom >= 4 && zoom <= 6){
strokeWidth = 0.6f;
} else if(zoom >= 7 && zoom <= 10){
strokeWidth = 1;
} else if(zoom > 10){
strokeWidth = 3;
} else {
strokeWidth = 0;
}
} else if(subtype == 23 || subtype == 22){
// admin level 2, 3
if(zoom >= 4 && zoom <= 6){
strokeWidth = 1;
} else if(zoom >= 7 && zoom <= 9){
strokeWidth = 2;
} else if(zoom > 9){
if(subtype == 22){
strokeWidth = 6;
} else {
strokeWidth = 5;
pathEffect = dashEffect4_2;
}
} else {
strokeWidth = 0;
}
}
} else if(type == MapRenderingTypes.RAILWAY){
paint.setStrokeWidth(2);
strokeWidth = 2;
if(subtype == 6){
paint.setColor(Color.rgb(153, 153, 153));
color = Color.rgb(153, 153, 153);
if(zoom > 16){
paint.setStrokeWidth(3);
strokeWidth = 3;
}
paint.setPathEffect(dashEffect6_3);
pathEffect = dashEffect6_3;
} else if(subtype == 2){
paint.setColor(Color.rgb(62, 62, 62));
color = Color.rgb(62, 62, 62);
} else if(subtype == 1){
paint.setColor(Color.rgb(153, 153, 153));
color = Color.rgb(153, 153, 153);
if(zoom >= 16){
paint.setStrokeWidth(3);
strokeWidth = 3;
}
paint.setPathEffect(dashEffect7_7);
pathEffect = dashEffect7_7;
} else {
paint.setColor(Color.rgb(153, 153, 153));
color = Color.rgb(153, 153, 153);
}
} else if(type == MapRenderingTypes.WATERWAY){
if(subtype >= 1 && subtype <= 6){
paint.setStrokeWidth(2);
paint.setColor(Color.rgb(181, 208, 208));
strokeWidth = 2;
color = Color.rgb(181, 208, 208);
}
}
if(!showLine){
if(strokeWidth == 0){
return;
}
Path path = null;
float pathRotate = 0;
float xLength = 0;
float yLength = 0;
boolean inverse = false;
float xPrev = 0;
@ -719,9 +785,16 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
yPrev = p.y;
}
if (path != null) {
canvas.drawPath(path, paint);
paintStroke.setPathEffect(pathEffect);
if(paintStroke.getShader() != null){
paintStroke.setShader(null);
}
paintStroke.setShadowLayer(shadowLayer, 0, 0, shadowColor);
paintStroke.setColor(color);
paintStroke.setStrokeWidth(strokeWidth);
canvas.drawPath(path, paintStroke);
if (obj.getName() != null && showText) {
float w = paint.getStrokeWidth() + 3;
float w = strokeWidth + 3;
if(w < 10){
w = 10;
}
@ -750,7 +823,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
text.drawOnPath = path;
text.textColor = Color.BLACK;
text.textSize = w;
text.vOffset = paint.getStrokeWidth() / 2 - 1;
text.vOffset = strokeWidth / 2 - 1;
textToDraw.add(text);
}
@ -758,7 +831,5 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
}
}
}

View file

@ -11,11 +11,66 @@ public class PointRenderer {
public static int getPointBitmap(int zoom, int type, int subType) {
int resId = 0;
if(type == MapRenderingTypes.HIGHWAY){
if (zoom > 16) {
if (zoom >= 16) {
if(subType == 38){
resId = R.drawable.h_traffic_light;
if(zoom > 16){
resId = R.drawable.h_traffic_light;
}
} else if(subType == 40){
resId = R.drawable.h_bus_stop;
resId = zoom == 16 ? R.drawable.h_bus_stop_small : R.drawable.h_bus_stop;
} else if(subType == 23){
resId = R.drawable.h_transport_ford;
}
}
if(subType == 35){
if(zoom >= 15){
resId = R.drawable.h_mini_round;
}
}
} else if(type == MapRenderingTypes.RAILWAY){
if(subType == 13){
if(zoom == 12){
resId = R.drawable.h_halt;
} else if(zoom == 13 || zoom == 14){
resId = R.drawable.h_station_small;
} else if(zoom >= 15){
resId = R.drawable.h_station;
}
} else if(subType == 22 || subType == 23){
if(zoom == 13 || zoom == 14){
resId = R.drawable.h_halt;
} else if(zoom >= 15){
resId = R.drawable.h_station_small;
}
} else if(subType == 25){
if(zoom == 14 || zoom == 15){
resId = R.drawable.h_level_crossing;
} else if(zoom >= 16){
resId = R.drawable.h_level_crossing2;
}
}
} else if(type == MapRenderingTypes.AEROWAY){
if(subType == 1){
if(zoom >= 10 && zoom <= 14){
resId = R.drawable.h_aerodrome;
}
} else if(subType == 10){
if(zoom >= 9 && zoom <= 13){
resId = R.drawable.h_airport;
}
}
} else if(type == MapRenderingTypes.WATERWAY){
if(subType == 8){
if (zoom > 14) {
resId = R.drawable.h_lock_gate;
}
}
} else if(type == MapRenderingTypes.AERIALWAY){
if(subType == 7){
if(zoom == 13 || zoom == 14){
resId = R.drawable.h_halt;
} else if(zoom >= 15){
resId = R.drawable.h_station_small;
}
}
} else if(type == MapRenderingTypes.POWER){
@ -26,7 +81,20 @@ public class PointRenderer {
resId = R.drawable.h_power_wind;
}
}
} else if (type == MapRenderingTypes.MAN_MADE) {
if (subType == 25) {
if (zoom >= 16) {
resId = R.drawable.h_tower_water;
}
} else if (subType == 17) {
if (zoom >= 15) {
resId = R.drawable.h_lighthouse;
}
} else if (subType == 27) {
if (zoom >= 16) {
resId = R.drawable.h_windmill;
}
}
} else if(type == MapRenderingTypes.SHOP){
if (zoom > 15) {
switch (subType) {
@ -93,22 +161,55 @@ public class PointRenderer {
case 15:
resId = R.drawable.h_museum;
break;
case 17:
resId = R.drawable.h_view_point;
break;
}
}
} else if(type == MapRenderingTypes.NATURAL){
if (zoom > 10) {
resId = R.drawable.h_peak;
if (subType == 13) {
if (zoom > 10) {
resId = R.drawable.h_peak;
}
} else if(subType == 3){
if (zoom > 14) {
resId = R.drawable.h_cave_entrance;
}
} else if(subType == 17){
if (zoom >= 14) {
resId = R.drawable.h_spring;
}
} else if(subType == 19){
if (zoom == 16) {
resId = R.drawable.h_tree;
} else if (zoom >= 17) {
resId = R.drawable.h_tree2;
}
}
} else if(type == MapRenderingTypes.HISTORIC){
if (zoom > 15) {
if (subType == 6) {
resId = R.drawable.h_memorial;
} else if(zoom > 16){
} else {
// something historic
resId = R.drawable.h_view_point;
}
}
} else if(type == MapRenderingTypes.BARRIER){
if(subType == 21){
if(zoom >= 15){
resId = R.drawable.h_gate2;
}
} else if(subType == 22){
if(zoom >= 16){
resId = R.drawable.h_liftgate;
}
} else if(subType == 26){
if(zoom >= 16){
resId = R.drawable.h_bollard;
}
}
} else if(type == MapRenderingTypes.EMERGENCY){
if(zoom > 15){
if(subType == 10){
@ -151,11 +252,25 @@ public class PointRenderer {
}
} else if (type == MapRenderingTypes.AMENITY_TRANSPORTATION) {
if (subType == 1 || subType == 2) {
resId = R.drawable.h_parking;
if (zoom > 14) {
resId = R.drawable.h_parking;
}
} else if (subType == 4) {
resId = R.drawable.h_fuel;
if(zoom > 13){
resId = R.drawable.h_fuel;
}
} else if (subType == 17) {
if(zoom >= 17){
resId = R.drawable.h_rental_bicycle;
}
} else if (subType == 20) {
if(zoom >= 16){
resId = R.drawable.h_car_share;
}
} else if (subType == 18) {
resId = R.drawable.h_bus_station;
if(zoom > 14){
resId = R.drawable.h_bus_station;
}
}
} else if (type == MapRenderingTypes.AMENITY_FINANCE) {
if (subType == 1) {
@ -207,11 +322,21 @@ public class PointRenderer {
case 11:
resId = R.drawable.h_postbox;
break;
case 16:
resId = R.drawable.h_shelter;
break;
case 12:
resId = R.drawable.h_postoffice;
break;
}
}
if(zoom >= 16){
if(subType == 26){
resId = R.drawable.h_place_of_worship;
} else if(subType == 13){
resId = R.drawable.h_prison;
}
}
}
return resId;
}