osmbonuspack icon indicating copy to clipboard operation
osmbonuspack copied to clipboard

GroundOverlay : bug in docs and need help with positioning by 1 point

Open djdance opened this issue 2 years ago • 4 comments

I used old GroundOverlay this way, as described in the manual:

GroundOverlay myGroundOverlay = new GroundOverlay(this);
myGroundOverlay.setPosition(p);
myGroundOverlay.setImage(getResources().getDrawable(R.drawable.ic_launcher).mutate());
myGroundOverlay.setDimensions(2000.0f);
map.getOverlays().add(myGroundOverlay);

now in the last release it is not possible to do so, because setPosition wants 2 points, and no setDimensions() anymore. Thus the documentation is obsolete :-)

But anyway. How could I workaround this? I know only one point, and I need to just scale my image. I have no bounding box and don't need in complex matrix transformations. Just simply place a picture in a center.

Thanks.

djdance avatar May 25 '23 18:05 djdance

Take care that you have access to 2 different GroundOverlay classes: one in osmdroid, and another one in OSMBonusPack. OSMBonusPack class handles setDimensions. Import the class you really want!

MKergall avatar May 30 '23 08:05 MKergall

I checked both. Both don't support setDimensions. For example, OSMBonusPack:

https://github.com/MKergall/osmbonuspack/blob/master/OSMBonusPack/src/main/java/org/osmdroid/bonuspack/overlays/GroundOverlay.java

supports only setPositionFromBounds() and no dimensions. Should I import some another version of OSMBonusPack?

djdance avatar May 30 '23 09:05 djdance

Oh sorry, you are right: when I fixed GroundOverlay proper positionning (using Fabrice Fontaine code), setDimensions disapeared. You will have to compute the bounds from the dimension you want. No time to help you short term, but you should find the method you need inside BoundingBox class.

MKergall avatar May 30 '23 09:05 MKergall

Would you be so kind to point me to the closest previous version of OSMBonusPack, where I could find old-school setDimensions? :-)

djdance avatar May 30 '23 10:05 djdance