opensciencemap / vtm

a vector-tile map library written in java - running on android, desktop and within the browser
GNU Lesser General Public License v3.0
238 stars 176 forks source link

BitmapRenderer isn't working? #131

Open AAverin opened 9 years ago

AAverin commented 9 years ago

I'm playing around with MapScaleBar class here: https://github.com/opensciencemap/vtm/blob/master/vtm-android/src/org/oscim/android/MapScaleBar.java

I copied it to my project and probably went through every line of code already, but can't seem to figure out why nothing is displaying on the screen. Striping all code and leaving only plain bitmap filled with red color also shows nothing, so I suspect MapScaleBar itself isn't a problem, but BitmapRenderer might be. I didn't find BitmapRenderer being used anywhere else in the library, so probably it wasn't checked.

As soon as VectorTileRednerer is working, I suspect that BitmapBucket is ok, but something isn't right in BitmapRenderer. I'll keep digging myself, but maybe you already aware of the issue?

hjanetzek commented 9 years ago

yea, sorry - I saw the problem before and forgot to mark it.. I'll have a look.

Though the MapScaleBar is more or less a test-case for a platform independent HUD using BitmapRenderer. If you only want a scale-bar overlay for android it would probably make more sense to implement it as an android View.

AAverin commented 9 years ago

I thought to make it as a map element to be able to access map zoom values and position to reflect the scaling properly. I managed to get it displaying once - I guess you override 'render' method and forgot to add GL initizalization and other stuff. But that worked only once for me and then scaling disappeared again.

Even though it might be doable using generic android View, such rendering example can help out building more elements. I know I'll need a cool-looking Location marker that will be able to reflect location accuracy, for example, and it would be good to have a plain layer that is just able to render what I draw using Canvas on a Bitmap.