implement rendering

git-svn-id: https://osmand.googlecode.com/svn/trunk@500 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-09-14 20:05:14 +00:00
parent fe72139b86
commit 53d8e49c1d
8 changed files with 462 additions and 255 deletions

View file

@ -1543,7 +1543,7 @@ public class IndexCreator {
st.close();
dbConn.close();
}
// TODO steps
public static void main(String[] args) throws IOException, SAXException, SQLException {
IndexCreator creator = new IndexCreator(new File("e:/Information/OSM maps/osmand/"));
@ -1555,6 +1555,9 @@ public class IndexCreator {
// creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/belarus_nodes.tmp.odb"));
// creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/belarus_2010_09_03.osm.bz2"), new ConsoleProgressImplementation(3), null);
creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/ams.tmp.odb"));
creator.generateIndexes(new File("e:/Information/OSM maps/osm_map/ams_part_map.osm"), new ConsoleProgressImplementation(3), null);
// download base
/* MapTileDownloader instance = MapTileDownloader.getInstance();

View file

@ -7,7 +7,7 @@ public class MapRenderObject {
private int type;
private byte[] data = null;
private long id;
private int order = -1;
private float order = -1;
public MapRenderObject(long id){
this.id = id;
@ -52,21 +52,48 @@ public class MapRenderObject {
return Algoritms.parseIntFromBytes(data, ind * 8 + 4);
}
public int getMapOrder(){
public float getMapOrder(){
if (order == -1) {
int oType = MapRenderingTypes.getObjectType(type);
int sType = MapRenderingTypes.getPolylineSubType(type);
if ((type & MapRenderingTypes.TYPE_MASK) == MapRenderingTypes.POLYGON_TYPE) {
// 1 - 9
if (MapRenderingTypes.isPolygonBuilding(type)) {
// draw over lines
order = 64;
} else if (oType == MapRenderingTypes.LANDUSE) {
switch (sType) {
case 5: case 6: case 15: case 18: case 20: case 23:
order = 1;
break;
case 22:
order = 5;
break;
default:
order = 1.5f;
break;
}
} else if (oType == MapRenderingTypes.LEISURE) {
switch (sType) {
case 3:
case 10:
case 13:
order = 4;
break;
default:
order = 2;
break;
}
} else if (oType == MapRenderingTypes.POWER) {
order = 60;
order = 4;
} else if (oType == MapRenderingTypes.WATERWAY || oType == MapRenderingTypes.NATURAL) {
order = 7;
// water 5
order = 5;
} else {
order = 1;
}
} else if ((type & MapRenderingTypes.TYPE_MASK) == MapRenderingTypes.POLYLINE_TYPE) {
// 10 - 68
int layer = MapRenderingTypes.getWayLayer(type);
if(layer == 1){
order = 10;

View file

@ -17,9 +17,6 @@ import net.osmand.osm.OSMSettings.OSMTagKey;
*/
public class MapRenderingTypes {
// TODO !!! add others facilities to all types
// TODO Internet access bits for point
// TODO Find TextSymbolizer rules and write text for points and others
/** standard schema :
polygon : ssssssss ttttt aaaaa ttttt 011 : 26 bits + 6 bits for special info
@ -51,14 +48,21 @@ public class MapRenderingTypes {
public final static int MASK_10 = (1 << 10) - 1;
public final static int HIGHWAY = 1; //TODO REVIEW
// TODO !!! add others facilities to all types
// TODO Internet access bits for point
// TODO Find TextSymbolizer rules and write text for points and others
// TODO place text : (ref - shield)
// TODO coastline
// TODO render : bridge (common way), tunnel, hw, railway : construction, proposed
public final static int HIGHWAY = 1; //TODO REVIEW,traffic
public final static int BARRIER = 2;
public final static int WATERWAY = 3;
public final static int RAILWAY = 4;//TODO REVIEW
public final static int AEROWAY = 5; //TODO R
public final static int RAILWAY = 4;//TODO RENDER
public final static int AEROWAY = 5;
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 MAN_MADE = 8;
public final static int LEISURE = 9;
public final static int OFFICE = 10;
public final static int SHOP = 11;
@ -67,7 +71,7 @@ public class MapRenderingTypes {
public final static int HISTORIC = 14;
public final static int LANDUSE = 15;
public final static int MILITARY = 16;
public final static int NATURAL = 17;//TODO R
public final static int NATURAL = 17;
public final static int AMENITY_SUSTENANCE = 18;
public final static int AMENITY_EDUCATION = 19;
public final static int AMENITY_TRANSPORTATION = 20;
@ -511,7 +515,7 @@ public class MapRenderingTypes {
register(1, "highway", "tertiary", HIGHWAY, PL_HW_TERTIARY, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "highway", "unclassified", HIGHWAY, PL_HW_UNCLASSIFIED, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "highway", "road", HIGHWAY, PL_HW_UNCLASSIFIED, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "residential", HIGHWAY, PL_HW_RESIDENTIAL, POLYLINE_TYPE, POLYGON_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "highway", "residential", HIGHWAY, PL_HW_RESIDENTIAL, POLYLINE_TYPE, POLYGON_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "living_street", HIGHWAY, PL_HW_LIVING_STREET, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "service", HIGHWAY, PL_HW_SERVICE, POLYLINE_TYPE, POLYGON_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "highway", "track", HIGHWAY, PL_HW_TRACK, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -523,8 +527,8 @@ public class MapRenderingTypes {
register(1, "highway", "path", HIGHWAY, PL_HW_PATH, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "highway", "cycleway", HIGHWAY, PL_HW_CYCLEWAY, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "footway", HIGHWAY, PL_HW_FOOTWAY, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
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(1, "highway", "bridleway", HIGHWAY, PL_HW_BRIDLEWAY, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "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, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("highway", "construction", HIGHWAY, PL_HW_CONSTRUCTION, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -596,18 +600,18 @@ public class MapRenderingTypes {
// 4. railway
register(2, "railway", "rail", RAILWAY, 1, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "railway", "tram", RAILWAY, 2, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "light_rail", RAILWAY, 3, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "railway", "light_rail", RAILWAY, 3, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "abandoned", RAILWAY, 4, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "disused", RAILWAY, 5, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "railway", "subway", RAILWAY, 6, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "preserved", RAILWAY, 7, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "railway", "preserved", RAILWAY, 7, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "narrow_gauge", RAILWAY, 8, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "construction", RAILWAY, 9, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "monorail", RAILWAY, 10, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "funicular", RAILWAY, 11, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "platform", RAILWAY, 12, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "railway", "station", RAILWAY, 13, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "railway", "station", RAILWAY, 13, POLYGON_WITH_CENTER_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "turntable", RAILWAY, 14, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register("railway", "halt", RAILWAY, 22, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
@ -624,7 +628,7 @@ public class MapRenderingTypes {
register(1, "aeroway", "helipad", AEROWAY, 3, POLYGON_WITH_CENTER_TYPE, POINT_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
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(1, "aeroway", "apron", AEROWAY, 9, POLYLINE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "aeroway", "apron", AEROWAY, 9, POLYGON_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
register(1, "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$

View file

@ -109,6 +109,10 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
int shadowColor = 0;
float strokeWidth = 0;
float secondStrokeWidth = 0;
int secondColor = 0;
PathEffect secondEffect = null;
// polygon props
boolean showPolygon = true;
int colorAround = 0;
@ -169,8 +173,8 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
@Override
public int compare(MapRenderObject object1, MapRenderObject object2) {
int o1 = object1.getMapOrder();
int o2 = object2.getMapOrder();
float o1 = object1.getMapOrder();
float o2 = object2.getMapOrder();
return o1 < o2 ? -1 : (o1 == o2 ? 0 : 1);
}
@ -312,8 +316,10 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
int subtype = MapRenderingTypes.getPolygonSubType(obj.getType());
rc.color = Color.rgb(245, 245, 245);
rc.shader = null;
rc.colorAround = 0;
rc.showPolygon = true;
PolygonRenderer.renderPolygon(rc, zoom, type, subtype, this);
if(!rc.showPolygon){
return null;
@ -338,6 +344,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
paint.setShader(rc.shader);
canvas.drawPath(path, paint);
if(rc.colorAround != 0){
paintStroke.setPathEffect(null);
paintStroke.setColor(rc.colorAround);
paintStroke.setStrokeWidth(1);
canvas.drawPath(path, paintStroke);
@ -540,7 +547,20 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
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);
paintStroke.setStrokeWidth(rc.secondStrokeWidth);
canvas.drawPath(path, paintStroke);
}
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) {

View file

@ -17,6 +17,11 @@ public class PolygonRenderer {
rc.color = Color.rgb(236, 236, 236);
rc.colorAround = Color.rgb(176, 176, 176);
}
} else if (type == MapRenderingTypes.RAILWAY) {
if(subtype == 13){
rc.showPolygon = zoom >= 13;
rc.color = 0xffd4aaaa;
}
} else if (type == MapRenderingTypes.WATERWAY) {
if(subtype == 3){
rc.showPolygon = zoom >= 7;
@ -26,9 +31,12 @@ public class PolygonRenderer {
rc.color = 0xffb5d0d0;
}
} else if (type == MapRenderingTypes.AEROWAY) {
if(subtype == 1){
if(subtype == 1 || subtype == 10){
rc.showPolygon = zoom >= 12;
rc.color = 0x80cccccc;
} else if(subtype == 2){
rc.showPolygon = zoom >= 15;
rc.color = 0xffcc99ff;
} else if(subtype == 9){
// apron
rc.showPolygon = zoom >= 13;

View file

@ -16,92 +16,144 @@ public class PolylineRenderer {
int shadowLayer = 0;
int shadowColor = 0;
float strokeWidth = zoom >= 15 ? 1 : 0;
float secondStrokeWidth = 0;
int secondColor = 0;
PathEffect secondEffect = null;
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);
int layer = MapRenderingTypes.getWayLayer(objType);
boolean tunnel = layer == 1;
boolean bridge = layer == 2;
if (hwType == MapRenderingTypes.PL_HW_TRUNK || hwType == MapRenderingTypes.PL_HW_MOTORWAY) {
if (hwType == MapRenderingTypes.PL_HW_TRUNK) {
color = Color.rgb(168, 218, 168);
} else {
color = Color.rgb(128, 155, 192);
}
if(zoom < 10){
if (zoom >= 7) {
strokeWidth = 3.5f;
} else if (zoom == 6) {
strokeWidth = 2;
} else if (zoom == 5) {
strokeWidth = 1;
} else {
strokeWidth = 0;
}
} else if (zoom <= 12) {
strokeWidth = 3f;
} else if (zoom <= 14) {
strokeWidth = 7f;
}
} else if (hwType == MapRenderingTypes.PL_HW_PRIMARY) {
color = Color.rgb(235, 152, 154);
if (zoom < 7) {
strokeWidth = 0;
} else if (zoom == 7) {
strokeWidth = 1.5f;
} else if (zoom == 8 || zoom == 9) {
strokeWidth = 2f;
} else if (zoom <= 12) {
strokeWidth = 3f;
} else if (zoom <= 14) {
strokeWidth = 7f;
}
} else if (hwType == MapRenderingTypes.PL_HW_SECONDARY) {
color = Color.rgb(253, 214, 164);
if(zoom < 8){
strokeWidth = 0;
} else if(zoom <= 10){
strokeWidth = 1;
} else if(zoom <= 12){
strokeWidth = 2;
} else if(zoom <= 14){
strokeWidth = 6;
}
} else if (hwType == MapRenderingTypes.PL_HW_TERTIARY) {
color = Color.rgb(254, 254, 179);
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) {
if(zoom < 13){
strokeWidth = 0;
} else if(zoom < 14){
strokeWidth = 4;
shadowLayer = 1;
} else if(zoom < 15){
strokeWidth = 6;
shadowLayer = 1;
}
} else if (hwType == MapRenderingTypes.PL_HW_RESIDENTIAL || hwType == MapRenderingTypes.PL_HW_UNCLASSIFIED){
if(zoom < 14){
strokeWidth = 0;
} else if(zoom < 15){
strokeWidth = 4;
}
shadowLayer = 1;
shadowColor = Color.rgb(194, 194, 194);
color = Color.WHITE;
} else if (hwType == MapRenderingTypes.PL_HW_SERVICE || hwType == MapRenderingTypes.PL_HW_LIVING_STREET) {
shadowLayer = 1;
shadowColor = Color.rgb(194, 194, 194);
if(zoom < 15){
strokeWidth = 0;
}
color = Color.WHITE;
} else if (hwType == MapRenderingTypes.PL_HW_PEDESTRIAN) {
shadowLayer = 1;
shadowColor = Color.rgb(176, 176, 176);
color = Color.rgb(236, 236, 236);
} else {
carRoad = false;
strokeWidth = 2;
pathEffect = o.getDashEffect("2_2"); //$NON-NLS-1$
if (hwType == MapRenderingTypes.PL_HW_TRACK || hwType == MapRenderingTypes.PL_HW_PATH) {
color = Color.GRAY;
pathEffect = o.getDashEffect("6_2"); //$NON-NLS-1$
} else if (hwType == MapRenderingTypes.PL_HW_CYCLEWAY || hwType == MapRenderingTypes.PL_HW_BRIDLEWAY) {
color = Color.rgb(20, 20, 250);
if (hwType == MapRenderingTypes.PL_HW_CONSTRUCTION || hwType == MapRenderingTypes.PL_HW_PROPOSED) {
strokeWidth = zoom >= 15 ? (zoom == 15 ? 6 : 8) : 0;
color = 0xff99cccc;
secondColor = Color.WHITE;
secondStrokeWidth = strokeWidth - 1;
secondEffect = o.getDashEffect("8_6"); //$NON-NLS-1$
} else {
color = Color.rgb(250, 128, 115);
if (hwType == MapRenderingTypes.PL_HW_TRACK) {
strokeWidth = zoom >= 14 ? 2f : 0;
color = 0xff996600;
pathEffect = o.getDashEffect("4_3"); //$NON-NLS-1$
} else if (hwType == MapRenderingTypes.PL_HW_PATH) {
strokeWidth = zoom >= 14 ? 1f : 0;
color = Color.BLACK;
pathEffect = o.getDashEffect("6_3"); //$NON-NLS-1$
} else if (hwType == MapRenderingTypes.PL_HW_CYCLEWAY) {
strokeWidth = zoom >= 14 ? 2f : 0;
pathEffect = o.getDashEffect("2_2"); //$NON-NLS-1$
color = Color.BLUE;
} else if (hwType == MapRenderingTypes.PL_HW_BRIDLEWAY) {
strokeWidth = zoom >= 14 ? 2f : 0;
pathEffect = o.getDashEffect("2_2"); //$NON-NLS-1$
color = Color.GREEN;
} else if (hwType == MapRenderingTypes.PL_HW_BYWAY) {
strokeWidth = zoom >= 14 ? 2f : 0;
pathEffect = o.getDashEffect("4_3"); //$NON-NLS-1$
color = 0xffffcc00;
} else if (hwType == MapRenderingTypes.PL_HW_STEPS) {
color = Color.rgb(250, 128, 115);
strokeWidth = zoom >= 15 ? 5 : 0;
pathEffect = o.getDashEffect("1_2"); //$NON-NLS-1$
} else if (hwType == MapRenderingTypes.PL_HW_FOOTWAY) {
color = Color.rgb(250, 128, 115);
strokeWidth = zoom >= 15 ? 2 : 0;
pathEffect = o.getDashEffect("2_2"); //$NON-NLS-1$
}
}
}
showText = (carRoad && zoom > 12) || zoom > 16;
if (carRoad) {
if (zoom < 10) {
// done
strokeWidth = 0;
if (hwType <= MapRenderingTypes.PL_HW_SECONDARY) {
if (hwType == MapRenderingTypes.PL_HW_SECONDARY) {
strokeWidth = zoom >= 8 ? 1 : 0;
} else if (hwType == MapRenderingTypes.PL_HW_PRIMARY) {
if (zoom < 7) {
strokeWidth = 0;
} else if (zoom == 7) {
strokeWidth = 1.5f;
} else if (zoom == 8 || zoom == 9) {
strokeWidth = 2f;
}
} else if (hwType == MapRenderingTypes.PL_HW_TRUNK || hwType == MapRenderingTypes.PL_HW_MOTORWAY) {
if (zoom >= 7) {
strokeWidth = 3.5f;
} else if (zoom == 6) {
strokeWidth = 2;
} else if (zoom == 5) {
strokeWidth = 1;
} else {
strokeWidth = 0;
}
}
}
} else if (zoom <= 12) {
if (hwType <= MapRenderingTypes.PL_HW_SECONDARY) {
if (zoom < 12) {
strokeWidth = 2;
} else if (zoom == 12) {
strokeWidth = 3;
}
} else {
strokeWidth = 0;
}
} else {
int layer = MapRenderingTypes.getWayLayer(objType);
if (layer == 1) {
pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
}
if (zoom < 15) {
strokeWidth = 4.5f;
} else if (zoom < 16) {
strokeWidth = 6;
if (zoom >= 15) {
if (zoom < 16) {
strokeWidth = 9;
} else if (zoom == 16) {
strokeWidth = 8;
strokeWidth = 11;
} else if (zoom == 17) {
strokeWidth = 13;
} else if (zoom >= 18) {
@ -109,49 +161,149 @@ public class PolylineRenderer {
} else if (zoom >= 19) {
strokeWidth = 20;
}
if (hwType == MapRenderingTypes.PL_HW_SERVICE) {
strokeWidth -= 2;
if (hwType == MapRenderingTypes.PL_HW_SERVICE || hwType == MapRenderingTypes.PL_HW_LIVING_STREET) {
strokeWidth -= 3;
}
}
}
showText = (carRoad && zoom > 12) || zoom > 16;
if(bridge && zoom > 12){
if(secondStrokeWidth == 0){
shadowLayer = 2;
shadowColor = Color.BLACK;
}
}
if (tunnel && zoom > 12 && carRoad) {
pathEffect = o.getDashEffect("4_4"); //$NON-NLS-1$
}
}
break;
case MapRenderingTypes.RAILWAY: {
if (zoom < 10) {
if (subtype == 2) {
color = 0xffaaaaaa;
if (zoom < 7) {
strokeWidth = 0;
} else if (zoom == 7) {
strokeWidth = 1;
} else if (zoom == 8) {
strokeWidth = 1.5f;
} else if (zoom == 9) {
strokeWidth = 2;
}
} else {
int layer = MapRenderingTypes.getWayLayer(objType);
boolean tunnel = layer == 1;
boolean bridge = layer == 2;
if (subtype == 1) {
color = 0xffaaaaaa;
if (zoom < 7) {
strokeWidth = 0;
}
} else {
// TODO tunnel
strokeWidth = 2;
if (subtype == 6) {
color = Color.rgb(153, 153, 153);
if (zoom > 16) {
strokeWidth = 3;
} else if (zoom == 7) {
strokeWidth = 1;
} else if (zoom == 8) {
strokeWidth = 1.5f;
} else if (zoom <= 12) {
strokeWidth = 2;
if(tunnel){
pathEffect = o.getDashEffect("5_2"); //$NON-NLS-1$
}
pathEffect = o.getDashEffect("6_3"); //$NON-NLS-1$
} else if (subtype == 2) {
color = Color.rgb(62, 62, 62);
} else if (subtype == 1) {
color = Color.rgb(153, 153, 153);
if (zoom >= 16) {
strokeWidth = 3;
}
pathEffect = o.getDashEffect("7_7"); //$NON-NLS-1$
} else if(zoom == 13){
color = 0xff999999;
strokeWidth = 3;
secondColor = Color.WHITE;
secondStrokeWidth = 1;
secondEffect = o.getDashEffect("8_12"); //$NON-NLS-1$
} else {
color = Color.rgb(153, 153, 153);
color = 0xff999999;
strokeWidth = 3;
secondColor = Color.WHITE;
secondStrokeWidth = 1;
if(tunnel){
// TODO tunnel
} else if(bridge){
// TODO bridge
secondStrokeWidth = 5;
strokeWidth = 7;
} else {
secondEffect = o.getDashEffect("0_11_8_1"); //$NON-NLS-1$
}
}
} else if(subtype == 2 ) {
color = 0xff44444;
if(zoom < 13){
strokeWidth = 0;
} else if(zoom < 15){
strokeWidth = 1;
if(tunnel){
pathEffect = o.getDashEffect("5_3"); //$NON-NLS-1$
}
} else {
strokeWidth = 2;
if(tunnel){
pathEffect = o.getDashEffect("5_3"); //$NON-NLS-1$
}
}
} else if(subtype == 3){
color = 0xff666666;
if(zoom < 13){
strokeWidth = 0;
} else {
strokeWidth = 2;
if(tunnel){
pathEffect = o.getDashEffect("5_3"); //$NON-NLS-1$
}
}
} else if(subtype == 4 || subtype == 5 || subtype == 9){
if(zoom < 13){
strokeWidth = 0;
} else {
if(bridge){
strokeWidth = 4.5f;
color = Color.BLACK;
secondStrokeWidth = 2;
secondColor = Color.GRAY;
secondEffect =o.getDashEffect("4_2"); //$NON-NLS-1$
} else {
strokeWidth = 2;
color = Color.GRAY;
pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
}
}
} else if (subtype == 6) {
color = 0xff999999;
if(zoom < 13){
strokeWidth = 0;
} else {
strokeWidth = 2;
if(tunnel){
pathEffect = o.getDashEffect("5_3"); //$NON-NLS-1$
}
}
} else if (subtype == 7) {
if(zoom < 13){
strokeWidth = 0;
} else {
color = 0xff999999;
strokeWidth = 3;
secondColor = Color.WHITE;
secondStrokeWidth = 1;
secondEffect = o.getDashEffect("0_1_8_1"); //$NON-NLS-1$
}
} else if (subtype == 8 || subtype == 11) {
if(zoom < 15){
strokeWidth = 0;
} else {
strokeWidth = 2;
color = 0xff666666;
if(tunnel){
strokeWidth = 5;
pathEffect = o.getDashEffect("5_3"); //$NON-NLS-1$
secondColor = 0xffcccccc;
secondStrokeWidth = 3;
}
}
} else if (subtype == 10) {
if(zoom < 15){
strokeWidth = 0;
} else {
strokeWidth = 3;
color = 0xff777777;
pathEffect = o.getDashEffect("2_3"); //$NON-NLS-1$
}
} else if (subtype == 12) {
if(zoom < 15){
strokeWidth = 0;
} else {
strokeWidth = 3;
color = Color.GRAY;
}
}
}
@ -185,10 +337,6 @@ public class PolylineRenderer {
if (zoom < 13) {
strokeWidth = 2;
} else {
int layer = MapRenderingTypes.getWayLayer(objType);
if (layer == 1) {
pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
}
if (zoom == 13) {
strokeWidth = 3;
} else if (zoom == 14) {
@ -210,10 +358,6 @@ public class PolylineRenderer {
} else if (zoom < 15) {
strokeWidth = 1;
} else {
int layer = MapRenderingTypes.getWayLayer(objType);
if (layer == 1) {
pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
}
strokeWidth = 2;
}
break;
@ -237,6 +381,11 @@ public class PolylineRenderer {
break;
}
}
if(zoom > 12 && MapRenderingTypes.getWayLayer(objType) == 1){
pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$
secondStrokeWidth = strokeWidth - 2;
secondColor = Color.WHITE;
}
}
break;
case MapRenderingTypes.BARRIER: {
@ -276,6 +425,42 @@ public class PolylineRenderer {
}
}
break;
case MapRenderingTypes.AEROWAY: {
if(subtype == 7){
color = 0xffbbbbcc;
if(zoom < 11){
strokeWidth = 0;
} else if(zoom < 12){
strokeWidth = 2;
} else if(zoom < 13){
strokeWidth = 4;
} else if(zoom < 14){
strokeWidth = 7;
} else if(zoom < 15){
strokeWidth = 12;
} else {
strokeWidth = 18;
}
} else if(subtype == 8){
color = 0xffbbbbcc;
if(zoom < 12){
strokeWidth = 0;
} else if(zoom < 14){
strokeWidth = 1;
} else if(zoom < 15){
strokeWidth = 4;
} else {
strokeWidth = 6;
}
}
if(MapRenderingTypes.getWayLayer(objType) == 2 && zoom > 12){
if(secondStrokeWidth == 0){
shadowLayer = 2;
shadowColor = Color.BLACK;
}
}
}
break;
case MapRenderingTypes.AERIALWAY: {
// TODO shader on path doesn't work
if (zoom >= 12) {
@ -413,5 +598,8 @@ public class PolylineRenderer {
rc.shadowLayer = shadowLayer;
rc.showText = showText;
rc.strokeWidth = strokeWidth;
rc.secondColor = secondColor;
rc.secondEffect = secondEffect;
rc.secondStrokeWidth = secondStrokeWidth;
}
}

View file

@ -511,3 +511,90 @@
</LineSymbolizer>
</Rule>
</Style>
<Style name="cliffs">
<Rule>
&maxscale_zoom13;
&minscale_zoom14;
<Filter>[natural] = 'cliff'</Filter>
<LinePatternSymbolizer file="&symbols;/cliff.png" />
</Rule>
<Rule>
&maxscale_zoom15;
<Filter>[natural] = 'cliff'</Filter>
<LinePatternSymbolizer file="&symbols;/cliff2.png" />
</Rule>
<Rule>
&maxscale_zoom15;
<Filter>[man_made] = 'embankment'</Filter>
<LinePatternSymbolizer file="&symbols;/cliff.png" />
</Rule>
</Style>
<Style name="barriers">
<Rule>
&maxscale_zoom16;
<Filter>[natural]='hedge' or [barrier] = 'hedge'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#aed1a0</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
&maxscale_zoom16;
<Filter>[barrier] &lt;&gt; '' and not [barrier] = 'hedge'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">black</CssParameter>
<CssParameter name="stroke-width">0.4</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
&layer-shapefiles;
<Layer name="leisure" status="on" srs="&osm2pgsql_projection;">
<StyleName>leisure</StyleName>
<Datasource>
<Parameter name="table">
(select way,aeroway,amenity,landuse,leisure,man_made,military,"natural",power,shop,tourism,name,
case when religion in ('christian','jewish') then religion else 'INT-generic'::text end as religion
from &prefix;_polygon
where landuse is not null
or leisure is not null
or shop is not null
or aeroway in ('apron','aerodrome')
or amenity in ('parking','university','college','school','hospital','kindergarten','grave_yard')
or military in ('barracks','danger_area')
or "natural" in ('field','beach','heath','mud','wood')
or power in ('station','sub_station')
or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')
order by z_order,way_area desc
) as leisure
</Parameter>
&datasource-settings;
</Datasource>
</Layer>
<Layer name="sports_grounds" status="on" srs="&osm2pgsql_projection;">
<StyleName>sports_grounds</StyleName>
<Datasource>
<Parameter name="table">
(select way,leisure,
case when leisure='pitch' then 2
when leisure='track' then 1
else 0 end as prio
from &prefix;_polygon
where leisure in ('sports_centre','stadium','pitch','track')
order by z_order,prio,way_area desc
) as sports_grounds
</Parameter>
&datasource-settings;
</Datasource>
</Layer>
&layer-water;
&layer-water_features;

View file

@ -2179,93 +2179,6 @@
</Rule>
</Style>
<Style name="cliffs">
<Rule>
&maxscale_zoom13;
&minscale_zoom14;
<Filter>[natural] = 'cliff'</Filter>
<LinePatternSymbolizer file="&symbols;/cliff.png" />
</Rule>
<Rule>
&maxscale_zoom15;
<Filter>[natural] = 'cliff'</Filter>
<LinePatternSymbolizer file="&symbols;/cliff2.png" />
</Rule>
<Rule>
&maxscale_zoom15;
<Filter>[man_made] = 'embankment'</Filter>
<LinePatternSymbolizer file="&symbols;/cliff.png" />
</Rule>
</Style>
<Style name="barriers">
<Rule>
&maxscale_zoom16;
<Filter>[natural]='hedge' or [barrier] = 'hedge'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#aed1a0</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
&maxscale_zoom16;
<Filter>[barrier] &lt;&gt; '' and not [barrier] = 'hedge'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">black</CssParameter>
<CssParameter name="stroke-width">0.4</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="boundary">
<Rule>
&maxscale_zoom7;
&minscale_zoom9;
<PolygonSymbolizer>
<CssParameter name="fill">green</CssParameter>
<CssParameter name="fill-opacity">0.05</CssParameter>
</PolygonSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">green</CssParameter>
<CssParameter name="stroke-width">1.5</CssParameter>
<CssParameter name="stroke-dasharray">4,2</CssParameter>
<CssParameter name="stroke-opacity">0.15</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
&maxscale_zoom10;
&minscale_zoom12;
<PolygonSymbolizer>
<CssParameter name="fill">green</CssParameter>
<CssParameter name="fill-opacity">0.05</CssParameter>
</PolygonSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">green</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
<CssParameter name="stroke-dasharray">6,2</CssParameter>
<CssParameter name="stroke-opacity">0.15</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
&maxscale_zoom13;
&minscale_zoom18;
<LineSymbolizer>
<CssParameter name="stroke">green</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
<CssParameter name="stroke-dasharray">6,2</CssParameter>
<CssParameter name="stroke-opacity">0.15</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
&maxscale_zoom8;
&minscale_zoom9;
<TextSymbolizer name="name" fontset_name="bold-fonts" size="8" dy="-8" fill="#9c9" halo_radius="1" wrap_width="14"/>
</Rule>
<Rule>
&maxscale_zoom10;
&minscale_zoom11;
<TextSymbolizer name="name" fontset_name="bold-fonts" size="11" fill="#9c9" halo_radius="1" wrap_width="14"/>
</Rule>
</Style>
@ -2275,49 +2188,6 @@
&layer-shapefiles;
<Layer name="leisure" status="on" srs="&osm2pgsql_projection;">
<StyleName>leisure</StyleName>
<Datasource>
<Parameter name="table">
(select way,aeroway,amenity,landuse,leisure,man_made,military,"natural",power,shop,tourism,name,
case when religion in ('christian','jewish') then religion else 'INT-generic'::text end as religion
from &prefix;_polygon
where landuse is not null
or leisure is not null
or shop is not null
or aeroway in ('apron','aerodrome')
or amenity in ('parking','university','college','school','hospital','kindergarten','grave_yard')
or military in ('barracks','danger_area')
or "natural" in ('field','beach','heath','mud','wood')
or power in ('station','sub_station')
or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')
order by z_order,way_area desc
) as leisure
</Parameter>
&datasource-settings;
</Datasource>
</Layer>
<Layer name="sports_grounds" status="on" srs="&osm2pgsql_projection;">
<StyleName>sports_grounds</StyleName>
<Datasource>
<Parameter name="table">
(select way,leisure,
case when leisure='pitch' then 2
when leisure='track' then 1
else 0 end as prio
from &prefix;_polygon
where leisure in ('sports_centre','stadium','pitch','track')
order by z_order,prio,way_area desc
) as sports_grounds
</Parameter>
&datasource-settings;
</Datasource>
</Layer>
&layer-water;
&layer-water_features;
<Layer name="tunnels" status="on" srs="&osm2pgsql_projection;">
<StyleName>tunnels-casing</StyleName>
<StyleName>tunnels-fill</StyleName>