amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 346 forks source link

Expose the Logic classes and Logics property of renderers #681

Open KevinHu-au opened 4 years ago

KevinHu-au commented 4 years ago

SUMMARY

I would suggest the library expose the Logic classes to enable the customization of the logic.

DETAILS

For example in my case, I have to show the pins for the car parks on the map. Depends on the car park cost, available payment types, vacancy etc..., the pin will have a different "view".

For my first try, I was using BitmapDescriptorFactory.FromView(view) to show a Xamarin.Forms view with the binding to the car park data(cost, available payment types, vacancy etc.). It is working perfectly on iOS, but Android was not that lucky. After some investigation, I suspect the reason could be due to the "delay" renderer on Android for the view. PinLogic.TransformXamarinViewToAndroidBitmap() cannot properly convert the XF view to the Android view.

But PinLogic class is "internal", we cannot inherit the class. If the class is public, and the Logics property of MapRender is "protected" (instead of internal), I would inherit the class and draw a bitmap for the Pin, and then replace the PinLogic for the Logics property of MapRender.

Because I do like the library, I forked the repository and did the changes on the forked repository. I achieved what I want to implement. But if I can directly extend the feature from the official library, that will a little easier.

Screen Shot 2019-12-11 at 11 13 12 am

PLATFORMS

hvaughan3 commented 1 year ago

This appears to be completed in the latest 5.0 version. @KevinHu-au Do you happen to have any pointers as to exactly how you overwrote the existing Android behavior to get it working?