pangula / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Scalebar is not shown #426

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Android 2.2 or 2.3
2. Osmdroid 3.0.10
3. Create map and add ScaleaBarOverlay

What is the expected output? What do you see instead?
There should be the scalebar displayed (it is visible on android 4.x). Actually 
the scalebar is visible for a while before map tiles get loaded. But after 
tiles appear the scalebar is not visible any more.

What version of the product are you using? On what operating system?
- Android 2.2 or 2.3
- Osmdroid 3.0.10

Please provide any additional information below.
I even tried to enable/disable scalebar overlay but nothing helped. I have HW 
acceleration disabled.

Original issue reported on code.google.com by VOu...@gmail.com on 11 May 2013 at 7:11

GoogleCodeExporter commented 9 years ago
I confirm. That's the only issue I got when migrating from 3.0.8. 

Original comment by mathieu....@gmail.com on 12 May 2013 at 6:48

GoogleCodeExporter commented 9 years ago
I have tried the scalebar on the latest trunk and samples project and it is 
working properly. The one thing that jumps out at me is the android version you 
are using - 2.2 or 2.3. Can you confirm that it does work on higher versions 
and is just a problem for those APIs?

Original comment by kurtzm...@gmail.com on 11 Jun 2013 at 1:58

GoogleCodeExporter commented 9 years ago
Yes, confirming. It works well on 3.x and 4.x (At least those particular 3.x 
and 4.x versions I had chance to test it with).

Original comment by vojtech....@gmail.com on 12 Jun 2013 at 9:15

GoogleCodeExporter commented 9 years ago
I got the scaleBar not showing problem on 2.3 (2.3.4)
I fixed it by not setting the canvas matrix for versions below 3.x
i.e. ignoring code: c.setMatrix(mIdentityMatrix)

Original comment by cecile.robin on 3 Oct 2013 at 1:21

GoogleCodeExporter commented 9 years ago
I got the scalebar not showing problem on 4.0.4 (with the 4.4SDK), after 
upgrading OSMDroid from 3.0.8 to 4.0.  Must be reaching parts of Android that 
vojtect isn't.  Like Cecile, I fixed it by removing the line 
c.setMatrix(mIdentityMatrix) from the draw() method.  What does that line do?

Original comment by peter_wi...@btinternet.com on 4 Feb 2014 at 3:25

GoogleCodeExporter commented 9 years ago
On pre-honeycomb it appears that a y-offset of "(canvas.getHeight() - 
mMapView.getHeight())" is required. I believe this accounts for the status bar 
at the top of the screen.

Setting the identity matrix will clear out other modifications we've made to 
the canvas. This is necessary since we are drawing to a fixed location on the 
screen. The fact that it works by omitting this is an anomaly of our safe 
canvas and it's not the best fix.

Really this needs to be re-written to remove the usage of Picture (to allow for 
hardware acceleration) and while we're doing that we should just draw using the 
projection's screen rect as an offset.

Original comment by kurtzm...@gmail.com on 7 Feb 2014 at 9:57

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r1429.

Fix scale bar drawing offset issues < honeycomb.

Original comment by kurtzm...@gmail.com on 7 Feb 2014 at 10:03

GoogleCodeExporter commented 9 years ago
Give that a try and let me know if it works!

Original comment by kurtzm...@gmail.com on 7 Feb 2014 at 10:04

GoogleCodeExporter commented 9 years ago
And post-Honeycomb?

Note also that the usual (non-USA) representation of "nautical" is Nautical 
Mile (NM), Cable (ca) (= 1/10 Nautical Mile), meter (m).  Only the Americans 
use feet with Nautical Miles.

To make that modification seems to involve changes to ScaleBarOverlay, 
ResourceProxy, DefaultResourceProxyImpl and GeoConstants.

Peter Wiles

Original comment by peter_wi...@btinternet.com on 8 Feb 2014 at 2:02

GoogleCodeExporter commented 9 years ago
We are not experiencing any issues post-Honeycomb (make sure you have hardware 
acceleration turned off). If you are experiencing issues, please take a look at 
the OpenStreetMapViewer project where we have a working example.

If there are additional units of measure that you would like us to support then 
we accept patches. Maybe there is a way to make the desired units of measure 
more modular - either by a protected override method or by a factory.

Original comment by kurtzm...@gmail.com on 10 Feb 2014 at 2:48

GoogleCodeExporter commented 9 years ago
If Any one still looking for the solution then do

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

Your scaleBar will be shown i have tried setting Hardware Acclereted to "false" 
in Manifest but didn't worked finally the line in the code did the trick.

Original comment by babar.ma...@gmail.com on 14 Feb 2014 at 12:25

GoogleCodeExporter commented 9 years ago
For any people still having issues with the mIdentityMatrix - I have made some 
changes in the trunk (r1433) that may fix this issue. I just tested on a 2.3.3 
emulator and a 4.3 device and it was working correctly.

Original comment by kurtzm...@gmail.com on 25 Feb 2014 at 4:01