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() {
return Integer.highestOneBit((int) getReferenceTileSize() - 1) * 2;
return (int)(getReferenceTileSize() * app.getSettings().MAP_DENSITY.get());
}
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);
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)) {
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);
}
@ -220,8 +222,8 @@ public class MapRendererContext implements RendererRegistry.IRendererLoadedEvent
mapRendererView.removeSymbolsProvider(obfMapSymbolsProvider);
}
// Create new OBF map symbols provider
obfMapSymbolsProvider = new MapObjectsSymbolsProvider(mapPrimitivesProvider, getReferenceTileSize(),
app.getSettings().TEXT_SCALE.get());
obfMapSymbolsProvider = new MapObjectsSymbolsProvider(mapPrimitivesProvider,
getReferenceTileSize());
// If there's bound view, add new provider
if (mapRendererView != null) {
mapRendererView.addSymbolsProvider(obfMapSymbolsProvider);
@ -247,21 +249,30 @@ public class MapRendererContext implements RendererRegistry.IRendererLoadedEvent
String langId ;
LanguagePreference langPref;
ResolvedMapStyle mapStyle;
double displayDensityFactor;
float displayDensityFactor;
float mapScaleFactor;
float symbolsScaleFactor;
public CachedMapPresentation(String langId,
LanguagePreference langPref, ResolvedMapStyle mapStyle,
double displayDensityFactor) {
float displayDensityFactor,
float mapScaleFactor,
float symbolsScaleFactor) {
this.langId = langId;
this.langPref = langPref;
this.mapStyle = mapStyle;
this.displayDensityFactor = displayDensityFactor;
this.mapScaleFactor = mapScaleFactor;
this.symbolsScaleFactor = symbolsScaleFactor;
}
public boolean equalsFields(CachedMapPresentation other ) {
if (Double.doubleToLongBits(displayDensityFactor) != Double
.doubleToLongBits(other.displayDensityFactor))
if (Double.compare(displayDensityFactor, other.displayDensityFactor) != 0)
return false;
if (Double.compare(mapScaleFactor, other.mapScaleFactor) != 0)
return false;
if (Double.compare(symbolsScaleFactor, other.symbolsScaleFactor) != 0)
return false;
if (langId == null) {
if (other.langId != null)

View file

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