Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2015-11-16 01:14:47 +01:00
commit 9ca23587ac
4 changed files with 62 additions and 37 deletions

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><resources> <?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="rendering_attr_hideHouseNumbers_name">Ocultar números de casa</string> <string name="rendering_attr_hideHouseNumbers_name">Ocultar números de casa</string>
<string name="copying_osmand_file_failed">Falló al copiar archivos</string> <string name="copying_osmand_file_failed">Falló al copiar archivos</string>
@ -1952,5 +1953,29 @@
<string name="lang_als">Albano (Tosk)</string> <string name="lang_als">Albano (Tosk)</string>
<string name="save_poi_without_poi_type_message">¿Quiere guardar el punto de interés sin especificar el tipo?</string> <string name="save_poi_without_poi_type_message">¿Quiere guardar el punto de interés sin especificar el tipo?</string>
<string name="shared_string_location">Ubicación</string> <string name="shared_string_location">Ubicación</string>
<string name="poi_context_menu_modify_osm_change">Modificar el cambio OSM</string> <string name="poi_context_menu_modify_osm_change">Modificar cambio OSM</string>
</resources> <string name="osm_edit_modified_poi">PDI de OSM modificado</string>
<string name="osm_edit_deleted_poi">PDI de OSM borrado</string>
<string name="context_menu_item_open_note">Nota OSM abierta</string>
<string name="osm_edit_reopened_note">Nota OSM reabierta</string>
<string name="osm_edit_commented_note">Nota OSM comentada</string>
<string name="osm_edit_removed_note">Nota OSM borrada</string>
<string name="osm_edit_created_note">Nota OSM creada</string>
<string name="osn_bug_name">Nota OSM</string>
<string name="osn_add_dialog_title">Crear nota</string>
<string name="osn_comment_dialog_title">Añadir comentario</string>
<string name="osn_reopen_dialog_title">Reabrir nota</string>
<string name="osn_close_dialog_title">Cerrar nota</string>
<string name="osn_add_dialog_success">Nota creada exitosamente</string>
<string name="osn_add_dialog_error">Error: la nota no se creó</string>
<string name="osn_close_dialog_success">El error se cerró exitosamente</string>
<string name="osn_close_dialog_error">Error: no se cerró la nota</string>
<string name="shared_string_commit">Confirmar</string>
<string name="context_menu_item_delete_waypoint">¿Borrar punto de ruta GPX?</string>
<string name="context_menu_item_edit_waypoint">Editar punto de ruta GPX</string>
<string name="rendering_attr_currentTrackColor_description">Color del GPX</string>
<string name="rendering_attr_currentTrackWidth_description">Ancho del GPX</string>
<string name="rendering_attr_roadStyle_description">Estilo de carretera</string>
<string name="poi_dialog_reopen">Reabrir</string>
</resources>

View file

@ -1970,4 +1970,9 @@
<string name="shared_string_commit">Confirmar</string> <string name="shared_string_commit">Confirmar</string>
<string name="poi_dialog_reopen">Reabrir</string> <string name="poi_dialog_reopen">Reabrir</string>
</resources> <string name="osm_edit_modified_poi">PDI de OSM modificado</string>
<string name="osm_edit_deleted_poi">PDI de OSM borrado</string>
<string name="rendering_attr_currentTrackColor_description">Color del GPX</string>
<string name="rendering_attr_currentTrackWidth_description">Ancho del GPX</string>
<string name="rendering_attr_roadStyle_description">Estilo de carretera</string>
</resources>

View file

@ -1689,4 +1689,10 @@
<string name="poi_elevator_yes">Cun ascensore</string> <string name="poi_elevator_yes">Cun ascensore</string>
<string name="poi_elevator_no">Chene ascensore</string> <string name="poi_elevator_no">Chene ascensore</string>
<string name="poi_technical_monument">Monumentu tècnicu</string>
<string name="poi_office_camping">Ufìtziu de su campègiu</string>
<string name="poi_model_aerodrome">Aeròdromu pro modellinos</string>
<string name="poi_street_lamp">Lampione</string>
</resources> </resources>

View file

