diff --git a/OsmAnd-java/src/net/osmand/RenderingContext.java b/OsmAnd-java/src/net/osmand/RenderingContext.java index 6a6201f677..a860c4e970 100644 --- a/OsmAnd-java/src/net/osmand/RenderingContext.java +++ b/OsmAnd-java/src/net/osmand/RenderingContext.java @@ -1,5 +1,8 @@ package net.osmand; +import net.osmand.render.RenderingRuleProperty; +import net.osmand.render.RenderingRuleSearchRequest; + public class RenderingContext { static enum ShadowRenderingMode { @@ -57,6 +60,10 @@ public class RenderingContext { return val * density; } + public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, float defVal) { + return req.getFloatPropertyValue(prop, defVal) * density; + } + protected byte[] getIconRawData(String data) { return null; } diff --git a/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java b/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java index c3bcac996f..4e2ee2a956 100644 --- a/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java +++ b/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java @@ -344,11 +344,6 @@ public class RotatedTileBox { calculateDerivedFields(); } - public QuadPoint getLeftTopTilePoint() { - checkTileRectangleCalculated(); - return tileLT; - } - public LatLon getLeftTopLatLon() { checkTileRectangleCalculated(); return new LatLon(MapUtils.getLatitudeFromTile(zoom, tileLT.y), diff --git a/OsmAnd-java/src/net/osmand/render/RenderingRuleSearchRequest.java b/OsmAnd-java/src/net/osmand/render/RenderingRuleSearchRequest.java index c7a7bc1055..64a4baafd2 100644 --- a/OsmAnd-java/src/net/osmand/render/RenderingRuleSearchRequest.java +++ b/OsmAnd-java/src/net/osmand/render/RenderingRuleSearchRequest.java @@ -229,6 +229,14 @@ public class RenderingRuleSearchRequest { return fvalues[property.getId()]; } + public float getFloatPropertyValue(RenderingRuleProperty property, float defVal) { + float f = fvalues[property.getId()]; + if(f == 0) { + return defVal; + } + return f; + } + public String getColorStringPropertyValue(RenderingRuleProperty property) { return RenderingRuleProperty.colorToString(values[property.getId()]); } diff --git a/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java b/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java index 03073aeb57..38141f05a4 100644 --- a/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java +++ b/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java @@ -175,13 +175,13 @@ public class RenderingRuleStorageProperties { R_SHADOW_LEVEL = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(SHADOW_LEVEL)); // text properties - R_TEXT_WRAP_WIDTH = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_WRAP_WIDTH)); - R_TEXT_DY = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_DY)); - R_TEXT_HALO_RADIUS = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_HALO_RADIUS)); - R_TEXT_SIZE = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_SIZE)); + R_TEXT_WRAP_WIDTH = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(TEXT_WRAP_WIDTH)); + R_TEXT_DY = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(TEXT_DY)); + R_TEXT_HALO_RADIUS = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(TEXT_HALO_RADIUS)); + R_TEXT_SIZE = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(TEXT_SIZE)); R_TEXT_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_ORDER)); R_ICON_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(ICON_ORDER)); - R_TEXT_MIN_DISTANCE = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_MIN_DISTANCE)); + R_TEXT_MIN_DISTANCE = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(TEXT_MIN_DISTANCE)); R_TEXT_SHIELD = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(TEXT_SHIELD)); @@ -218,7 +218,7 @@ public class RenderingRuleStorageProperties { R_SHADER = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(SHADER)); R_SHADOW_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(SHADOW_COLOR)); - R_SHADOW_RADIUS = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(SHADOW_RADIUS)); + R_SHADOW_RADIUS = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(SHADOW_RADIUS)); } public RenderingRuleProperty get(String name) { diff --git a/OsmAnd/res/xml/navigation_settings.xml b/OsmAnd/res/xml/navigation_settings.xml index f4f9393160..3a35f4f010 100644 --- a/OsmAnd/res/xml/navigation_settings.xml +++ b/OsmAnd/res/xml/navigation_settings.xml @@ -12,6 +12,8 @@ + ROUTER_SERVICE = new EnumIntPreference("router_service", RouteService.OSMAND, RouteService.values()).makeProfile(); // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference ROUTE_VIEW_DISTANCE = - new EnumIntPreference("router_service", RouteViewDistance.FAREST, + new EnumIntPreference("route_view_distance", RouteViewDistance.FAREST, RouteViewDistance.values()).makeProfile().cache(); public final CommonPreference SNAP_TO_ROAD = new BooleanPreference("snap_to_road", false).makeProfile().cache(); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index 81b063ee12..4aae9458e6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -8,6 +8,7 @@ import java.util.Set; import net.osmand.IndexConstants; import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.OsmandPreference; +import net.osmand.plus.OsmandSettings.RouteViewDistance; import net.osmand.plus.R; import net.osmand.plus.routing.RouteProvider.RouteService; import android.app.AlertDialog; @@ -27,6 +28,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { private Preference showAlarms; private Preference speakAlarms; private ListPreference routerServicePreference; + private ListPreference routeViewDistancePreference; public static final String MORE_VALUE = "MORE_VALUE"; public SettingsNavigationActivity() { @@ -82,7 +84,15 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { registerListPreference(settings.ROUTER_SERVICE, screen, entries, RouteService.values()); routerServicePreference = (ListPreference) screen.findPreference(settings.ROUTER_SERVICE.getId()); - routerServicePreference.setOnPreferenceChangeListener(this); + + entries = new String[RouteViewDistance.values().length]; + for(int i=0; i 0; - minDistance = render.getIntPropertyValue(render.ALL.R_TEXT_MIN_DISTANCE, 0); + minDistance = rc.getComplexValue(render, render.ALL.R_TEXT_MIN_DISTANCE, 0); if (render.isSpecified(render.ALL.R_TEXT_SHIELD)) { shieldRes = render.getStringPropertyValue(render.ALL.R_TEXT_SHIELD); } @@ -303,9 +303,9 @@ public class TextRenderer { render.setIntFilter(render.ALL.R_TEXT_LENGTH, name.length()); render.setStringFilter(render.ALL.R_NAME_TAG, tagName); if(render.search(RenderingRulesStorage.TEXT_RULES)){ - if(render.getIntPropertyValue(render.ALL.R_TEXT_SIZE) > 0){ + if(render.getFloatPropertyValue(render.ALL.R_TEXT_SIZE) > 0){ final TextDrawInfo text = new TextDrawInfo(name); - text.fillProperties(render, xMid, yMid); + text.fillProperties(rc, render, xMid, yMid); final String tagName2 = render.getStringPropertyValue(render.ALL.R_NAME_TAG2); if (!Algorithms.isEmpty(tagName2)) { o.getObjectNames().forEachEntry(new TIntObjectProcedure() { diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 44cf4f6ee6..6c9972bf1b 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -369,15 +369,14 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall currentViewport.getCenterPixelY() != cy) { currentViewport.setPixelDimensions(getWidth(), getHeight(), 0.5f, ratioy); } - // TODO high res - // (getSettings().USE_HIGH_RES_MAPS.get() ? 0 : 0.5f) boolean nightMode = application.getDaynightHelper().isNightMode(); if (nightMode) { canvas.drawARGB(255, 100, 100, 100); } else { canvas.drawARGB(255, 225, 225, 225); } - drawOverMap(canvas, currentViewport, new DrawSettings(nightMode, updateVectorRendering), false); + // make copy to avoid concurrency + drawOverMap(canvas, currentViewport.copy(), new DrawSettings(nightMode, updateVectorRendering), false); } finally { holder.unlockCanvasAndPost(canvas); }