diff --git a/OsmAnd/src/net/osmand/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/render/OsmandRenderer.java index 7ea377547d..f0973f204b 100644 --- a/OsmAnd/src/net/osmand/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/render/OsmandRenderer.java @@ -344,7 +344,7 @@ public class OsmandRenderer { objCount++; } - if(objCount > 35){ + if(objCount > 25){ notifyListeners(notifyList); objCount = 0; } @@ -818,7 +818,7 @@ public class OsmandRenderer { return; } if(rc.zoom >= 16 && "highway".equals(pair.tag) && MapRenderingTypes.isOneWayWay(obj.getHighwayAttributes())){ //$NON-NLS-1$ - rc.adds = PolylineRenderer.getOneWayProperties(); + rc.adds = getOneWayProperties(); } @@ -947,270 +947,40 @@ public class OsmandRenderer { } } } - - - // TODO delete !!! - private void drawPolylineOld(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype, int wholeType) { - rc.main.emptyLine(); - rc.second.emptyLine(); - rc.third.emptyLine(); - rc.adds = null; - - PolylineRenderer.renderPolyline(type, subtype, wholeType, obj.getHighwayAttributes(), rc, this); - - - if(rc.main.strokeWidth == 0){ - return; - } - int length = obj.getPointsLength(); - if(length < 2){ - return; - } - rc.visible++; - - Path path = null; - float pathRotate = 0; - float xLength = 0; - float yLength = 0; - boolean inverse = false; - float xPrev = 0; - float yPrev = 0; - float xMid = 0; - float yMid = 0; - PointF middlePoint = new PointF(); - int middle = obj.getPointsLength() / 2; - - for (int i = 0; i < length ; i++) { - PointF p = calcPoint(obj, i, rc); - if(i == 0 || i == length -1){ - xMid += p.x; - yMid += p.y; - } - if (path == null) { - path = new Path(); - path.moveTo(p.x, p.y); - } else { - xLength += p.x - xPrev; // not abs - yLength += p.y - yPrev; // not abs - if(i == middle){ - middlePoint.set(p.x, p.y); - double rot = - Math.atan2(p.x - xPrev, p.y - yPrev) * 180 / Math.PI; - if (rot < 0) { - rot += 360; - } - if (rot < 180) { - rot += 180; - inverse = true; - } - pathRotate = (float) rot; - } - path.lineTo(p.x, p.y); - } - xPrev = p.x; - yPrev = p.y; - } - if (path != null) { - rc.main.updatePaint(paint); - canvas.drawPath(path, paint); - 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); - } - } - if (rc.adds != null) { - for (int i = 0; i < rc.adds.length; i++) { - rc.adds[i].updatePaint(paint); - canvas.drawPath(path, paint); - } - } - if (obj.getName() != null) { - String name = obj.getName(); - rc.clearText(); - name = TextRenderer.renderObjectText(name, subtype, type, rc.zoom, false, rc); - if(rc.textSize == 0 && rc.showAnotherText != null){ - name = TextRenderer.renderObjectText(rc.showAnotherText, subtype, type, rc.zoom, false, rc); - } - if (name != null && rc.textSize > 0) { - if (!rc.showTextOnPath) { - TextDrawInfo text = new TextDrawInfo(name); - text.fillProperties(rc, middlePoint.x, middlePoint.y); - rc.textToDraw.add(text); - } - if(rc.showAnotherText != null){ - name = TextRenderer.renderObjectText(rc.showAnotherText, subtype, type, rc.zoom, false, rc); - } - - if (rc.showTextOnPath && paintText.measureText(obj.getName()) < Math.max(Math.abs(xLength), Math.abs(yLength))) { - if (inverse) { - path.rewind(); - boolean st = true; - for (int i = obj.getPointsLength() - 1; i >= 0; i--) { - PointF p = calcPoint(obj, i, rc); - if (st) { - st = false; - path.moveTo(p.x, p.y); - } else { - path.lineTo(p.x, p.y); - } - } - } - - TextDrawInfo text = new TextDrawInfo(name); - text.fillProperties(rc, xMid / 2, yMid / 2); - text.pathRotate = pathRotate; - text.drawOnPath = path; - text.vOffset = rc.main.strokeWidth / 2 - 1; - rc.textToDraw.add(text); - - } - } - } - } - } - - private void drawPolygonOld(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype) { - float xText = 0; - float yText = 0; - int zoom = rc.zoom; - Path path = null; - rc.main.emptyArea(); - rc.second.emptyLine(); - rc.main.color = Color.rgb(245, 245, 245); - - PolygonRenderer.renderPolygon(rc, zoom, type, subtype, this); - if(!rc.main.fillArea){ - return; - } - rc.visible++; - int len = obj.getPointsLength(); - for (int i = 0; i < obj.getPointsLength(); i++) { - - PointF p = calcPoint(obj, i, rc); - xText += p.x; - yText += p.y; - if (path == null) { - path = new Path(); - path.moveTo(p.x, p.y); - } else { - path.lineTo(p.x, p.y); - } - } - - if (path != null && len > 0) { - xText /= len; - yText /= len; - - rc.main.updatePaint(paint); - canvas.drawPath(path, paint); - if (rc.second.strokeWidth != 0) { - rc.second.updatePaint(paint); - canvas.drawPath(path, paint); - } - String name = obj.getName(); - if(name != null){ - rc.clearText(); - name = TextRenderer.renderObjectText(name, subtype, type, rc.zoom, true, rc); - if (rc.textSize > 0 && name != null) { - TextDrawInfo info = new TextDrawInfo(name); - info.fillProperties(rc, xText, yText); - rc.textToDraw.add(info); - } - } - } - return; - } - - private void drawPointOld(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype, boolean renderText) { - int resId = PointRenderer.getPointBitmap(rc.zoom, type, subtype); - String name = null; - if (renderText) { - name = obj.getName(); - if (name != null) { - rc.clearText(); - name = TextRenderer.renderObjectText(name, subtype, type, rc.zoom, true, rc); - } - } - if(resId == 0 && name == null){ - return; - } - int len = obj.getPointsLength(); - rc.visible++; - PointF ps = new PointF(0, 0); - for (int i = 0; i < len; i++) { - PointF p = calcPoint(obj, i, rc); - ps.x += p.x; - ps.y += p.y; - } - if(len > 1){ - ps.x /= len; - ps.y /= len; - } - - if(resId != 0){ - IconDrawInfo ico = new IconDrawInfo(); - ico.x = ps.x; - ico.y = ps.y; - ico.resId = resId; - rc.iconsToDraw.add(ico); - } - if (name != null && rc.textSize > 0) { - TextDrawInfo info = new TextDrawInfo(name); - info.fillProperties(rc, ps.x, ps.y); - rc.textToDraw.add(info); - } + 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; - } - - private void drawMultiPolygonOld(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype) { - Path path = null; - rc.main.emptyArea(); - rc.second.emptyLine(); - rc.main.color = Color.rgb(245, 245, 245); - PolygonRenderer.renderPolygon(rc, rc.zoom, type, subtype, this); - if (!rc.main.fillArea) { - return; - } - rc.visible++; - path = new Path(); - for (int i = 0; i < ((MultyPolygon) obj).getBoundsCount(); i++) { - int cnt = ((MultyPolygon) obj).getBoundPointsCount(i); - float xText = 0; - float yText = 0; - for (int j = 0; j < cnt; j++) { - PointF p = calcMultiPolygonPoint((MultyPolygon) obj, j, i, rc); - xText += p.x; - yText += p.y; - if (j == 0) { - path.moveTo(p.x, p.y); - } else { - path.lineTo(p.x, p.y); - } - } - if (cnt > 0) { - String name = ((MultyPolygon) obj).getName(i); - if (name != null) { - rc.clearText(); - name = TextRenderer.renderObjectText(name, subtype, type, rc.zoom, true, rc); - if (rc.textSize > 0 && name != null) { - TextDrawInfo info = new TextDrawInfo(name); - info.fillProperties(rc, xText / cnt, yText / cnt); - rc.textToDraw.add(info); - } - } - } - } - rc.main.updatePaint(paint); - canvas.drawPath(path, paint); - if (rc.second.strokeWidth != 0) { - //rc.second.strokeWidth = 1.5f; - //rc.second.color = Color.BLACK; - - rc.second.updatePaint(paint); - canvas.drawPath(path, paint); + 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; } diff --git a/OsmAnd/src/net/osmand/render/PointRenderer.java b/OsmAnd/src/net/osmand/render/PointRenderer.java deleted file mode 100644 index a2d51510d4..0000000000 --- a/OsmAnd/src/net/osmand/render/PointRenderer.java +++ /dev/null @@ -1,384 +0,0 @@ -package net.osmand.render; - -import net.osmand.R; -import net.osmand.osm.MapRenderingTypes; - -public class PointRenderer { - - /** - * @return 0 if there is no icon for specified zoom - */ - public static int getPointBitmap(int zoom, int type, int subType) { - int resId = 0; - switch (type) { - case MapRenderingTypes.HIGHWAY: { - if (zoom >= 16) { - if (subType == 38) { - if (zoom > 16) { - resId = R.drawable.h_traffic_light; - } - } else if (subType == 40) { - 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; - } - } - } - break; - case 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; - } - } - } - break; - case 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; - } - } - } - break; - case MapRenderingTypes.WATERWAY: { - if (subType == 8) { - if (zoom > 14) { - resId = R.drawable.h_lock_gate; - } - } - } - break; - case 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; - } - } - } - break; - case MapRenderingTypes.POWER: { - if (zoom > 14) { - if (subType == 1) { - resId = R.drawable.h_power_tower; - } else if (subType == 7) { - resId = R.drawable.h_power_wind; - } - } - } - break; - case 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; - } - } - } - break; - case MapRenderingTypes.SHOP: { - if (zoom > 15) { - switch (subType) { - case 27: - case 65: - resId = R.drawable.h_shop_supermarket; - break; - case 17: - case 53: - resId = R.drawable.h_department_store; - break; - case 13: - resId = R.drawable.h_shop_clothes; - break; - case 31: - resId = R.drawable.h_shop_hairdresser; - break; - } - } - if (zoom > 16) { - switch (subType) { - case 48: - resId = R.drawable.h_shop_butcher; - break; - case 42: - resId = R.drawable.h_shop_bakery; - break; - case 20: - resId = R.drawable.h_shop_diy; - break; - case 16: - resId = R.drawable.h_shop_convenience; - break; - - } - } - } - break; - case MapRenderingTypes.TOURISM: { - if (zoom > 15) { - switch (subType) { - case 4: - resId = R.drawable.h_camp_site; - break; - case 5: - resId = R.drawable.h_caravan_park; - break; - case 6: - resId = R.drawable.h_camp_site; // picnic - break; - case 9: - resId = R.drawable.h_alpinehut; - break; - case 10: - case 11: - resId = R.drawable.h_guest_house; - break; - case 12: - case 14: - resId = R.drawable.h_hostel; - break; - case 13: - resId = R.drawable.h_hotel; - break; - case 15: - resId = R.drawable.h_museum; - break; - case 17: - resId = R.drawable.h_view_point; - break; - } - } - } - break; - case MapRenderingTypes.NATURAL: { - 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; - } - } - } - break; - case MapRenderingTypes.HISTORIC: { - if (zoom > 15) { - if (subType == 6) { - resId = R.drawable.h_memorial; - } else { - // something historic - resId = R.drawable.h_view_point; - } - - } - } - break; - case 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; - } - } - } - break; - case MapRenderingTypes.EMERGENCY: { - if (zoom > 15) { - if (subType == 10) { - resId = R.drawable.h_firestation; - } else if (subType == 7) { - resId = R.drawable.h_sosphone; - } - } - } - break; - case MapRenderingTypes.AMENITY_SUSTENANCE: { - if (zoom > 15) { - switch (subType) { - case 1: - resId = R.drawable.h_restaurant; - break; - case 2: - resId = R.drawable.h_cafe; - break; - case 4: - resId = R.drawable.h_fast_food; - break; - case 5: - resId = R.drawable.h_pub; - break; - case 7: - case 6: - resId = R.drawable.h_bar; - break; - case 8: - resId = R.drawable.h_food_drinkingtap; - break; - } - } - } - break; - case MapRenderingTypes.AMENITY_EDUCATION: { - if (zoom > 15) { - if (subType == 2 || subType == 3) { - resId = R.drawable.h_school; - } else if (subType == 4) { - resId = R.drawable.h_library; - } - } - } - break; - case MapRenderingTypes.AMENITY_TRANSPORTATION: { - if (subType == 1 || subType == 2) { - if (zoom > 14) { - resId = R.drawable.h_parking; - } - } else if (subType == 4) { - 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) { - if (zoom > 14) { - resId = R.drawable.h_bus_station; - } - } - } - break; - case MapRenderingTypes.AMENITY_FINANCE: { - if (subType == 1) { - if (zoom > 16) { - resId = R.drawable.h_atm; - } - } else if (subType == 2) { - if (zoom > 15) { - resId = R.drawable.h_bank; - } - } - } - break; - case MapRenderingTypes.AMENITY_HEALTHCARE: { - if (subType == 1) { - if (zoom > 15) { - resId = R.drawable.h_pharmacy; - } - } else if (subType == 2) { - if (zoom >= 15) { - resId = R.drawable.h_hospital; - } - } - } - break; - case MapRenderingTypes.AMENITY_ENTERTAINMENT: { - if (zoom >= 15) { - if (subType == 3) { - resId = R.drawable.h_cinema; - } else if (subType == 9) { - resId = R.drawable.h_theatre; - } - } - } - break; - case MapRenderingTypes.AMENITY_OTHER: { - if (zoom > 16) { - switch (subType) { - case 10: - resId = R.drawable.h_police; - break; - case 18: - resId = R.drawable.h_toilets; - break; - case 15: - resId = R.drawable.h_recycling; - break; - case 7: - resId = R.drawable.h_embassy; - break; - case 8: - resId = R.drawable.h_grave_yard; - break; - case 17: - resId = R.drawable.h_telephone; - break; - 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; - } -} diff --git a/OsmAnd/src/net/osmand/render/PolygonRenderer.java b/OsmAnd/src/net/osmand/render/PolygonRenderer.java deleted file mode 100644 index f18352000e..0000000000 --- a/OsmAnd/src/net/osmand/render/PolygonRenderer.java +++ /dev/null @@ -1,322 +0,0 @@ -package net.osmand.render; - -import net.osmand.R; -import net.osmand.osm.MapRenderingTypes; -import net.osmand.render.OsmandRenderer.RenderingContext; -import android.graphics.Color; - -public class PolygonRenderer { - - public static void renderPolygon(RenderingContext rc, int zoom, int type, int subtype, OsmandRenderer o) { - if (type == MapRenderingTypes.HIGHWAY) { - rc.main.fillArea = zoom >= 15; - if (subtype == MapRenderingTypes.PL_HW_SERVICE || subtype == MapRenderingTypes.PL_HW_UNCLASSIFIED - || subtype == MapRenderingTypes.PL_HW_RESIDENTIAL) { - rc.second.color = Color.rgb(194, 194, 194); - rc.second.strokeWidth = 1; - rc.main.color= Color.WHITE; - } else if(subtype == MapRenderingTypes.PL_HW_PEDESTRIAN || subtype == MapRenderingTypes.PL_HW_FOOTWAY){ - rc.main.color = Color.rgb(236, 236, 236); - rc.second.color = Color.rgb(176, 176, 176); - rc.second.strokeWidth = 1; - } - } else if (type == MapRenderingTypes.RAILWAY) { - if(subtype == 13){ - rc.main.fillArea = zoom >= 13; - rc.main.color = 0xffd4aaaa; - } - } else if (type == MapRenderingTypes.WATERWAY) { - if(subtype == 3){ - rc.main.fillArea = zoom >= 7; - rc.main.color = 0xffb5d0d0; - } else if(subtype == 4 || subtype == 7 || subtype == 13){ - rc.main.fillArea = zoom >= 10; - rc.main.color = 0xffb5d0d0; - } - } else if (type == MapRenderingTypes.AEROWAY) { - if(subtype == 1 || subtype == 10){ - rc.main.fillArea = zoom >= 12; - rc.main.color = 0x80cccccc; - } else if(subtype == 2){ - rc.main.fillArea = zoom >= 15; - rc.main.color = 0xffcc99ff; - } else if(subtype == 9){ - // apron - rc.main.fillArea = zoom >= 13; - rc.main.color = 0xffe9d1ff; - } - } else if (type == MapRenderingTypes.POWER) { - if(subtype == 5 || subtype == 6){ - rc.main.fillArea = zoom >= 13; - rc.main.color = 0xffbbbbbb; - } - } else if (type == MapRenderingTypes.MAN_MADE) { - rc.main.fillArea = zoom > 15; - if (subtype == MapRenderingTypes.SUBTYPE_BUILDING) { - rc.main.color = Color.rgb(188, 169, 169); - } else if (subtype == MapRenderingTypes.SUBTYPE_GARAGES) { - rc.main.color = Color.rgb(221, 221, 221); - } - } else if (type == MapRenderingTypes.TOURISM) { - if (subtype == 2 || subtype == 7) { - rc.main.fillArea = zoom >= 13; - rc.main.color = 0xfff2caea; - if(subtype == 7){ - rc.second.color = 0xff734a08; - rc.second.pathEffect = o.getDashEffect("9_3"); //$NON-NLS-1$ - if(zoom <= 15){ - rc.second.strokeWidth = 1; - } else { - rc.second.strokeWidth = 2; - } - } - } else if(subtype >= 4 && subtype <= 6){ - rc.main.fillArea = zoom >= 15; - rc.main.color = 0xa0ccff99; - } else if(subtype == 8){ - rc.main.fillArea = zoom >= 13; - rc.main.shader = o.getShader(R.drawable.h_zoo); - } - - } else if (type == MapRenderingTypes.NATURAL) { - switch(subtype){ - case 2 : - rc.main.fillArea = zoom >= 13; - rc.main.shader = o.getShader(R.drawable.h_beach); - case 5: - rc.main.fillArea = zoom >= 6; - rc.main.color = 0xffb5d0d0; - break; - case 7: - rc.main.fillArea = zoom >= 8; - rc.main.shader = o.getShader(R.drawable.h_glacier); - if(zoom >= 10){ - rc.second.color = 0xff99ccff; - rc.second.strokeWidth = 2; - } - break; - case 8: - rc.main.fillArea = zoom >= 10; - rc.main.color = 0xffffffc0; - break; - case 9: - rc.main.fillArea = zoom >= 11; - rc.main.color = 0xfff2efe9; - break; - case 11: - case 22: - rc.main.fillArea = zoom >= 13; - rc.main.shader = o.getShader(R.drawable.h_marsh); - break; - case 12 : - rc.main.fillArea = zoom >= 13; - rc.main.shader = o.getShader(R.drawable.h_mud); - break; - case 16 : - rc.main.fillArea = zoom >= 13; - rc.main.shader = o.getShader(R.drawable.h_scrub); - break; - case 21: - rc.main.fillArea = zoom >= 7; - rc.main.color = 0xffb5d0d0; - break; - case 23 : - rc.main.fillArea = zoom >= 8; - rc.main.color = 0xffaed1a0; - break; - } - } else if (type == MapRenderingTypes.LANDUSE) { - switch (subtype) { - case 1: - rc.main.fillArea = zoom >= 13; - rc.main.color = 0xffc8b084; - break; - case 2: - rc.main.fillArea = zoom >= 10; - rc.main.color = 0xffb5d0d0; - break; - case 4: - rc.main.fillArea = zoom >= 12; - if(zoom >= 12 && zoom <= 14){ - rc.main.color = 0xffaacbaf; - } else if (zoom > 14) { - rc.main.shader = o.getShader(R.drawable.h_grave_yard); - } - break; - case 5: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xffefc8c8; - break; - case 3: - case 6: - case 13: - case 16: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xff9d9d6c; - break; - case 7: - rc.main.fillArea = zoom >= 11; - rc.main.color = 0xffead8bd; - break; - case 9: - rc.main.fillArea = zoom >= 11; - rc.main.color = 0xffddbf92; - break; - case 10: - rc.main.fillArea = zoom >= 8; - if(zoom <= 13){ - rc.main.color = 0xff8dc56c; - } else { - rc.main.shader = o.getShader(R.drawable.h_forest); - } - break; - case 11 : - rc.main.color = Color.rgb(223, 209, 214); - rc.main.fillArea = zoom >= 16; - break; - case 12: - case 17: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xffcfeca8; - break; - case 15: - case 20: - rc.main.color = 0xffdfd1d6; - rc.main.fillArea = zoom >= 12; - break; - case 18: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xa0ffa8a8; - break; - case 19: - rc.main.fillArea = zoom >= 10; - rc.main.shader = o.getShader(R.drawable.h_orchard); - break; - case 21: - rc.main.color = 0xffcfeca8; - rc.main.fillArea = zoom >= 12; - break; - case 22 : - rc.main.fillArea = zoom >= 7; - rc.main.color = 0xffb5d0d0; - break; - case 23: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xffdddddd; - break; - case 24: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xffcfeca8; - if(zoom >= 15){ - rc.second.color = Color.RED; - rc.second.strokeWidth = 1; - } - break; - case 26: - rc.main.fillArea = zoom >= 13; - rc.main.shader = o.getShader(R.drawable.h_quarry2); - break; - case 27: - rc.main.fillArea = zoom >= 10; - if(zoom < 14){ - rc.main.color = 0xffabdf96; - } else { - rc.main.shader = o.getShader(R.drawable.h_vineyard); - } - break; - case 28: - rc.main.fillArea = zoom >= 11; - rc.main.color = 0x30666600; - if(zoom >= 14){ - rc.second.strokeWidth= 1; - rc.second.color = 0x60666600; - } - break; - } - } else if (type == MapRenderingTypes.MILITARY) { - if(subtype == 3){ - rc.main.fillArea = zoom >= 13; - rc.main.color = 0xffff8f8f; - } else if(subtype == 4){ - rc.main.fillArea = zoom >= 10; - rc.main.shader = o.getShader(R.drawable.h_danger); - } - } else if (type == MapRenderingTypes.LEISURE) { - switch (subtype) { - case 2: - case 4: - rc.main.fillArea = zoom >= 13; - rc.main.color = 0xff33cc99; - break; - case 3: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xffb5e3b5; - break; - case 5: - rc.main.fillArea = zoom >= 12; - rc.second.color = 0xff888888; - rc.second.strokeWidth = 1; - rc.main.color = 0xff74dcba; - break; - case 6: - rc.main.color = 0xff8ad3af; - rc.main.fillArea = zoom >= 13; - rc.second.color = 0xff888888; - rc.second.strokeWidth = 1; - break; - case 11: - if(zoom < 8){ - rc.main.fillArea = false; - } else if(zoom >= 8 && zoom <= 12){ - rc.main.fillArea = true; - rc.main.color = 0xffabdf96; - } else { - rc.main.fillArea = true; - rc.main.shader = o.getShader(R.drawable.h_nr); - } - break; - case 12: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xb0b6fdb6; - break; - case 13: - rc.main.color = 0xffccfff1; - rc.main.fillArea = zoom >= 15; - break; - case 14: - case 15: - rc.main.fillArea = zoom >= 12; - rc.main.color = 0xffcfeca8; - break; - } - } else if (type == MapRenderingTypes.AMENITY_HEALTHCARE) { - if (subtype == 2) { - rc.main.fillArea = zoom >= 15; - rc.main.color = 0xfff0f0d8; - rc.second.color = Color.rgb(212, 168, 158); - rc.second.strokeWidth = 1; - } - } else if (type == MapRenderingTypes.AMENITY_TRANSPORTATION) { - if (subtype == 1 || subtype == 2) { - rc.main.color = Color.rgb(246, 238, 183); - rc.main.fillArea = zoom >= 15; - } - } else if (type == MapRenderingTypes.AMENITY_ENTERTAINMENT) { - if (subtype == 3) { - rc.main.color = Color.rgb(204, 153, 153); - rc.main.fillArea = zoom >= 15; - } - } else if (type == MapRenderingTypes.AMENITY_EDUCATION) { - if(subtype == 1 || subtype == 2 || subtype == 3 || subtype == 5){ - rc.main.fillArea = zoom >= 15; - rc.main.color = 0xfff0f0d8; - rc.second.color = Color.rgb(212, 168, 158); - rc.second.strokeWidth = 1; - } else { - // draw as building education - rc.main.color = Color.rgb(188, 169, 169); - rc.main.fillArea = zoom >= 16; - } - } - } -} diff --git a/OsmAnd/src/net/osmand/render/PolylineRenderer.java b/OsmAnd/src/net/osmand/render/PolylineRenderer.java deleted file mode 100644 index 4f9a0de465..0000000000 --- a/OsmAnd/src/net/osmand/render/PolylineRenderer.java +++ /dev/null @@ -1,676 +0,0 @@ -package net.osmand.render; - -import net.osmand.osm.MapRenderingTypes; -import net.osmand.render.OsmandRenderer.RenderingContext; -import net.osmand.render.OsmandRenderer.RenderingPaintProperties; -import android.graphics.Color; -import android.graphics.DashPathEffect; -import android.graphics.PathEffect; -import android.graphics.Paint.Cap; - -public class PolylineRenderer { - - public static void renderPolyline(int type, int subtype, int wholeType, int highwayAttributes,RenderingContext rc, OsmandRenderer o){ - int zoom = rc.zoom; - int color = Color.BLACK; - PathEffect pathEffect = null; - float strokeWidth = zoom >= 15 ? 1 : 0; - int shadowLayer = 0; - int shadowColor = 0; - - switch (type) { - case MapRenderingTypes.HIGHWAY: { - int hwType = subtype; - boolean carRoad = true; - int layer = MapRenderingTypes.getWayLayer(wholeType); - 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); - 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; - if (hwType == MapRenderingTypes.PL_HW_CONSTRUCTION || hwType == MapRenderingTypes.PL_HW_PROPOSED) { - strokeWidth = zoom >= 15 ? (zoom == 15 ? 6 : 8) : 0; - color = 0xff99cccc; - rc.second.color = Color.WHITE; - rc.second.strokeWidth = strokeWidth - 1; - rc.second.pathEffect = o.getDashEffect("8_6"); //$NON-NLS-1$ - } else { - 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$ - } - } - } - - if (carRoad) { - if (zoom >= 15) { - if (zoom < 16) { - strokeWidth = 9; - } else if (zoom == 16) { - strokeWidth = 11; - } else if (zoom == 17) { - strokeWidth = 13; - } else if (zoom >= 18) { - strokeWidth = 16; - } else if (zoom >= 19) { - strokeWidth = 20; - } - if (hwType == MapRenderingTypes.PL_HW_SERVICE || hwType == MapRenderingTypes.PL_HW_LIVING_STREET) { - strokeWidth -= 3; - } - } - } - if(bridge && zoom > 14){ - if(rc.second.strokeWidth == 0){ - rc.second.color = color; - 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(highwayAttributes)){ - rc.adds = getOneWayProperties(); - - } - - if (tunnel && zoom > 12 && carRoad) { - pathEffect = o.getDashEffect("4_4"); //$NON-NLS-1$ - } - } - break; - case MapRenderingTypes.RAILWAY: { - int layer = MapRenderingTypes.getWayLayer(wholeType); - boolean tunnel = layer == 1; - boolean bridge = layer == 2; - if (subtype == 1) { - color = 0xffaaaaaa; - if (zoom < 7) { - strokeWidth = 0; - } 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$ - } - } else if(zoom == 13){ - color = 0xff999999; - strokeWidth = 3; - rc.second.color = Color.WHITE; - rc.second.strokeWidth = 1; - rc.second.pathEffect = o.getDashEffect("8_12"); //$NON-NLS-1$ - } else { - color = 0xff999999; - strokeWidth = 3; - rc.second.color = Color.WHITE; - rc.second.strokeWidth = 1; - if(tunnel){ - rc.second.strokeWidth = 3; - rc.second.pathEffect = o.getDashEffect("4_4"); //$NON-NLS-1$ - } else if(bridge){ - rc.third.color = color; - rc.third.strokeWidth = 1; - rc.third.pathEffect = o.getDashEffect("12_8_1_0"); //$NON-NLS-1$ - rc.second.strokeWidth = 4; - strokeWidth = 5; - color = Color.BLACK ; - } else { - rc.second.strokeWidth = 1; - rc.second.pathEffect = o.getDashEffect("0_11_8_1"); //$NON-NLS-1$ - } - - } - } else if(subtype == 2 ) { - color = 0xff444444; - 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; - rc.second.strokeWidth = 2; - rc.second.color = Color.GRAY; - rc.second.pathEffect = 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; - rc.second.color = Color.WHITE; - rc.second.strokeWidth = 1; - rc.second.pathEffect = 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$ - rc.second.color = 0xffcccccc; - rc.second.strokeWidth = 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; - } - } - } - break; - case MapRenderingTypes.WATERWAY: { - if (zoom <= 10) { - strokeWidth = 0; - // draw rivers & canals - if (subtype == 2 || subtype == 4) { - color = 0xffb5d0d0; - if (zoom == 10) { - strokeWidth = 2; - } else if (zoom == 9) { - strokeWidth = 1; - } - } - } else { - switch (subtype) { - case 1: - if (zoom >= 15) { - color = 0xffb5d0d0; - strokeWidth = 2; - } else { - strokeWidth = 0; - } - break; - case 2: - case 4: - color = 0xffb5d0d0; - - if (zoom < 13) { - strokeWidth = 2; - } else { - if (zoom == 13) { - strokeWidth = 3; - } else { - if (zoom == 14) { - strokeWidth = 5; - } else if (zoom == 15 || zoom == 16) { - strokeWidth = 6; - } else if (zoom == 17) { - strokeWidth = 10; - } else if (zoom == 18) { - strokeWidth = 12; - } - } - } - break; - case 5: - case 6: - color = 0xffb5d0d0; - if (zoom < 13) { - strokeWidth = 0; - } else if (zoom < 15) { - strokeWidth = 1; - } else { - strokeWidth = 2; - } - break; - - case 11: - if (zoom < 15) { - strokeWidth = 0; - } else { - strokeWidth = 2; - color = 0xffaaaaaa; - } - break; - case 12: - if (zoom >= 13) { - strokeWidth = 2; - } else { - strokeWidth = 0; - } - color = 0xffb5d0d0; - default: - break; - } - } - if(zoom > 12 && MapRenderingTypes.getWayLayer(wholeType) == 1){ - pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$ - rc.second.strokeWidth = strokeWidth - 2; - rc.second.color = Color.WHITE; - } - } - break; - case MapRenderingTypes.BARRIER: { - 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 { - if (subtype == 1) { - strokeWidth = zoom >= 16 ? 3 : 0; - color = 0xffaed1a0; - } else { - strokeWidth = zoom >= 16 ? 1 : 0; - color = Color.BLACK; - } - } - } - break; - case MapRenderingTypes.POWER: { - 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; - } - } - 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(wholeType) == 2 && zoom > 12){ - if(rc.second.strokeWidth == 0){ - rc.second.color = color; - 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; - } - - } - } - } - break; - case MapRenderingTypes.AERIALWAY: { - // 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)); - } - } - } - break; - case MapRenderingTypes.MAN_MADE: { - if (subtype == 8) { - // breakwater, groyone - color = 0xffaaaaaa; - if (zoom < 12) { - strokeWidth = 0; - } else if (zoom < 14) { - strokeWidth = 1; - } else if (zoom < 16) { - strokeWidth = 2; - } else { - strokeWidth = 4; - } - } else if (subtype == 9) { - // pier - color = 0xfff2efe9; - if (zoom < 12) { - strokeWidth = 0; - } else if (zoom < 14) { - strokeWidth = 1; - } else if (zoom < 16) { - strokeWidth = 3; - } else { - strokeWidth = 6; - } - } - } - break; - case MapRenderingTypes.LEISURE: { - if (subtype == 8) { - if (zoom < 13) { - strokeWidth = 0; - } else if (zoom < 16) { - color = Color.BLUE; - strokeWidth = 1; - pathEffect = o.getDashEffect("6_2"); //$NON-NLS-1$ - } else { - color = Color.BLUE; - strokeWidth = 2; - pathEffect = o.getDashEffect("6_2"); //$NON-NLS-1$ - } - } else if (subtype == 5) { - if (zoom >= 13) { - color = 0xff888888; - strokeWidth = 1; - } else { - strokeWidth = 0; - } - } - } - break; - case MapRenderingTypes.ADMINISTRATIVE: { - color = 0xFF800080; - if (subtype == 29 || subtype == 30) { - // admin level 9, 10 - if (zoom > 12) { - pathEffect = o.getDashEffect("3_2"); //$NON-NLS-1$ - strokeWidth = 1; - if (zoom > 16) { - strokeWidth = 2; - } - } else { - strokeWidth = 0; - } - } else if (subtype == 28 || subtype == 27) { - // admin level 7, 8 - if (zoom > 11) { - pathEffect = o.getDashEffect("5_2"); //$NON-NLS-1$ - strokeWidth = 2; - } else { - strokeWidth = 0; - } - } else if (subtype == 25 || subtype == 26) { - // admin level 5, 6 - 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) { - // admin level 4 - pathEffect = o.getDashEffect("4_3"); //$NON-NLS-1$ - if (zoom >= 4 && zoom <= 6) { - strokeWidth = 0.6f; - } else if (zoom >= 7 && zoom <= 10) { - strokeWidth = 2; - } 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 = 2; - } else if (zoom >= 7 && zoom <= 9) { - strokeWidth = 3; - } else if (zoom > 9) { - if (subtype == 22) { - strokeWidth = 6; - } else { - strokeWidth = 5; - pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$ - } - } else { - strokeWidth = 0; - } - } else if(subtype == 19){ - color = 0xa009dd09; - if(zoom < 7){ - strokeWidth = 0; - } else if(zoom < 10){ - strokeWidth =1.5f; - pathEffect = o.getDashEffect("4_2"); //$NON-NLS-1$ - } else { - strokeWidth =3f; - pathEffect = o.getDashEffect("6_2"); //$NON-NLS-1$ - } - } - } - break; - default: - break; - } - - rc.main.color = color; - rc.main.pathEffect = pathEffect; - rc.main.shadowColor = shadowColor; - rc.main.shadowLayer = shadowLayer; - rc.main.strokeWidth = strokeWidth; - - } - - 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; - } - -}