Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-02-23 11:07:33 +01:00
commit 20ff84f7d5
2 changed files with 25 additions and 12 deletions

View file

@ -107,11 +107,11 @@ public class MapRendererContext implements RendererRegistry.IRendererLoadedEvent
} }
protected int getRasterTileSize() { protected int getRasterTileSize() {
return Integer.highestOneBit((int) getReferenceTileSize() - 1) * 2; return (int)(getReferenceTileSize() * app.getSettings().MAP_DENSITY.get());
} }
private float getReferenceTileSize() { private float getReferenceTileSize() {
return 256 * app.getSettings().MAP_DENSITY.get() * Math.max(1, density); return 256 * Math.max(1, density);
} }
/** /**
@ -151,10 +151,12 @@ public class MapRendererContext implements RendererRegistry.IRendererLoadedEvent
} }
} }
ResolvedMapStyle mapStyle = mapStyles.get(rendName); ResolvedMapStyle mapStyle = mapStyles.get(rendName);
CachedMapPresentation pres = new CachedMapPresentation(langId, langPref, mapStyle, density); CachedMapPresentation pres = new CachedMapPresentation(langId, langPref, mapStyle, density,
app.getSettings().MAP_DENSITY.get(), app.getSettings().TEXT_SCALE.get());
if (this.presentationObjectParams == null || !this.presentationObjectParams.equalsFields(pres)) { if (this.presentationObjectParams == null || !this.presentationObjectParams.equalsFields(pres)) {
this.presentationObjectParams = pres; this.presentationObjectParams = pres;
mapPresentationEnvironment = new MapPresentationEnvironment(mapStyle, density, langId, mapPresentationEnvironment = new MapPresentationEnvironment(mapStyle, density,
app.getSettings().MAP_DENSITY.get(), app.getSettings().TEXT_SCALE.get(), langId,
langPref); langPref);
} }
@ -220,8 +222,8 @@ public class MapRendererContext implements RendererRegistry.IRendererLoadedEvent
mapRendererView.removeSymbolsProvider(obfMapSymbolsProvider); mapRendererView.removeSymbolsProvider(obfMapSymbolsProvider);
} }
// Create new OBF map symbols provider // Create new OBF map symbols provider
obfMapSymbolsProvider = new MapObjectsSymbolsProvider(mapPrimitivesProvider, getReferenceTileSize(), obfMapSymbolsProvider = new MapObjectsSymbolsProvider(mapPrimitivesProvider,
app.getSettings().TEXT_SCALE.get()); getReferenceTileSize());
// If there's bound view, add new provider // If there's bound view, add new provider
if (mapRendererView != null) { if (mapRendererView != null) {
mapRendererView.addSymbolsProvider(obfMapSymbolsProvider); mapRendererView.addSymbolsProvider(obfMapSymbolsProvider);
@ -247,21 +249,30 @@ public class MapRendererContext implements RendererRegistry.IRendererLoadedEvent
String langId ; String langId ;
LanguagePreference langPref; LanguagePreference langPref;
ResolvedMapStyle mapStyle; ResolvedMapStyle mapStyle;
double displayDensityFactor; float displayDensityFactor;
float mapScaleFactor;
float symbolsScaleFactor;
public CachedMapPresentation(String langId, public CachedMapPresentation(String langId,
LanguagePreference langPref, ResolvedMapStyle mapStyle, LanguagePreference langPref, ResolvedMapStyle mapStyle,
double displayDensityFactor) { float displayDensityFactor,
float mapScaleFactor,
float symbolsScaleFactor) {
this.langId = langId; this.langId = langId;
this.langPref = langPref; this.langPref = langPref;
this.mapStyle = mapStyle; this.mapStyle = mapStyle;
this.displayDensityFactor = displayDensityFactor; this.displayDensityFactor = displayDensityFactor;
this.mapScaleFactor = mapScaleFactor;
this.symbolsScaleFactor = symbolsScaleFactor;
} }
public boolean equalsFields(CachedMapPresentation other ) { public boolean equalsFields(CachedMapPresentation other ) {
if (Double.doubleToLongBits(displayDensityFactor) != Double if (Double.compare(displayDensityFactor, other.displayDensityFactor) != 0)
.doubleToLongBits(other.displayDensityFactor)) return false;
if (Double.compare(mapScaleFactor, other.mapScaleFactor) != 0)
return false;
if (Double.compare(symbolsScaleFactor, other.symbolsScaleFactor) != 0)
return false; return false;
if (langId == null) { if (langId == null) {
if (other.langId != null) if (other.langId != null)

View file

@ -114,7 +114,7 @@ public class MapVectorLayer extends BaseMapLayer {
mapRenderer.resetMapLayerProvider(-1); mapRenderer.resetMapLayerProvider(-1);
} }
} }
if (st.MAP_TRANSPARENCY.get() != cachedMapTransparency) { if (!Algorithms.objectEquals(st.MAP_TRANSPARENCY.get(), cachedMapTransparency)) {
cachedMapTransparency = st.MAP_TRANSPARENCY.get(); cachedMapTransparency = st.MAP_TRANSPARENCY.get();
MapLayerConfiguration mapLayerConfiguration = new MapLayerConfiguration(); MapLayerConfiguration mapLayerConfiguration = new MapLayerConfiguration();
mapLayerConfiguration.setOpacityFactor(((float)cachedMapTransparency) / 255.0f); mapLayerConfiguration.setOpacityFactor(((float)cachedMapTransparency) / 255.0f);
@ -132,7 +132,7 @@ public class MapVectorLayer extends BaseMapLayer {
mapRenderer.resetMapLayerProvider(1); mapRenderer.resetMapLayerProvider(1);
} }
} }
if (st.MAP_OVERLAY_TRANSPARENCY.get() != cachedOverlayTransparency) { if (!Algorithms.objectEquals(st.MAP_OVERLAY_TRANSPARENCY.get(), cachedOverlayTransparency)) {
cachedOverlayTransparency = st.MAP_OVERLAY_TRANSPARENCY.get(); cachedOverlayTransparency = st.MAP_OVERLAY_TRANSPARENCY.get();
MapLayerConfiguration mapLayerConfiguration = new MapLayerConfiguration(); MapLayerConfiguration mapLayerConfiguration = new MapLayerConfiguration();
mapLayerConfiguration.setOpacityFactor(((float)cachedOverlayTransparency) / 255.0f); mapLayerConfiguration.setOpacityFactor(((float)cachedOverlayTransparency) / 255.0f);
@ -145,6 +145,8 @@ public class MapVectorLayer extends BaseMapLayer {
mapRenderer.setAzimuth(-tilesRect.getRotate()); mapRenderer.setAzimuth(-tilesRect.getRotate());
mapRenderer.setZoom((float) (tilesRect.getZoom() + tilesRect mapRenderer.setZoom((float) (tilesRect.getZoom() + tilesRect
.getZoomAnimation() + tilesRect.getZoomFloatPart())); .getZoomAnimation() + tilesRect.getZoomFloatPart()));
float zoomMagnifier = st.MAP_DENSITY.get();
mapRenderer.setVisualZoomShift(zoomMagnifier - 1.0f);
} else { } else {
if (!view.isZooming()) { if (!view.isZooming()) {
if (resourceManager.updateRenderedMapNeeded(tilesRect, drawSettings)) { if (resourceManager.updateRenderedMapNeeded(tilesRect, drawSettings)) {