avlsocialconnect / osmdroid

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

Rects drawn in overriden OnDrawItem do not appear (works with 3.0.5.) #427

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Overriding the onDrawItem method in my ItemizedOverlay 
2. Calling the super
3. Trying to draw a Rect below the current point, onto the canvas that 
onDrawItem received as parameter.

What is the expected output? What do you see instead?
I expect to have rectangular labels drawn below the markers but I don't see any 
when using 3.0.10., whereas on the older version, 3.0.5., they are drawn 
correctly. 

What version of the product are you using? On what operating system?
I am using osmdroid-android-3.0.10, Eclipse SDK 4.2.2, Windows 7 x64 
Professional.

Please provide any additional information below.
I suspect this might have something to do with the safe canvas, but I have 
tried to setUseSafeCanvas(false) to no avail.

Original issue reported on code.google.com by matej.di...@gmail.com on 13 May 2013 at 11:00

GoogleCodeExporter commented 9 years ago
In ItemizedOverlay line 128, change the call to onDrawItem() to be:

            canvas.getUnsafeCanvas(new UnsafeCanvasHandler() {
                @Override
                public void onUnsafeCanvas(Canvas canvas) {
                    onDrawItem(canvas, item, mCurScreenCoords);
                }
            });

And let me know if that works!

Original comment by kurtzm...@gmail.com on 13 May 2013 at 1:33

GoogleCodeExporter commented 9 years ago
Thanks, worked like a charm! Is this change something that will be included in 
the next release?

Original comment by matej.di...@gmail.com on 13 May 2013 at 5:15

GoogleCodeExporter commented 9 years ago
This narrows down what the issue is, but as a real solution we should probably 
be passing ISafeCanvas to onDrawItem() rather than passing the regular canvas. 
It's a little more "breaking", but otherwise you will get icon drawing issues 
at high zoom levels.

Original comment by kurtzm...@gmail.com on 15 May 2013 at 1:13

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

Pass an ISafeCanvas into onDrawItem so custom drawing can take place in that 
method by subclasses.

Original comment by kurtzm...@gmail.com on 14 Jun 2013 at 7:37

GoogleCodeExporter commented 9 years ago

Original comment by kurtzm...@gmail.com on 14 Jun 2013 at 7:47

GoogleCodeExporter commented 9 years ago
This has been released in 4.0.

Original comment by kurtzm...@gmail.com on 25 Oct 2013 at 1:47