Merge pull request #47 from sonora/master
implement moreDetail switch (4)
This commit is contained in:
commit
c51c6aa80d
4 changed files with 52 additions and 46 deletions
|
@ -61,6 +61,7 @@ public class OsmandRenderingRulesParser {
|
|||
public float order = 0;
|
||||
public int orderType = -1;
|
||||
public Boolean nightMode = null;
|
||||
public Boolean moreDetail = null;
|
||||
|
||||
public String shader = null;
|
||||
|
||||
|
@ -229,6 +230,9 @@ public class OsmandRenderingRulesParser {
|
|||
if(toMerge.nightMode != null && mergeInto.nightMode == null){
|
||||
mergeInto.nightMode = toMerge.nightMode;
|
||||
}
|
||||
if(toMerge.moreDetail != null && mergeInto.moreDetail == null){
|
||||
mergeInto.moreDetail = toMerge.moreDetail;
|
||||
}
|
||||
if(toMerge.icon != null && mergeInto.icon == null){
|
||||
mergeInto.icon = toMerge.icon;
|
||||
}
|
||||
|
@ -348,6 +352,8 @@ public class OsmandRenderingRulesParser {
|
|||
state.order = Float.parseFloat(val);
|
||||
} else if(name.equals("nightMode")){ //$NON-NLS-1$
|
||||
state.nightMode = Boolean.parseBoolean(val);
|
||||
} else if(name.equals("moreDetail")){ //$NON-NLS-1$
|
||||
state.moreDetail = Boolean.parseBoolean(val);
|
||||
} else if(name.equals("icon")){ //$NON-NLS-1$
|
||||
state.icon = val;
|
||||
} else if(name.equals("color")){ //$NON-NLS-1$
|
||||
|
|
|
@ -97,14 +97,14 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
public Integer getPointIcon(String tag, String val, int zoom, boolean nightMode) {
|
||||
Integer i = getPointIconImpl(tag, val, zoom, nightMode);
|
||||
public Integer getPointIcon(String tag, String val, int zoom, boolean nightMode, boolean moreDetail) {
|
||||
Integer i = getPointIconImpl(tag, val, zoom, nightMode, moreDetail);
|
||||
if (i == null) {
|
||||
i = getPointIconImpl(tag, null, zoom, nightMode);
|
||||
i = getPointIconImpl(tag, null, zoom, nightMode, moreDetail);
|
||||
}
|
||||
if (i == null) {
|
||||
for (BaseOsmandRender d : dependRenderers) {
|
||||
i = d.getPointIcon(tag, val, zoom, nightMode);
|
||||
i = d.getPointIcon(tag, val, zoom, nightMode, moreDetail);
|
||||
if (i != null) {
|
||||
break;
|
||||
}
|
||||
|
@ -147,14 +147,14 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
return f;
|
||||
}
|
||||
|
||||
public boolean renderPolyline(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, int layer, boolean nightMode){
|
||||
boolean r = renderPolylineImpl(tag,val, zoom, rc, o, layer, nightMode);
|
||||
public boolean renderPolyline(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, int layer, boolean nightMode, boolean moreDetail){
|
||||
boolean r = renderPolylineImpl(tag,val, zoom, rc, o, layer, nightMode, moreDetail);
|
||||
if(!r){
|
||||
r = renderPolylineImpl(tag, null, zoom, rc, o, layer, nightMode);
|
||||
r = renderPolylineImpl(tag, null, zoom, rc, o, layer, nightMode, moreDetail);
|
||||
}
|
||||
if(!r){
|
||||
for(BaseOsmandRender d : dependRenderers){
|
||||
r = d.renderPolyline(tag, val, zoom, rc, o, layer, nightMode);
|
||||
r = d.renderPolyline(tag, val, zoom, rc, o, layer, nightMode, moreDetail);
|
||||
if (r) {
|
||||
break;
|
||||
}
|
||||
|
@ -162,14 +162,14 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
}
|
||||
return r;
|
||||
}
|
||||
public boolean renderPolygon(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, boolean nightMode){
|
||||
boolean r = renderPolygonImpl(tag,val, zoom, rc, o, nightMode);
|
||||
public boolean renderPolygon(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, boolean nightMode, boolean moreDetail){
|
||||
boolean r = renderPolygonImpl(tag,val, zoom, rc, o, nightMode, moreDetail);
|
||||
if(!r){
|
||||
r = renderPolygonImpl(tag, null, zoom, rc, o, nightMode);
|
||||
r = renderPolygonImpl(tag, null, zoom, rc, o, nightMode, moreDetail);
|
||||
}
|
||||
if(!r){
|
||||
for(BaseOsmandRender d : dependRenderers){
|
||||
r = d.renderPolygon(tag, val, zoom, rc, o, nightMode);
|
||||
r = d.renderPolygon(tag, val, zoom, rc, o, nightMode, moreDetail);
|
||||
if (r) {
|
||||
break;
|
||||
}
|
||||
|
@ -178,17 +178,17 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
return r;
|
||||
}
|
||||
|
||||
public String renderObjectText(String name, String tag, String val, RenderingContext rc, boolean ref, boolean nightMode) {
|
||||
public String renderObjectText(String name, String tag, String val, RenderingContext rc, boolean ref, boolean nightMode, boolean moreDetail) {
|
||||
if(name == null || name.length() == 0){
|
||||
return null;
|
||||
}
|
||||
String ret = renderObjectTextImpl(name, tag, val, rc, ref, nightMode);
|
||||
String ret = renderObjectTextImpl(name, tag, val, rc, ref, nightMode, moreDetail);
|
||||
if(ret == null){
|
||||
ret = renderObjectTextImpl(name, tag, null, rc, ref, nightMode);
|
||||
ret = renderObjectTextImpl(name, tag, null, rc, ref, nightMode, moreDetail);
|
||||
}
|
||||
if(ret == null){
|
||||
for(BaseOsmandRender d : dependRenderers){
|
||||
ret = d.renderObjectText(name, tag, val, rc, ref, nightMode);
|
||||
ret = d.renderObjectText(name, tag, val, rc, ref, nightMode, moreDetail);
|
||||
if (ret != null) {
|
||||
break;
|
||||
}
|
||||
|
@ -198,19 +198,19 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public boolean isObjectVisible(String tag, String val, int zoom, int type, boolean nightMode) {
|
||||
public boolean isObjectVisible(String tag, String val, int zoom, int type, boolean nightMode, boolean moreDetail) {
|
||||
if (type == 0) {
|
||||
// replace multipolygon with polygon
|
||||
type = 3;
|
||||
}
|
||||
if (isObjectVisibleImpl(tag, val, zoom, type, nightMode)) {
|
||||
if (isObjectVisibleImpl(tag, val, zoom, type, nightMode, moreDetail)) {
|
||||
return true;
|
||||
}
|
||||
if (isObjectVisibleImpl(tag, null, zoom, type, nightMode)) {
|
||||
if (isObjectVisibleImpl(tag, null, zoom, type, nightMode, moreDetail)) {
|
||||
return true;
|
||||
}
|
||||
for (BaseOsmandRender d : dependRenderers) {
|
||||
if (d.isObjectVisible(tag, val, zoom, type, nightMode)) {
|
||||
if (d.isObjectVisible(tag, val, zoom, type, nightMode, moreDetail)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
}
|
||||
|
||||
|
||||
private boolean isObjectVisibleImpl(String tag, String val, int zoom, int type, boolean nightMode) {
|
||||
FilterState fs = findBestFilterState(tag, val, zoom, nightMode, 0, null, 0, rules[type]);
|
||||
private boolean isObjectVisibleImpl(String tag, String val, int zoom, int type, boolean nightMode, boolean moreDetail) {
|
||||
FilterState fs = findBestFilterState(tag, val, zoom, nightMode, moreDetail, 0, null, 0, rules[type]);
|
||||
return fs != null;
|
||||
}
|
||||
|
||||
|
@ -243,8 +243,8 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
}
|
||||
|
||||
|
||||
private Integer getPointIconImpl(String tag, String val, int zoom, boolean nightMode) {
|
||||
FilterState fs = findBestFilterState(tag, val, zoom, nightMode, 0, null, 0, rules[OsmandRenderingRulesParser.POINT_STATE]);
|
||||
private Integer getPointIconImpl(String tag, String val, int zoom, boolean nightMode, boolean moreDetail) {
|
||||
FilterState fs = findBestFilterState(tag, val, zoom, nightMode, moreDetail, 0, null, 0, rules[OsmandRenderingRulesParser.POINT_STATE]);
|
||||
if (fs != null) {
|
||||
Integer i = RenderingIcons.getIcons().get(fs.icon);
|
||||
return i == null ? 0 : i;
|
||||
|
@ -252,7 +252,7 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
return null;
|
||||
}
|
||||
|
||||
private FilterState findBestFilterState(String tag, String val, int zoom, boolean nightMode, int layer, Boolean ref,
|
||||
private FilterState findBestFilterState(String tag, String val, int zoom, boolean nightMode, boolean moreDetail, int layer, Boolean ref,
|
||||
int nameLength, Map<String, Map<String, List<FilterState>>> mapTag) {
|
||||
if (mapTag != null) {
|
||||
Map<String, List<FilterState>> map = mapTag.get(tag);
|
||||
|
@ -299,8 +299,8 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
return null;
|
||||
}
|
||||
|
||||
private boolean renderPolylineImpl(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, int layer, boolean nightMode) {
|
||||
FilterState found = findBestFilterState(tag, val, zoom, nightMode, layer, null, 0, rules[OsmandRenderingRulesParser.LINE_STATE]);
|
||||
private boolean renderPolylineImpl(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, int layer, boolean nightMode, boolean moreDetail) {
|
||||
FilterState found = findBestFilterState(tag, val, zoom, nightMode, moreDetail, layer, null, 0, rules[OsmandRenderingRulesParser.LINE_STATE]);
|
||||
if (found != null) {
|
||||
// to not make transparent
|
||||
rc.main.color = Color.BLACK;
|
||||
|
@ -325,8 +325,8 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
|
||||
|
||||
|
||||
private boolean renderPolygonImpl(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, boolean nightMode) {
|
||||
FilterState f = findBestFilterState(tag, val, zoom, nightMode, 0, null, 0, rules[OsmandRenderingRulesParser.POLYGON_STATE]);
|
||||
private boolean renderPolygonImpl(String tag, String val, int zoom, RenderingContext rc, OsmandRenderer o, boolean nightMode, boolean moreDetail) {
|
||||
FilterState f = findBestFilterState(tag, val, zoom, nightMode, moreDetail, 0, null, 0, rules[OsmandRenderingRulesParser.POLYGON_STATE]);
|
||||
if (f != null) {
|
||||
if (f.shader != null) {
|
||||
Integer i = RenderingIcons.getIcons().get(f.shader);
|
||||
|
@ -378,10 +378,10 @@ public class BaseOsmandRender implements RenderingRuleVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
private String renderObjectTextImpl(String name, String tag, String val, RenderingContext rc, boolean ref, boolean nightMode) {
|
||||
FilterState fs = findBestFilterState(tag, val, rc.zoom, nightMode, 0, ref, name.length(), rules[OsmandRenderingRulesParser.TEXT_STATE]);
|
||||
private String renderObjectTextImpl(String name, String tag, String val, RenderingContext rc, boolean ref, boolean nightMode, boolean moreDetail) {
|
||||
FilterState fs = findBestFilterState(tag, val, rc.zoom, nightMode, moreDetail, 0, ref, name.length(), rules[OsmandRenderingRulesParser.TEXT_STATE]);
|
||||
if(fs == null){
|
||||
fs = findBestFilterState(tag, val, rc.zoom, nightMode, 0, ref, 0, rules[OsmandRenderingRulesParser.TEXT_STATE]);
|
||||
fs = findBestFilterState(tag, val, rc.zoom, nightMode, moreDetail, 0, ref, 0, rules[OsmandRenderingRulesParser.TEXT_STATE]);
|
||||
}
|
||||
if(fs != null){
|
||||
fillTextProperties(fs, rc);
|
||||
|
|
|
@ -213,7 +213,7 @@ public class MapRenderRepositories {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean loadVectorData(RectF dataBox, final int zoom, final BaseOsmandRender renderingType, final boolean nightMode){
|
||||
private boolean loadVectorData(RectF dataBox, final int zoom, final BaseOsmandRender renderingType, final boolean nightMode, final boolean moreDetail){
|
||||
double cBottomLatitude = dataBox.bottom;
|
||||
double cTopLatitude = dataBox.top;
|
||||
double cLeftLongitude = dataBox.left;
|
||||
|
@ -249,11 +249,11 @@ public class MapRenderRepositories {
|
|||
int type = types.get(j);
|
||||
int mask = type & 3;
|
||||
TagValuePair pair = root.decodeType(type);
|
||||
if (pair != null && renderingType.isObjectVisible(pair.tag, pair.value, zoom, mask, nightMode)) {
|
||||
if (pair != null && renderingType.isObjectVisible(pair.tag, pair.value, zoom, mask, nightMode, moreDetail)) {
|
||||
return true;
|
||||
}
|
||||
if(pair != null && mask == OsmandRenderingRulesParser.POINT_STATE &&
|
||||
renderingType.isObjectVisible(pair.tag, pair.value, zoom, OsmandRenderingRulesParser.TEXT_STATE, nightMode)){
|
||||
renderingType.isObjectVisible(pair.tag, pair.value, zoom, OsmandRenderingRulesParser.TEXT_STATE, nightMode, moreDetail)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ public class MapRenderRepositories {
|
|||
dataBox.bottom -= hi;
|
||||
}
|
||||
validateLatLonBox(dataBox);
|
||||
boolean loaded = loadVectorData(dataBox, requestedBox.getZoom(), renderingType, nightMode);
|
||||
boolean loaded = loadVectorData(dataBox, requestedBox.getZoom(), renderingType, nightMode, moreDetail);
|
||||
if (!loaded || checkWhetherInterrupted()) {
|
||||
return;
|
||||
}
|
||||
|
@ -393,9 +393,9 @@ public class MapRenderRepositories {
|
|||
currentRenderingContext.width = (int) (requestedBox.getTileWidth() * OsmandRenderer.TILE_SIZE);
|
||||
currentRenderingContext.height = (int) (requestedBox.getTileHeight() * OsmandRenderer.TILE_SIZE);
|
||||
currentRenderingContext.nightMode = nightMode;
|
||||
currentRenderingContext.moreDetail = prefs.SHOW_MORE_MAP_DETAIL.get();
|
||||
currentRenderingContext.highResMode = prefs.USE_HIGH_RES_MAPS.get();
|
||||
currentRenderingContext.mapTextSize = prefs.MAP_TEXT_SIZE.get();
|
||||
currentRenderingContext.moreDetail = prefs.SHOW_MORE_MAP_DETAIL.get();
|
||||
if (checkWhetherInterrupted()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -106,8 +106,8 @@ public class OsmandRenderer {
|
|||
/*package*/ static class RenderingContext {
|
||||
public boolean interrupted = false;
|
||||
public boolean nightMode = false;
|
||||
public boolean highResMode = false;
|
||||
public boolean moreDetail = false;
|
||||
public boolean highResMode = false;
|
||||
public float mapTextSize = 1;
|
||||
|
||||
List<TextDrawInfo> textToDraw = new ArrayList<TextDrawInfo>();
|
||||
|
@ -713,7 +713,7 @@ public class OsmandRenderer {
|
|||
rc.second.emptyLine();
|
||||
rc.main.color = Color.rgb(245, 245, 245);
|
||||
|
||||
boolean rendered = render.renderPolygon(tag, value, rc.zoom, rc, this, rc.nightMode);
|
||||
boolean rendered = render.renderPolygon(tag, value, rc.zoom, rc, this, rc.nightMode, rc.moreDetail);
|
||||
if(!rendered){
|
||||
return;
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ public class OsmandRenderer {
|
|||
rc.second.emptyLine();
|
||||
// rc.main.color = Color.rgb(245, 245, 245);
|
||||
|
||||
boolean rendered = render.renderPolygon(pair.tag, pair.value, zoom, rc, this, rc.nightMode);
|
||||
boolean rendered = render.renderPolygon(pair.tag, pair.value, zoom, rc, this, rc.nightMode, rc.moreDetail);
|
||||
if(!rendered){
|
||||
return;
|
||||
}
|
||||
|
@ -820,13 +820,13 @@ public class OsmandRenderer {
|
|||
|
||||
if (ref != null && ref.trim().length() > 0) {
|
||||
rc.clearText();
|
||||
ref = render.renderObjectText(ref, pair.tag, pair.value, rc, true, rc.nightMode);
|
||||
ref = render.renderObjectText(ref, pair.tag, pair.value, rc, true, rc.nightMode, rc.moreDetail);
|
||||
TextDrawInfo text = new TextDrawInfo(ref);
|
||||
text.fillProperties(rc, xText, yText);
|
||||
rc.textToDraw.add(text);
|
||||
|
||||
}
|
||||
name = render.renderObjectText(name, pair.tag, pair.value, rc, false, rc.nightMode);
|
||||
name = render.renderObjectText(name, pair.tag, pair.value, rc, false, rc.nightMode, rc.moreDetail);
|
||||
if (rc.textSize > 0 && name != null) {
|
||||
TextDrawInfo info = new TextDrawInfo(name);
|
||||
info.fillProperties(rc, xText, yText);
|
||||
|
@ -840,7 +840,7 @@ public class OsmandRenderer {
|
|||
return;
|
||||
}
|
||||
|
||||
Integer resId = render.getPointIcon(pair.tag, pair.value, rc.zoom, rc.nightMode);
|
||||
Integer resId = render.getPointIcon(pair.tag, pair.value, rc.zoom, rc.nightMode, rc.moreDetail);
|
||||
String name = null;
|
||||
if (renderText) {
|
||||
name = obj.getName();
|
||||
|
@ -888,7 +888,7 @@ public class OsmandRenderer {
|
|||
rc.second.emptyLine();
|
||||
rc.third.emptyLine();
|
||||
rc.adds = null;
|
||||
boolean res = render.renderPolyline(pair.tag, pair.value, rc.zoom, rc, this, layer, rc.nightMode);
|
||||
boolean res = render.renderPolyline(pair.tag, pair.value, rc.zoom, rc, this, layer, rc.nightMode, rc.moreDetail);
|
||||
if(rc.main.strokeWidth == 0 || !res){
|
||||
return;
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ public class OsmandRenderer {
|
|||
}
|
||||
if(ref != null && ref.trim().length() > 0){
|
||||
rc.clearText();
|
||||
ref = render.renderObjectText(ref, pair.tag, pair.value, rc, true, rc.nightMode);
|
||||
ref = render.renderObjectText(ref, pair.tag, pair.value, rc, true, rc.nightMode, rc.moreDetail);
|
||||
TextDrawInfo text = new TextDrawInfo(ref);
|
||||
text.fillProperties(rc, middlePoint.x, middlePoint.y);
|
||||
text.pathRotate = pathRotate;
|
||||
|
@ -983,7 +983,7 @@ public class OsmandRenderer {
|
|||
|
||||
if(name != null && name.trim().length() > 0){
|
||||
rc.clearText();
|
||||
name = render.renderObjectText(name, pair.tag, pair.value, rc, false, rc.nightMode);
|
||||
name = render.renderObjectText(name, pair.tag, pair.value, rc, false, rc.nightMode, rc.moreDetail);
|
||||
if (rc.textSize > 0) {
|
||||
TextDrawInfo text = new TextDrawInfo(name);
|
||||
if (!rc.showTextOnPath) {
|
||||
|
|
Loading…
Reference in a new issue