Merge remote-tracking branch 'origin/r3.3'

This commit is contained in:
Chumva 2019-03-14 18:54:31 +02:00
commit c7d5933e11
4 changed files with 107 additions and 75 deletions

View file

@ -35,6 +35,19 @@ public class RenderingRuleSearchRequest {
saveState(); saveState();
} }
public RenderingRuleSearchRequest(RenderingRuleSearchRequest renderingRuleSearchRequest) {
this.storage = renderingRuleSearchRequest.storage;
this.props = renderingRuleSearchRequest.props;
this.values = new int[renderingRuleSearchRequest.values.length];
this.fvalues = new float[renderingRuleSearchRequest.fvalues.length];
this.object = renderingRuleSearchRequest.object;
this.searchResult = renderingRuleSearchRequest.searchResult;
this.ALL = renderingRuleSearchRequest.ALL;
System.arraycopy(renderingRuleSearchRequest.values, 0, values, 0, renderingRuleSearchRequest.values.length);
System.arraycopy(renderingRuleSearchRequest.fvalues, 0, fvalues, 0, renderingRuleSearchRequest.fvalues.length);
saveState();
}
public void setStringFilter(RenderingRuleProperty p, String filter) { public void setStringFilter(RenderingRuleProperty p, String filter) {
assert p.isInputProperty(); assert p.isInputProperty();
values[p.getId()] = storage.getDictionaryValue(filter); values[p.getId()] = storage.getDictionaryValue(filter);

View file

@ -16,36 +16,39 @@ public class RouteStatistics {
private final RenderingRulesStorage currentRenderer; private final RenderingRulesStorage currentRenderer;
private final RenderingRulesStorage defaultRenderer; private final RenderingRulesStorage defaultRenderer;
private final boolean nightMode; private final RenderingRuleSearchRequest currentSearchRequest;
private final RenderingRuleSearchRequest defaultSearchRequest;
private RouteStatistics(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, boolean nightMode) {
private RouteStatistics(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, RenderingRuleSearchRequest currentSearchRequest, RenderingRuleSearchRequest defaultSearchRequest) {
this.route = route; this.route = route;
this.currentRenderer = currentRenderer; this.currentRenderer = currentRenderer;
this.defaultRenderer = defaultRenderer; this.defaultRenderer = defaultRenderer;
this.nightMode = nightMode; this.defaultSearchRequest = defaultSearchRequest;
this.currentSearchRequest = currentSearchRequest;
} }
public static RouteStatistics newRouteStatistic(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, boolean nightMode) { public static RouteStatistics newRouteStatistic(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, RenderingRuleSearchRequest currentSearchRequest, RenderingRuleSearchRequest defaultSearchRequest) {
return new RouteStatistics(route, currentRenderer, defaultRenderer, nightMode); return new RouteStatistics(route, currentRenderer, defaultRenderer, currentSearchRequest, defaultSearchRequest);
} }
public Statistics getRouteSurfaceStatistic() { public Statistics getRouteSurfaceStatistic() {
RouteStatisticComputer statisticComputer = new RouteSurfaceStatisticComputer(route, currentRenderer, defaultRenderer, nightMode); RouteStatisticComputer statisticComputer = new RouteSurfaceStatisticComputer(route, currentRenderer, defaultRenderer, currentSearchRequest, defaultSearchRequest);
return statisticComputer.computeStatistic(); return statisticComputer.computeStatistic();
} }
public Statistics getRouteSmoothnessStatistic() { public Statistics getRouteSmoothnessStatistic() {
RouteStatisticComputer statisticComputer = new RouteSmoothnessStatisticComputer(route, currentRenderer, defaultRenderer, nightMode); RouteStatisticComputer statisticComputer = new RouteSmoothnessStatisticComputer(route, currentRenderer, defaultRenderer, currentSearchRequest, defaultSearchRequest);
return statisticComputer.computeStatistic(); return statisticComputer.computeStatistic();
} }
public Statistics getRouteClassStatistic() { public Statistics getRouteClassStatistic() {
RouteStatisticComputer statisticComputer = new RouteClassStatisticComputer(route, currentRenderer, defaultRenderer, nightMode); RouteStatisticComputer statisticComputer = new RouteClassStatisticComputer(route, currentRenderer, defaultRenderer, currentSearchRequest, defaultSearchRequest);
return statisticComputer.computeStatistic(); return statisticComputer.computeStatistic();
} }
public Statistics getRouteSteepnessStatistic(List<Incline> inclines) { public Statistics getRouteSteepnessStatistic(List<Incline> inclines) {
RouteStatisticComputer statisticComputer = new RouteSteepnessStatisticComputer(inclines, currentRenderer, defaultRenderer, nightMode); RouteStatisticComputer statisticComputer = new RouteSteepnessStatisticComputer(inclines, currentRenderer, defaultRenderer, currentSearchRequest, defaultSearchRequest);
return statisticComputer.computeStatistic(); return statisticComputer.computeStatistic();
} }
@ -55,16 +58,19 @@ public class RouteStatistics {
private final List<RouteSegmentResult> route; private final List<RouteSegmentResult> route;
private final StatisticType type; private final StatisticType type;
protected final RenderingRulesStorage currentRenderer; final RenderingRulesStorage currentRenderer;
protected final RenderingRulesStorage defaultRenderer; final RenderingRulesStorage defaultRenderer;
protected final boolean nightMode; final RenderingRuleSearchRequest currentRenderingRuleSearchRequest;
final RenderingRuleSearchRequest defaultRenderingRuleSearchRequest;
public RouteStatisticComputer(RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, List<RouteSegmentResult> route, StatisticType type, boolean nightMode) { public RouteStatisticComputer(RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, List<RouteSegmentResult> route, StatisticType type,
RenderingRuleSearchRequest currentRenderingRuleSearchRequest, RenderingRuleSearchRequest defaultRenderingRuleSearchRequest) {
this.route = route; this.route = route;
this.currentRenderer = currentRenderer; this.currentRenderer = currentRenderer;
this.defaultRenderer = defaultRenderer; this.defaultRenderer = defaultRenderer;
this.type = type; this.type = type;
this.nightMode = nightMode; this.currentRenderingRuleSearchRequest = currentRenderingRuleSearchRequest;
this.defaultRenderingRuleSearchRequest = defaultRenderingRuleSearchRequest;
} }
protected Map<E, RouteSegmentAttribute<E>> makePartition(List<RouteSegmentAttribute<E>> routeAttributes) { protected Map<E, RouteSegmentAttribute<E>> makePartition(List<RouteSegmentAttribute<E>> routeAttributes) {
@ -121,13 +127,17 @@ public class RouteStatistics {
return new Statistics<>(routeAttributes, partition, totalDistance, type); return new Statistics<>(routeAttributes, partition, totalDistance, type);
} }
RenderingRuleSearchRequest getSearchRequest(boolean useCurrentRenderer) {
return new RenderingRuleSearchRequest(useCurrentRenderer ? currentRenderingRuleSearchRequest : defaultRenderingRuleSearchRequest);
}
public int getColor(E attribute) { public int getColor(E attribute) {
int color = 0; int color = 0;
RenderingRuleSearchRequest currentRequest = new RenderingRuleSearchRequest(currentRenderer); RenderingRuleSearchRequest currentRequest = getSearchRequest(true);
if (searchRenderingAttribute(currentRenderer, currentRequest, attribute)) { if (searchRenderingAttribute(currentRenderer, currentRequest, attribute)) {
color = currentRequest.getIntPropertyValue(currentRenderer.PROPS.R_ATTR_COLOR_VALUE); color = currentRequest.getIntPropertyValue(currentRenderer.PROPS.R_ATTR_COLOR_VALUE);
} else { } else {
RenderingRuleSearchRequest defaultRequest = new RenderingRuleSearchRequest(defaultRenderer); RenderingRuleSearchRequest defaultRequest = getSearchRequest(false);
if (searchRenderingAttribute(defaultRenderer, defaultRequest, attribute)) { if (searchRenderingAttribute(defaultRenderer, defaultRequest, attribute)) {
color = defaultRequest.getIntPropertyValue(defaultRenderer.PROPS.R_ATTR_COLOR_VALUE); color = defaultRequest.getIntPropertyValue(defaultRenderer.PROPS.R_ATTR_COLOR_VALUE);
} }
@ -147,8 +157,8 @@ public class RouteStatistics {
private static final String SURFACE_ATTR = "surface"; private static final String SURFACE_ATTR = "surface";
private static final String SURFACE_COLOR_ATTR = "surfaceColor"; private static final String SURFACE_COLOR_ATTR = "surfaceColor";
public RouteSurfaceStatisticComputer(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, boolean nightMode) { public RouteSurfaceStatisticComputer(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, RenderingRuleSearchRequest currentSearchRequest, RenderingRuleSearchRequest defaultSearchRequest) {
super(currentRenderer, defaultRenderer, route, StatisticType.SURFACE, nightMode); super(currentRenderer, defaultRenderer, route, StatisticType.SURFACE, currentSearchRequest, defaultSearchRequest);
} }
@Override @Override
@ -157,11 +167,11 @@ public class RouteStatistics {
if (segmentSurface == null) { if (segmentSurface == null) {
return UNDEFINED_ATTR; return UNDEFINED_ATTR;
} }
RenderingRuleSearchRequest currentRequest = new RenderingRuleSearchRequest(currentRenderer); RenderingRuleSearchRequest currentRequest = getSearchRequest(true);
if (searchRenderingAttribute(currentRenderer, currentRequest, segmentSurface)) { if (searchRenderingAttribute(currentRenderer, currentRequest, segmentSurface)) {
return segmentSurface; return segmentSurface;
} else { } else {
RenderingRuleSearchRequest defaultRequest = new RenderingRuleSearchRequest(defaultRenderer); RenderingRuleSearchRequest defaultRequest = getSearchRequest(false);
if (searchRenderingAttribute(defaultRenderer, defaultRequest, segmentSurface)) { if (searchRenderingAttribute(defaultRenderer, defaultRequest, segmentSurface)) {
return segmentSurface; return segmentSurface;
} }
@ -177,7 +187,6 @@ public class RouteStatistics {
@Override @Override
public boolean searchRenderingAttribute(RenderingRulesStorage rrs, RenderingRuleSearchRequest req, String attribute) { public boolean searchRenderingAttribute(RenderingRulesStorage rrs, RenderingRuleSearchRequest req, String attribute) {
String additional = SURFACE_ATTR + "=" + attribute; String additional = SURFACE_ATTR + "=" + attribute;
req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode);
req.setStringFilter(rrs.PROPS.R_ATTR_STRING_VALUE, SURFACE_ATTR + "_" + attribute); req.setStringFilter(rrs.PROPS.R_ATTR_STRING_VALUE, SURFACE_ATTR + "_" + attribute);
req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional); req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional);
return req.searchRenderingAttribute(SURFACE_COLOR_ATTR); return req.searchRenderingAttribute(SURFACE_COLOR_ATTR);
@ -189,8 +198,8 @@ public class RouteStatistics {
private static final String SMOOTHNESS_ATTR = "smoothness"; private static final String SMOOTHNESS_ATTR = "smoothness";
private static final String SMOOTHNESS_COLOR_ATTR = "smoothnessColor"; private static final String SMOOTHNESS_COLOR_ATTR = "smoothnessColor";
public RouteSmoothnessStatisticComputer(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, boolean nightMode) { public RouteSmoothnessStatisticComputer(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, RenderingRuleSearchRequest currentSearchRequest, RenderingRuleSearchRequest defaultSearchRequest) {
super(currentRenderer, defaultRenderer, route, StatisticType.SMOOTHNESS, nightMode); super(currentRenderer, defaultRenderer, route, StatisticType.SMOOTHNESS, currentSearchRequest, defaultSearchRequest);
} }
@Override @Override
@ -199,11 +208,11 @@ public class RouteStatistics {
if (segmentSmoothness == null) { if (segmentSmoothness == null) {
return UNDEFINED_ATTR; return UNDEFINED_ATTR;
} }
RenderingRuleSearchRequest currentRequest = new RenderingRuleSearchRequest(currentRenderer); RenderingRuleSearchRequest currentRequest = getSearchRequest(true);
if (searchRenderingAttribute(currentRenderer, currentRequest, segmentSmoothness)) { if (searchRenderingAttribute(currentRenderer, currentRequest, segmentSmoothness)) {
return segmentSmoothness; return segmentSmoothness;
} else { } else {
RenderingRuleSearchRequest defaultRequest = new RenderingRuleSearchRequest(defaultRenderer); RenderingRuleSearchRequest defaultRequest = getSearchRequest(false);
if (searchRenderingAttribute(defaultRenderer, defaultRequest, segmentSmoothness)) { if (searchRenderingAttribute(defaultRenderer, defaultRequest, segmentSmoothness)) {
return segmentSmoothness; return segmentSmoothness;
} }
@ -219,7 +228,6 @@ public class RouteStatistics {
@Override @Override
public boolean searchRenderingAttribute(RenderingRulesStorage rrs, RenderingRuleSearchRequest req, String attribute) { public boolean searchRenderingAttribute(RenderingRulesStorage rrs, RenderingRuleSearchRequest req, String attribute) {
String additional = SMOOTHNESS_ATTR + "=" + attribute; String additional = SMOOTHNESS_ATTR + "=" + attribute;
req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode);
req.setStringFilter(rrs.PROPS.R_ATTR_STRING_VALUE, SMOOTHNESS_ATTR + "_" + attribute); req.setStringFilter(rrs.PROPS.R_ATTR_STRING_VALUE, SMOOTHNESS_ATTR + "_" + attribute);
req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional); req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional);
return req.searchRenderingAttribute(SMOOTHNESS_COLOR_ATTR); return req.searchRenderingAttribute(SMOOTHNESS_COLOR_ATTR);
@ -231,8 +239,8 @@ public class RouteStatistics {
private static final String HIGHWAY_ATTR = "highway"; private static final String HIGHWAY_ATTR = "highway";
private static final String ROAD_CLASS_COLOR_ATTR = "roadClassColor"; private static final String ROAD_CLASS_COLOR_ATTR = "roadClassColor";
public RouteClassStatisticComputer(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, boolean nightMode) { public RouteClassStatisticComputer(List<RouteSegmentResult> route, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, RenderingRuleSearchRequest currentSearchRequest, RenderingRuleSearchRequest defaultSearchRequest) {
super(currentRenderer, defaultRenderer, route, StatisticType.CLASS, nightMode); super(currentRenderer, defaultRenderer, route, StatisticType.CLASS, currentSearchRequest, defaultSearchRequest);
} }
@Override @Override
@ -248,11 +256,11 @@ public class RouteStatistics {
@Override @Override
public int getColor(String attribute) { public int getColor(String attribute) {
int color = 0; int color = 0;
RenderingRuleSearchRequest currentRequest = new RenderingRuleSearchRequest(currentRenderer); RenderingRuleSearchRequest currentRequest = getSearchRequest(true);
if (currentRequest.searchRenderingAttribute(attribute)) { if (currentRequest.searchRenderingAttribute(attribute)) {
color = currentRequest.getIntPropertyValue(currentRenderer.PROPS.R_ATTR_COLOR_VALUE); color = currentRequest.getIntPropertyValue(currentRenderer.PROPS.R_ATTR_COLOR_VALUE);
} else { } else {
RenderingRuleSearchRequest defaultRequest = new RenderingRuleSearchRequest(defaultRenderer); RenderingRuleSearchRequest defaultRequest = getSearchRequest(false);
if (defaultRequest.searchRenderingAttribute(attribute)) { if (defaultRequest.searchRenderingAttribute(attribute)) {
color = defaultRequest.getIntPropertyValue(defaultRenderer.PROPS.R_ATTR_COLOR_VALUE); color = defaultRequest.getIntPropertyValue(defaultRenderer.PROPS.R_ATTR_COLOR_VALUE);
} }
@ -268,7 +276,6 @@ public class RouteStatistics {
@Override @Override
public boolean searchRenderingAttribute(RenderingRulesStorage rrs, RenderingRuleSearchRequest req, String attribute) { public boolean searchRenderingAttribute(RenderingRulesStorage rrs, RenderingRuleSearchRequest req, String attribute) {
req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode);
req.setStringFilter(rrs.PROPS.R_TAG, HIGHWAY_ATTR); req.setStringFilter(rrs.PROPS.R_TAG, HIGHWAY_ATTR);
req.setStringFilter(rrs.PROPS.R_VALUE, attribute); req.setStringFilter(rrs.PROPS.R_VALUE, attribute);
return req.searchRenderingAttribute(ROAD_CLASS_COLOR_ATTR); return req.searchRenderingAttribute(ROAD_CLASS_COLOR_ATTR);
@ -276,14 +283,14 @@ public class RouteStatistics {
private String getAttributeType(String attribute) { private String getAttributeType(String attribute) {
String type = null; String type = null;
RenderingRuleSearchRequest currentRequest = new RenderingRuleSearchRequest(currentRenderer); RenderingRuleSearchRequest currentRequest = getSearchRequest(true);
if (searchRenderingAttribute(currentRenderer, currentRequest, attribute)) { if (searchRenderingAttribute(currentRenderer, currentRequest, attribute)) {
type = currentRequest.getStringPropertyValue(currentRenderer.PROPS.R_ATTR_STRING_VALUE); type = currentRequest.getStringPropertyValue(currentRenderer.PROPS.R_ATTR_STRING_VALUE);
if (currentRequest.searchRenderingAttribute(type)) { if (currentRequest.searchRenderingAttribute(type)) {
type = currentRequest.getStringPropertyValue(currentRenderer.PROPS.R_ATTR_STRING_VALUE); type = currentRequest.getStringPropertyValue(currentRenderer.PROPS.R_ATTR_STRING_VALUE);
} }
} else { } else {
RenderingRuleSearchRequest defaultRequest = new RenderingRuleSearchRequest(defaultRenderer); RenderingRuleSearchRequest defaultRequest = getSearchRequest(false);
if (searchRenderingAttribute(defaultRenderer, defaultRequest, attribute)) { if (searchRenderingAttribute(defaultRenderer, defaultRequest, attribute)) {
type = defaultRequest.getStringPropertyValue(currentRenderer.PROPS.R_ATTR_STRING_VALUE); type = defaultRequest.getStringPropertyValue(currentRenderer.PROPS.R_ATTR_STRING_VALUE);
if (defaultRequest.searchRenderingAttribute(type)) { if (defaultRequest.searchRenderingAttribute(type)) {
@ -302,8 +309,8 @@ public class RouteStatistics {
private final List<Incline> inclines; private final List<Incline> inclines;
public RouteSteepnessStatisticComputer(List<Incline> inclines, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, boolean nightMode) { public RouteSteepnessStatisticComputer(List<Incline> inclines, RenderingRulesStorage currentRenderer, RenderingRulesStorage defaultRenderer, RenderingRuleSearchRequest currentSearchRequest, RenderingRuleSearchRequest defaultSearchRequest) {
super(currentRenderer, defaultRenderer, null, StatisticType.STEEPNESS, nightMode); super(currentRenderer, defaultRenderer, null, StatisticType.STEEPNESS, currentSearchRequest, defaultSearchRequest);
this.inclines = inclines; this.inclines = inclines;
} }
@ -365,7 +372,6 @@ public class RouteStatistics {
range.append(upperBoundary < 0 ? "_" : "-"); range.append(upperBoundary < 0 ? "_" : "-");
range.append(upperBoundary); range.append(upperBoundary);
String additional = STEEPNESS_ATTR + "=" + range; String additional = STEEPNESS_ATTR + "=" + range;
req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode);
req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional); req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional);
return req.searchRenderingAttribute(STEEPNESS_COLOR_ATTR); return req.searchRenderingAttribute(STEEPNESS_COLOR_ATTR);
} }

View file

@ -641,44 +641,7 @@ public class MapRenderRepositories {
boolean nightMode = app.getDaynightHelper().isNightMode(); boolean nightMode = app.getDaynightHelper().isNightMode();
// boolean moreDetail = prefs.SHOW_MORE_MAP_DETAIL.get(); // boolean moreDetail = prefs.SHOW_MORE_MAP_DETAIL.get();
RenderingRulesStorage storage = app.getRendererRegistry().getCurrentSelectedRenderer(); RenderingRulesStorage storage = app.getRendererRegistry().getCurrentSelectedRenderer();
RenderingRuleSearchRequest renderingReq = new RenderingRuleSearchRequest(storage); RenderingRuleSearchRequest renderingReq = getSearchRequestWithAppliedCustomRules(storage, nightMode);
renderingReq.setBooleanFilter(renderingReq.ALL.R_NIGHT_MODE, nightMode);
for (RenderingRuleProperty customProp : storage.PROPS.getCustomRules()) {
if (customProp.isBoolean()) {
if(customProp.getAttrName().equals(RenderingRuleStorageProperties.A_ENGINE_V1)) {
renderingReq.setBooleanFilter(customProp, true);
} else if (RenderingRuleStorageProperties.UI_CATEGORY_HIDDEN.equals(customProp.getCategory())) {
renderingReq.setBooleanFilter(customProp, false);
} else {
CommonPreference<Boolean> pref = prefs.getCustomRenderBooleanProperty(customProp.getAttrName());
renderingReq.setBooleanFilter(customProp, pref.get());
}
} else if (RenderingRuleStorageProperties.UI_CATEGORY_HIDDEN.equals(customProp.getCategory())) {
if (customProp.isString()) {
renderingReq.setStringFilter(customProp, "");
} else {
renderingReq.setIntFilter(customProp, 0);
}
} else {
CommonPreference<String> settings = prefs.getCustomRenderProperty(customProp.getAttrName());
String res = settings.get();
if (!Algorithms.isEmpty(res)) {
if (customProp.isString()) {
renderingReq.setStringFilter(customProp, res);
} else {
try {
renderingReq.setIntFilter(customProp, Integer.parseInt(res));
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
} else {
if (customProp.isString()) {
renderingReq.setStringFilter(customProp, "");
}
}
}
}
renderingReq.saveState(); renderingReq.saveState();
NativeOsmandLibrary nativeLib = !prefs.SAFE_MODE.get() ? NativeOsmandLibrary.getLibrary(storage, context) : null; NativeOsmandLibrary nativeLib = !prefs.SAFE_MODE.get() ? NativeOsmandLibrary.getLibrary(storage, context) : null;
@ -880,6 +843,49 @@ public class MapRenderRepositories {
} }
public RenderingRuleSearchRequest getSearchRequestWithAppliedCustomRules(RenderingRulesStorage storage, boolean nightMode) {
// boolean moreDetail = prefs.SHOW_MORE_MAP_DETAIL.get();
RenderingRuleSearchRequest renderingReq = new RenderingRuleSearchRequest(storage);
renderingReq.setBooleanFilter(renderingReq.ALL.R_NIGHT_MODE, nightMode);
for (RenderingRuleProperty customProp : storage.PROPS.getCustomRules()) {
if (customProp.isBoolean()) {
if(customProp.getAttrName().equals(RenderingRuleStorageProperties.A_ENGINE_V1)) {
renderingReq.setBooleanFilter(customProp, true);
} else if (RenderingRuleStorageProperties.UI_CATEGORY_HIDDEN.equals(customProp.getCategory())) {
renderingReq.setBooleanFilter(customProp, false);
} else {
CommonPreference<Boolean> pref = prefs.getCustomRenderBooleanProperty(customProp.getAttrName());
renderingReq.setBooleanFilter(customProp, pref.get());
}
} else if (RenderingRuleStorageProperties.UI_CATEGORY_HIDDEN.equals(customProp.getCategory())) {
if (customProp.isString()) {
renderingReq.setStringFilter(customProp, "");
} else {
renderingReq.setIntFilter(customProp, 0);
}
} else {
CommonPreference<String> settings = prefs.getCustomRenderProperty(customProp.getAttrName());
String res = settings.get();
if (!Algorithms.isEmpty(res)) {
if (customProp.isString()) {
renderingReq.setStringFilter(customProp, res);
} else {
try {
renderingReq.setIntFilter(customProp, Integer.parseInt(res));
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
} else {
if (customProp.isString()) {
renderingReq.setStringFilter(customProp, "");
}
}
}
}
return renderingReq;
}
public Bitmap getBitmap() { public Bitmap getBitmap() {
return bmp; return bmp;
} }

View file

@ -90,6 +90,7 @@ import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
import net.osmand.plus.mapcontextmenu.InterceptorLinearLayout; import net.osmand.plus.mapcontextmenu.InterceptorLinearLayout;
import net.osmand.plus.mapcontextmenu.MenuBuilder.CollapsableView; import net.osmand.plus.mapcontextmenu.MenuBuilder.CollapsableView;
import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.render.MapRenderRepositories;
import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.routepreparationmenu.cards.PublicTransportCard; import net.osmand.plus.routepreparationmenu.cards.PublicTransportCard;
import net.osmand.plus.routepreparationmenu.cards.RouteInfoCard; import net.osmand.plus.routepreparationmenu.cards.RouteInfoCard;
@ -103,6 +104,7 @@ import net.osmand.plus.views.TurnPathHelper;
import net.osmand.plus.views.controls.HorizontalSwipeConfirm; import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
import net.osmand.plus.widgets.TextViewEx; import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.widgets.style.CustomTypefaceSpan; import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import net.osmand.render.RenderingRuleSearchRequest;
import net.osmand.render.RenderingRulesStorage; import net.osmand.render.RenderingRulesStorage;
import net.osmand.router.RouteSegmentResult; import net.osmand.router.RouteSegmentResult;
import net.osmand.router.RouteStatistics; import net.osmand.router.RouteStatistics;
@ -518,7 +520,12 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
if (route != null) { if (route != null) {
RenderingRulesStorage currentRenderer = app.getRendererRegistry().getCurrentSelectedRenderer(); RenderingRulesStorage currentRenderer = app.getRendererRegistry().getCurrentSelectedRenderer();
RenderingRulesStorage defaultRender = app.getRendererRegistry().defaultRender(); RenderingRulesStorage defaultRender = app.getRendererRegistry().defaultRender();
RouteStatistics routeStatistics = RouteStatistics.newRouteStatistic(route, currentRenderer,defaultRender, nightMode);
MapRenderRepositories maps = app.getResourceManager().getRenderer();
RenderingRuleSearchRequest currentSearchRequest = maps.getSearchRequestWithAppliedCustomRules(currentRenderer, nightMode);
RenderingRuleSearchRequest defaultSearchRequest = maps.getSearchRequestWithAppliedCustomRules(defaultRender, nightMode);
RouteStatistics routeStatistics = RouteStatistics.newRouteStatistic(route, currentRenderer, defaultRender, currentSearchRequest, defaultSearchRequest);
GPXUtilities.GPXTrackAnalysis analysis = gpx.getAnalysis(0); GPXUtilities.GPXTrackAnalysis analysis = gpx.getAnalysis(0);
RouteInfoCard routeClassCard = new RouteInfoCard(mapActivity, routeStatistics.getRouteClassStatistic(), analysis); RouteInfoCard routeClassCard = new RouteInfoCard(mapActivity, routeStatistics.getRouteClassStatistic(), analysis);