@ -23,7 +23,6 @@ import android.widget.Toast;
public class MapTileLayer extends BaseMapLayer { public class MapTileLayer extends BaseMapLayer {
protected static final int emptyTileDivisor = 16; protected static final int emptyTileDivisor = 16;
public static final int OVERZOOM_IN = 2; public static final int OVERZOOM_IN = 2;
@ -42,7 +41,7 @@ public class MapTileLayer extends BaseMapLayer {
private boolean visible = true; private boolean visible = true;
public MapTileLayer(boolean mainMap){ public MapTileLayer(boolean mainMap) {
this.mainMap = mainMap; this.mainMap = mainMap;
} }
@ -61,7 +60,7 @@ public class MapTileLayer extends BaseMapLayer {
paintBitmap.setFilterBitmap(true); paintBitmap.setFilterBitmap(true);
paintBitmap.setAlpha(getAlpha()); paintBitmap.setAlpha(getAlpha());
if(mapTileAdapter != null && view != null){ if (mapTileAdapter != null && view != null) {
mapTileAdapter.initLayerAdapter(this, view); mapTileAdapter.initLayerAdapter(this, view);
} }
} }
@ -75,29 +74,29 @@ public class MapTileLayer extends BaseMapLayer {
} }
public void setMapTileAdapter(MapTileAdapter mapTileAdapter) { public void setMapTileAdapter(MapTileAdapter mapTileAdapter) {
if(this.mapTileAdapter == mapTileAdapter){ if (this.mapTileAdapter == mapTileAdapter) {
return; return;
} }
if(this.mapTileAdapter != null){ if (this.mapTileAdapter != null) {
this.mapTileAdapter.onClear(); this.mapTileAdapter.onClear();
} }
this.mapTileAdapter = mapTileAdapter; this.mapTileAdapter = mapTileAdapter;
if(mapTileAdapter != null && view != null){ if (mapTileAdapter != null && view != null) {
mapTileAdapter.initLayerAdapter(this, view); mapTileAdapter.initLayerAdapter(this, view);
mapTileAdapter.onInit(); mapTileAdapter.onInit();
} }
} }
public void setMapForMapTileAdapter(ITileSource map, MapTileAdapter mapTileAdapter) { public void setMapForMapTileAdapter(ITileSource map, MapTileAdapter mapTileAdapter) {
if(mapTileAdapter == this.mapTileAdapter){ if (mapTileAdapter == this.mapTileAdapter) {
this.map = map; this.map = map;
} }
} }
public void setMap(ITileSource map) { public void setMap(ITileSource map) {
MapTileAdapter target = null; MapTileAdapter target = null;
if(map instanceof TileSourceTemplate){ if (map instanceof TileSourceTemplate) {
if(TileSourceManager.RULE_YANDEX_TRAFFIC.equals(((TileSourceTemplate) map).getRule())){ if (TileSourceManager.RULE_YANDEX_TRAFFIC.equals(((TileSourceTemplate) map).getRule())) {
map = null; map = null;
target = new YandexTrafficAdapter(); target = new YandexTrafficAdapter();
} }
@ -118,7 +117,7 @@ public class MapTileLayer extends BaseMapLayer {
if ((map == null && mapTileAdapter == null) || !visible) { if ((map == null && mapTileAdapter == null) || !visible) {
return; return;
} }
if(mapTileAdapter != null){ if (mapTileAdapter != null) {
mapTileAdapter.onDraw(canvas, tileBox, drawSettings); mapTileAdapter.onDraw(canvas, tileBox, drawSettings);
} }
drawTileMap(canvas, tileBox); drawTileMap(canvas, tileBox);
@ -131,7 +130,7 @@ public class MapTileLayer extends BaseMapLayer {
public void drawTileMap(Canvas canvas, RotatedTileBox tileBox) { public void drawTileMap(Canvas canvas, RotatedTileBox tileBox) {
ITileSource map = this.map; ITileSource map = this.map;
if(map == null){ if (map == null) {
return; return;
} }
ResourceManager mgr = resourceManager; ResourceManager mgr = resourceManager;
@ -164,8 +163,8 @@ public class MapTileLayer extends BaseMapLayer {
int x1 = tileBox.getPixXFromTileXNoRot(leftPlusI); int x1 = tileBox.getPixXFromTileXNoRot(leftPlusI);
int x2 = tileBox.getPixXFromTileXNoRot(leftPlusI + 1); int x2 = tileBox.getPixXFromTileXNoRot(leftPlusI + 1);
int y1 = tileBox.getPixYFromTileYNoRot(topPlusJ - ellipticTileCorrection); int y1 = tileBox.getPixYFromTileYNoRot(topPlusJ - ellipticTileCorrection);
int y2 = tileBox.getPixYFromTileYNoRot(topPlusJ + 1 - ellipticTileCorrection); int y2 = tileBox.getPixYFromTileYNoRot(topPlusJ + 1 - ellipticTileCorrection);
bitmapToDraw.set(x1, y1, x2 , y2); bitmapToDraw.set(x1, y1, x2 , y2);
final int tileX = leftPlusI; final int tileX = leftPlusI;
@ -213,15 +212,15 @@ public class MapTileLayer extends BaseMapLayer {
Math.max(yZoom - margin , 0), Math.max(yZoom - margin , 0),
Math.min(margin + xZoom + tileSize / div, tileSize), Math.min(margin + xZoom + tileSize / div, tileSize),
Math.min(margin + yZoom + tileSize / div, tileSize)); Math.min(margin + yZoom + tileSize / div, tileSize));
if(!useSampling) { if (!useSampling) {
canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap); canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap);
} else { } else {
int scaledSize = tileSize / div; int scaledSize = tileSize / div;
RectF src = new RectF(0.5f, 0.5f, RectF src = new RectF(0.5f, 0.5f,
scaledSize + 2 * margin - 0.5f, scaledSize + 2 * margin - 0.5f); scaledSize + 2 * margin - 0.5f, scaledSize + 2 * margin - 0.5f);
RectF dest = new RectF(0, 0, tileSize, tileSize); RectF dest = new RectF(0, 0, tileSize, tileSize);
Matrix m = new Matrix(); Matrix m = new Matrix();
m.setRectToRect(src, dest, Matrix.ScaleToFit.FILL); m.setRectToRect(src, dest, Matrix.ScaleToFit.FILL);
Bitmap sampled = Bitmap.createBitmap(bmp, bitmapToZoom.left, bitmapToZoom.top, Bitmap sampled = Bitmap.createBitmap(bmp, bitmapToZoom.left, bitmapToZoom.top,
scaledSize + 2 * margin - 1, scaledSize + 2 * margin - 1, m, true); scaledSize + 2 * margin - 1, scaledSize + 2 * margin - 1, m, true);
bitmapToZoom.set(0, 0, tileSize, tileSize); bitmapToZoom.set(0, 0, tileSize, tileSize);
@ -234,15 +233,14 @@ public class MapTileLayer extends BaseMapLayer {
bitmapToZoom.set(0, 0, tileSize, tileSize); bitmapToZoom.set(0, 0, tileSize, tileSize);
canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap); canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap);
} }
if(bmp != null) { if (bmp != null) {
oneTileShown = true; oneTileShown = true;
} }
} }
} }
if(mainMap && !oneTileShown && !useInternet && warningToSwitchMapShown < 3){ if (mainMap && !oneTileShown && !useInternet && warningToSwitchMapShown < 3) {
if(resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), nzoom)){ if (resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), nzoom)) {
AccessibleToast.makeText(view.getContext(), R.string.switch_to_vector_map_to_see, Toast.LENGTH_LONG).show(); AccessibleToast.makeText(view.getContext(), R.string.switch_to_vector_map_to_see, Toast.LENGTH_LONG).show();
warningToSwitchMapShown++; warningToSwitchMapShown++;
} }
@ -255,21 +253,13 @@ public class MapTileLayer extends BaseMapLayer {
@Override @Override
public int getMaximumShownMapZoom(){ public int getMaximumShownMapZoom() {
if(map == null){ return map == null ? 20 : map.getMaximumZoomSupported() + OVERZOOM_IN;
return 20;
} else {
return map.getMaximumZoomSupported() + OVERZOOM_IN;
}
} }
@Override @Override
public int getMinimumShownMapZoom(){ public int getMinimumShownMapZoom() {
if(map == null){ return map == null ? 1 : map.getMinimumZoomSupported();
return 1;
} else {
return map.getMinimumZoomSupported();
}
} }
@Override @Override
@ -288,6 +278,5 @@ public class MapTileLayer extends BaseMapLayer {
public ITileSource getMap() { public ITileSource getMap() {
return map; return map;
} }
} }