Add double buffer for images
This commit is contained in:
parent
fb3bd38400
commit
0a4e0ae3b8
10 changed files with 65 additions and 71 deletions
|
@ -89,11 +89,6 @@
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
|
||||||
<name>net.rim.ajde.internal.verifier</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||||
|
@ -102,7 +97,6 @@
|
||||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
<nature>net.rim.ajde.BlackBerryAndroidNature</nature>
|
|
||||||
</natures>
|
</natures>
|
||||||
<linkedResources>
|
<linkedResources>
|
||||||
<link>
|
<link>
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class RotatedTileBox {
|
||||||
private float tileWidth;
|
private float tileWidth;
|
||||||
private float tileHeight;
|
private float tileHeight;
|
||||||
private float rotate;
|
private float rotate;
|
||||||
private int zoom;
|
private float zoom;
|
||||||
private float rotateCos;
|
private float rotateCos;
|
||||||
private float rotateSin;
|
private float rotateSin;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class RotatedTileBox {
|
||||||
rotateSin = FloatMath.sin(rad);
|
rotateSin = FloatMath.sin(rad);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(float leftTileX, float topTileY, float tileWidth, float tileHeight, float rotate, int zoom) {
|
public void set(float leftTileX, float topTileY, float tileWidth, float tileHeight, float rotate, float zoom) {
|
||||||
this.leftTileX = leftTileX;
|
this.leftTileX = leftTileX;
|
||||||
if(rotate < 0){
|
if(rotate < 0){
|
||||||
rotate += 360;
|
rotate += 360;
|
||||||
|
@ -51,9 +51,13 @@ public class RotatedTileBox {
|
||||||
return rotateSin;
|
return rotateSin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZoom() {
|
public float getZoom() {
|
||||||
return zoom;
|
return zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getIntZoom() {
|
||||||
|
return Math.round(zoom);
|
||||||
|
}
|
||||||
|
|
||||||
public float getRotate() {
|
public float getRotate() {
|
||||||
return rotate;
|
return rotate;
|
||||||
|
@ -77,7 +81,7 @@ public class RotatedTileBox {
|
||||||
|
|
||||||
public boolean containsTileBox(RotatedTileBox box) {
|
public boolean containsTileBox(RotatedTileBox box) {
|
||||||
PointF temp = new PointF();
|
PointF temp = new PointF();
|
||||||
if(box.getZoom() != zoom){
|
if(box.zoom != zoom){
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
box.calcPointTile(0, 0, temp);
|
box.calcPointTile(0, 0, temp);
|
||||||
|
@ -105,7 +109,7 @@ public class RotatedTileBox {
|
||||||
float tx3 = calcPointTileX(0, tileHeight);
|
float tx3 = calcPointTileX(0, tileHeight);
|
||||||
float minTileX = Math.min(Math.min(leftTileX, tx), Math.min(tx2, tx3)) ;
|
float minTileX = Math.min(Math.min(leftTileX, tx), Math.min(tx2, tx3)) ;
|
||||||
float maxTileX = Math.max(Math.max(leftTileX, tx), Math.max(tx2, tx3)) ;
|
float maxTileX = Math.max(Math.max(leftTileX, tx), Math.max(tx2, tx3)) ;
|
||||||
int max = 1 << zoom;
|
int max = (int) MapUtils.getPowZoom(zoom);
|
||||||
if(minTileX < 0){
|
if(minTileX < 0){
|
||||||
minTileX = 0;
|
minTileX = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,6 +458,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeZoom(float newZoom){
|
public void changeZoom(float newZoom){
|
||||||
|
newZoom = Math.round(newZoom * OsmandMapTileView.ZOOM_DELTA) * OsmandMapTileView.ZOOM_DELTA_1;
|
||||||
boolean changeLocation = settings.AUTO_ZOOM_MAP.get();
|
boolean changeLocation = settings.AUTO_ZOOM_MAP.get();
|
||||||
mapView.getAnimatedDraggingThread().startZooming(newZoom, changeLocation);
|
mapView.getAnimatedDraggingThread().startZooming(newZoom, changeLocation);
|
||||||
if (getMyApplication().accessibilityEnabled())
|
if (getMyApplication().accessibilityEnabled())
|
||||||
|
@ -703,7 +704,9 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
|
SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
|
||||||
Sensor s = sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION);
|
Sensor s = sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION);
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
sensorMgr.registerListener(this, s, SensorManager.SENSOR_DELAY_UI);
|
if(!sensorMgr.registerListener(this, s, SensorManager.SENSOR_DELAY_NORMAL)) {
|
||||||
|
Log.e(LogUtil.TAG, "Sensor could not be enabled");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sensorRegistered = true;
|
sensorRegistered = true;
|
||||||
}
|
}
|
||||||
|
@ -881,22 +884,6 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
||||||
}
|
}
|
||||||
|
|
||||||
public float defineZoomFromSpeed(float speed) {
|
public float defineZoomFromSpeed(float speed) {
|
||||||
// Hardy's old implementation: correct for roughly constant "look ahead" distance on different screens using screen size correction, see Issue 914
|
|
||||||
// less than 23: show zoom 17
|
|
||||||
// int screenSizeCorrection = (int)Math.round(Math.log(((float)getMapView().getHeight())/320.0f) / Math.log(2.0f));
|
|
||||||
// if(speed < 23f/3.6){
|
|
||||||
// return 17 + screenSizeCorrection;
|
|
||||||
// } else if(speed < 43f/3.6){
|
|
||||||
// return 16 + screenSizeCorrection;
|
|
||||||
// } else if(speed < 63f/3.6){
|
|
||||||
// return 15 + screenSizeCorrection;
|
|
||||||
// } else if(speed < 83f/3.6){
|
|
||||||
// return 14 + screenSizeCorrection;
|
|
||||||
// }
|
|
||||||
// return 13 + screenSizeCorrection;
|
|
||||||
|
|
||||||
// new implementation
|
|
||||||
// TODO Hardy: verify look ahead distance, there still seems bug in calculation
|
|
||||||
if (speed < 7f / 3.6) {
|
if (speed < 7f / 3.6) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,10 +528,10 @@ public class MapRenderRepositories {
|
||||||
boolean loaded;
|
boolean loaded;
|
||||||
if(nativeLib != null) {
|
if(nativeLib != null) {
|
||||||
cObjects = new LinkedList<BinaryMapDataObject>();
|
cObjects = new LinkedList<BinaryMapDataObject>();
|
||||||
loaded = loadVectorDataNative(dataBox, requestedBox.getZoom(), renderingReq, nativeLib);
|
loaded = loadVectorDataNative(dataBox, requestedBox.getIntZoom(), renderingReq, nativeLib);
|
||||||
} else {
|
} else {
|
||||||
cNativeObjects = null;
|
cNativeObjects = null;
|
||||||
loaded = loadVectorData(dataBox, requestedBox.getZoom(), renderingReq);
|
loaded = loadVectorData(dataBox, requestedBox.getIntZoom(), renderingReq);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!loaded || checkWhetherInterrupted()) {
|
if (!loaded || checkWhetherInterrupted()) {
|
||||||
|
@ -542,19 +542,19 @@ public class MapRenderRepositories {
|
||||||
|
|
||||||
currentRenderingContext = new OsmandRenderer.RenderingContext(context);
|
currentRenderingContext = new OsmandRenderer.RenderingContext(context);
|
||||||
renderingReq.clearState();
|
renderingReq.clearState();
|
||||||
renderingReq.setIntFilter(renderingReq.ALL.R_MINZOOM, requestedBox.getZoom());
|
renderingReq.setIntFilter(renderingReq.ALL.R_MINZOOM, requestedBox.getIntZoom());
|
||||||
if(renderingReq.searchRenderingAttribute(RenderingRuleStorageProperties.A_DEFAULT_COLOR)) {
|
if(renderingReq.searchRenderingAttribute(RenderingRuleStorageProperties.A_DEFAULT_COLOR)) {
|
||||||
currentRenderingContext.defaultColor = renderingReq.getIntPropertyValue(renderingReq.ALL.R_ATTR_COLOR_VALUE);
|
currentRenderingContext.defaultColor = renderingReq.getIntPropertyValue(renderingReq.ALL.R_ATTR_COLOR_VALUE);
|
||||||
}
|
}
|
||||||
renderingReq.clearState();
|
renderingReq.clearState();
|
||||||
renderingReq.setIntFilter(renderingReq.ALL.R_MINZOOM, requestedBox.getZoom());
|
renderingReq.setIntFilter(renderingReq.ALL.R_MINZOOM, requestedBox.getIntZoom());
|
||||||
if(renderingReq.searchRenderingAttribute(RenderingRuleStorageProperties.A_SHADOW_RENDERING)) {
|
if(renderingReq.searchRenderingAttribute(RenderingRuleStorageProperties.A_SHADOW_RENDERING)) {
|
||||||
currentRenderingContext.shadowRenderingMode = renderingReq.getIntPropertyValue(renderingReq.ALL.R_ATTR_INT_VALUE);
|
currentRenderingContext.shadowRenderingMode = renderingReq.getIntPropertyValue(renderingReq.ALL.R_ATTR_INT_VALUE);
|
||||||
currentRenderingContext.shadowRenderingColor = renderingReq.getIntPropertyValue(renderingReq.ALL.R_SHADOW_COLOR);
|
currentRenderingContext.shadowRenderingColor = renderingReq.getIntPropertyValue(renderingReq.ALL.R_SHADOW_COLOR);
|
||||||
}
|
}
|
||||||
currentRenderingContext.leftX = (float) requestedBox.getLeftTileX();
|
currentRenderingContext.leftX = requestedBox.getLeftTileX();
|
||||||
currentRenderingContext.topY = (float) requestedBox.getTopTileY();
|
currentRenderingContext.topY = requestedBox.getTopTileY() ;
|
||||||
currentRenderingContext.zoom = requestedBox.getZoom();
|
currentRenderingContext.zoom = requestedBox.getIntZoom();
|
||||||
currentRenderingContext.rotate = requestedBox.getRotate();
|
currentRenderingContext.rotate = requestedBox.getRotate();
|
||||||
currentRenderingContext.width = (int) (requestedBox.getTileWidth() * OsmandRenderer.TILE_SIZE);
|
currentRenderingContext.width = (int) (requestedBox.getTileWidth() * OsmandRenderer.TILE_SIZE);
|
||||||
currentRenderingContext.height = (int) (requestedBox.getTileHeight() * OsmandRenderer.TILE_SIZE);
|
currentRenderingContext.height = (int) (requestedBox.getTileHeight() * OsmandRenderer.TILE_SIZE);
|
||||||
|
@ -562,6 +562,8 @@ public class MapRenderRepositories {
|
||||||
currentRenderingContext.useEnglishNames = prefs.USE_ENGLISH_NAMES.get();
|
currentRenderingContext.useEnglishNames = prefs.USE_ENGLISH_NAMES.get();
|
||||||
currentRenderingContext.setDensityValue(prefs.USE_HIGH_RES_MAPS.get(),
|
currentRenderingContext.setDensityValue(prefs.USE_HIGH_RES_MAPS.get(),
|
||||||
prefs.MAP_TEXT_SIZE.get(), renderer.getDensity());
|
prefs.MAP_TEXT_SIZE.get(), renderer.getDensity());
|
||||||
|
// init rendering context
|
||||||
|
currentRenderingContext.tileDivisor = (float) MapUtils.getPowZoom(31 - requestedBox.getZoom());
|
||||||
if (checkWhetherInterrupted()) {
|
if (checkWhetherInterrupted()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -573,19 +575,25 @@ public class MapRenderRepositories {
|
||||||
if (rr != null) {
|
if (rr != null) {
|
||||||
transparent = renderingReq.getIntPropertyValue(rr) > 0;
|
transparent = renderingReq.getIntPropertyValue(rr) > 0;
|
||||||
}
|
}
|
||||||
// if(transparent) {
|
|
||||||
// bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.ARGB_8888);
|
|
||||||
// } else {
|
|
||||||
bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.RGB_565);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 1. generate image step by step
|
// 1. generate image step by step
|
||||||
|
Bitmap reuse = prevBmp;
|
||||||
this.prevBmp = this.bmp;
|
this.prevBmp = this.bmp;
|
||||||
this.prevBmpLocation = this.bmpLocation;
|
this.prevBmpLocation = this.bmpLocation;
|
||||||
|
if (reuse != null && reuse.getWidth() == currentRenderingContext.width && reuse.getHeight() == currentRenderingContext.height) {
|
||||||
|
bmp = reuse;
|
||||||
|
bmp.eraseColor(currentRenderingContext.defaultColor);
|
||||||
|
} else {
|
||||||
|
if(reuse != null){
|
||||||
|
log.error(String.format("Create new image ? %d != %d (w) %d != %d (h) ", currentRenderingContext.width, reuse.getWidth(), currentRenderingContext.height, reuse.getHeight()));
|
||||||
|
}
|
||||||
|
bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.RGB_565);
|
||||||
|
}
|
||||||
this.bmp = bmp;
|
this.bmp = bmp;
|
||||||
this.bmpLocation = tileRect;
|
this.bmpLocation = tileRect;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(nativeLib != null) {
|
if(nativeLib != null) {
|
||||||
renderer.generateNewBitmapNative(currentRenderingContext, nativeLib, cNativeObjects, bmp, renderingReq, notifyList);
|
renderer.generateNewBitmapNative(currentRenderingContext, nativeLib, cNativeObjects, bmp, renderingReq, notifyList);
|
||||||
} else {
|
} else {
|
||||||
|
@ -601,8 +609,11 @@ public class MapRenderRepositories {
|
||||||
// revert if it was interrupted
|
// revert if it was interrupted
|
||||||
// (be smart a bit do not revert if road already drawn)
|
// (be smart a bit do not revert if road already drawn)
|
||||||
if(currentRenderingContext.lastRenderedKey < 35) {
|
if(currentRenderingContext.lastRenderedKey < 35) {
|
||||||
|
reuse = this.bmp;
|
||||||
this.bmp = this.prevBmp;
|
this.bmp = this.prevBmp;
|
||||||
this.bmpLocation = this.prevBmpLocation;
|
this.bmpLocation = this.prevBmpLocation;
|
||||||
|
this.prevBmp = reuse;
|
||||||
|
this.prevBmpLocation = null;
|
||||||
}
|
}
|
||||||
currentRenderingContext = null;
|
currentRenderingContext = null;
|
||||||
return;
|
return;
|
||||||
|
@ -610,7 +621,8 @@ public class MapRenderRepositories {
|
||||||
currentRenderingContext = null;
|
currentRenderingContext = null;
|
||||||
|
|
||||||
// 2. replace whole image
|
// 2. replace whole image
|
||||||
this.prevBmp = null;
|
// keep cache
|
||||||
|
// this.prevBmp = null;
|
||||||
this.prevBmpLocation = null;
|
this.prevBmpLocation = null;
|
||||||
if (prefs.DEBUG_RENDERING_INFO.get()) {
|
if (prefs.DEBUG_RENDERING_INFO.get()) {
|
||||||
String timeInfo = "Searching: " + searchTime + " ms"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
String timeInfo = "Searching: " + searchTime + " ms"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
||||||
|
@ -660,15 +672,16 @@ public class MapRenderRepositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap getPrevBitmap() {
|
public Bitmap getPrevBitmap() {
|
||||||
return prevBmp;
|
return prevBmpLocation == null ? null : prevBmp ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void clearCache() {
|
public synchronized void clearCache() {
|
||||||
cObjects = new ArrayList<BinaryMapDataObject>();
|
cObjects = new ArrayList<BinaryMapDataObject>();
|
||||||
cObjectsBox = new RectF();
|
cObjectsBox = new RectF();
|
||||||
prevBmp = null;
|
|
||||||
requestedBox = prevBmpLocation = null;
|
requestedBox = prevBmpLocation = null;
|
||||||
// Do not clear main bitmap to not cause a screen refresh
|
// Do not clear main bitmap to not cause a screen refresh
|
||||||
|
// prevBmp = null;
|
||||||
// bmp = null;
|
// bmp = null;
|
||||||
// bmpLocation = null;
|
// bmpLocation = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,13 +49,11 @@ public class MapVectorLayer extends BaseMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRotatedTileBox(){
|
private void updateRotatedTileBox(){
|
||||||
// float ts = view.getTileSize();
|
float mult = (float) Math.pow(2, view.getFloatZoom() - view.getZoom());
|
||||||
int zm = Math.round(view.getFloatZoom());
|
float xL = (view.calcDiffTileX(pixRect.left - view.getCenterPointX(), pixRect.top - view.getCenterPointY()) + view.getXTile());
|
||||||
float xL = view.calcDiffTileX(pixRect.left - view.getCenterPointX(), pixRect.top - view.getCenterPointY()) + view.getXTile();
|
float yT = (view.calcDiffTileY(pixRect.left - view.getCenterPointX(), pixRect.top - view.getCenterPointY()) + view.getYTile()) ;
|
||||||
float yT = view.calcDiffTileY(pixRect.left - view.getCenterPointX(), pixRect.top - view.getCenterPointY()) + view.getYTile();
|
float ts = view.getSourceTileSize();
|
||||||
float mult = (float) Math.pow(2, zm - view.getZoom());
|
rotatedTileBox.set(xL * mult, yT * mult, ((float) pixRect.width()) / ts , ((float) pixRect.height()) / ts, view.getRotate(), view.getFloatZoom());
|
||||||
float ts = (float) (view.getSourceTileSize() * Math.pow(2, view.getFloatZoom() - (int) zm));
|
|
||||||
rotatedTileBox.set(xL * mult, yT * mult, ((float) pixRect.width()) / ts , ((float) pixRect.height()) / ts, view.getRotate(), zm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVectorDataVisible() {
|
public boolean isVectorDataVisible() {
|
||||||
|
@ -118,21 +116,23 @@ public class MapVectorLayer extends BaseMapLayer {
|
||||||
if (bmp != null && bmpLoc != null) {
|
if (bmp != null && bmpLoc != null) {
|
||||||
float rot = bmpLoc.getRotate();
|
float rot = bmpLoc.getRotate();
|
||||||
float mult = (float) MapUtils.getPowZoom(view.getZoom() - bmpLoc.getZoom());
|
float mult = (float) MapUtils.getPowZoom(view.getZoom() - bmpLoc.getZoom());
|
||||||
|
float fmult = (float) MapUtils.getPowZoom(view.getFloatZoom() - bmpLoc.getZoom());
|
||||||
|
|
||||||
float tx = view.getXTile();
|
float tx = view.getXTile() / mult;
|
||||||
float ty = view.getYTile();
|
float ty = view.getYTile() / mult;
|
||||||
float dleftX1 = (bmpLoc.getLeftTileX() * mult - tx) ;
|
float dleftX1 = bmpLoc.getLeftTileX() - tx;
|
||||||
float dtopY1 = (bmpLoc.getTopTileY() * mult - ty);
|
float dtopY1 = bmpLoc.getTopTileY() - ty;
|
||||||
|
|
||||||
|
float ts = view.getSourceTileSize() * fmult;
|
||||||
|
|
||||||
float cos = bmpLoc.getRotateCos();
|
float cos = bmpLoc.getRotateCos();
|
||||||
float sin = bmpLoc.getRotateSin();
|
float sin = bmpLoc.getRotateSin();
|
||||||
float x1 = MapUtils.calcDiffPixelX(sin, cos, dleftX1, dtopY1, view.getTileSize()) + view.getCenterPointX();
|
float x1 = MapUtils.calcDiffPixelX(sin, cos, dleftX1, dtopY1, ts) + view.getCenterPointX();
|
||||||
float y1 = MapUtils.calcDiffPixelY(sin, cos, dleftX1, dtopY1, view.getTileSize()) + view.getCenterPointY();
|
float y1 = MapUtils.calcDiffPixelY(sin, cos, dleftX1, dtopY1, ts) + view.getCenterPointY();
|
||||||
|
|
||||||
canvas.rotate(-rot, view.getCenterPointX(), view.getCenterPointY());
|
canvas.rotate(-rot, view.getCenterPointX(), view.getCenterPointY());
|
||||||
destImage.set(x1, y1, x1 + bmpLoc.getTileWidth() * mult * view.getTileSize(), y1 + bmpLoc.getTileHeight() * mult
|
destImage.set(x1, y1, x1 + bmpLoc.getTileWidth() * ts, y1 +
|
||||||
* view.getTileSize());
|
bmpLoc.getTileHeight() * ts);
|
||||||
if(!bmp.isRecycled()){
|
if(!bmp.isRecycled()){
|
||||||
canvas.drawBitmap(bmp, null, destImage, paintImg);
|
canvas.drawBitmap(bmp, null, destImage, paintImg);
|
||||||
shown = true;
|
shown = true;
|
||||||
|
|
|
@ -160,8 +160,6 @@ public class OsmandRenderer {
|
||||||
Bitmap bmp, RenderingRuleSearchRequest render, final List<IMapDownloaderCallback> notifyList) {
|
Bitmap bmp, RenderingRuleSearchRequest render, final List<IMapDownloaderCallback> notifyList) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (rc.width > 0 && rc.height > 0 && searchResultHandler != null) {
|
if (rc.width > 0 && rc.height > 0 && searchResultHandler != null) {
|
||||||
// init rendering context
|
|
||||||
rc.tileDivisor = (int) (1 << (31 - rc.zoom));
|
|
||||||
rc.cosRotateTileSize = FloatMath.cos((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
rc.cosRotateTileSize = FloatMath.cos((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
try {
|
try {
|
||||||
|
@ -201,8 +199,6 @@ public class OsmandRenderer {
|
||||||
cv.drawColor(rc.defaultColor);
|
cv.drawColor(rc.defaultColor);
|
||||||
}
|
}
|
||||||
if (objects != null && !objects.isEmpty() && rc.width > 0 && rc.height > 0) {
|
if (objects != null && !objects.isEmpty() && rc.width > 0 && rc.height > 0) {
|
||||||
// init rendering context
|
|
||||||
rc.tileDivisor = (int) (1 << (31 - rc.zoom));
|
|
||||||
rc.cosRotateTileSize = FloatMath.cos((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
rc.cosRotateTileSize = FloatMath.cos((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,7 @@ public class RoutingHelper {
|
||||||
public String formatStreetName(String name, String ref) {
|
public String formatStreetName(String name, String ref) {
|
||||||
if(name != null && name.length() > 0){
|
if(name != null && name.length() > 0){
|
||||||
if(ref != null && ref.length() > 0) {
|
if(ref != null && ref.length() > 0) {
|
||||||
name += "(" + ref +")";
|
name = ref + " " + name;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -303,11 +303,11 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (view.isZooming()) {
|
if (view.isZooming()) {
|
||||||
activity.changeZoom(view.getZoom() + 2 );
|
// activity.changeZoom(view.getZoom() + 2 );
|
||||||
// activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 );
|
activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||||
} else {
|
} else {
|
||||||
activity.changeZoom(view.getZoom() + 1 );
|
// activity.changeZoom(view.getZoom() + 1 );
|
||||||
// activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -316,8 +316,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
zoomOutButton.setOnClickListener(new View.OnClickListener() {
|
zoomOutButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
activity.changeZoom(view.getZoom() - 1 );
|
// activity.changeZoom(view.getZoom() - 1 );
|
||||||
// activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,7 +617,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
if (!text.equals(getText().toString())) {
|
if (!text.equals(getText().toString())) {
|
||||||
TextPaint pp = new TextPaint(getPaint());
|
TextPaint pp = new TextPaint(getPaint());
|
||||||
if (!text.equals("")) {
|
if (!text.equals("")) {
|
||||||
pp.setTextSize(25 * scaleCoefficient);
|
pp.setTextSize(20 * scaleCoefficient);
|
||||||
float ts = pp.measureText(text);
|
float ts = pp.measureText(text);
|
||||||
int wth = getWidth();
|
int wth = getWidth();
|
||||||
while (ts > wth && pp.getTextSize() > (14 * scaleCoefficient)) {
|
while (ts > wth && pp.getTextSize() > (14 * scaleCoefficient)) {
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class NextTurnInfoControl extends MapInfoControl {
|
||||||
canvas.translate(0, 3 * scaleCoefficient);
|
canvas.translate(0, 3 * scaleCoefficient);
|
||||||
canvas.drawPath(pathForTurn, paintRouteDirection);
|
canvas.drawPath(pathForTurn, paintRouteDirection);
|
||||||
canvas.drawPath(pathForTurn, paintBlack);
|
canvas.drawPath(pathForTurn, paintBlack);
|
||||||
if (exitOut != null && !horisontalMini) {
|
if (exitOut != null && !horisontalMini && !makeUturnWhenPossible) {
|
||||||
drawShadowText(canvas, exitOut, width / 2 - 7 * scaleCoefficient,
|
drawShadowText(canvas, exitOut, width / 2 - 7 * scaleCoefficient,
|
||||||
height / 2 + textPaint.getTextSize() / 2 - 3 * scaleCoefficient, textPaint);
|
height / 2 + textPaint.getTextSize() / 2 - 3 * scaleCoefficient, textPaint);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue