judero01col / GMap.NET

GMap.NET Windows Forms & Presentation is an excellent open source, powerful, free and cross-platform .NET control. Allows the use of routing, geocoding, directions and maps from Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yendux, Mapy.cz, Maps.lt, iKarte.lv, NearMap, HereMap, CloudMade, WikiMapia, MapQuest and many more.
Other
440 stars 197 forks source link

Avalonia for Mac Support #163

Open brentmetro opened 1 year ago

brentmetro commented 1 year ago

I have begun work on a fork to add support for Avalonia on Mac, I believe the changes should also work for Linux as well if applied. You can view my fork at brentmetro/GMap.NET, check out the avalonia-mac branch. There was a Demo.AvaloniaMac project created, and GMap.NET.AvaloniaMac project. Neither of these were added to the main sln file. I simply ran these via command line with dotnet build/run from their directories.

Target framework is set to net6.0 as that is all I have available to test with currently. Avalonia version was bumped up to the latest 0.10.17.

Some of the Core Internals had to change, so I created a new OSX constant in the Core project file. Most issues were resolved by changing the conditional directives in the project to (!MONO && !OSX) in FastReaderWriterLock.cs and FastResourceLock.cs.

A couple issues remain, as I'm not a deep dotnet developer and unsure the best fix going forwards. SetCursorPos is set to always return true on OSX, Line 26. Then in Cache.cs the ImageCache is not set when initialized or else the tiles threw exceptions, Line 153.

I did add an option to set the ShowCenter property, commit dfe1908. Also there was a zooming bug using the mouse wheel when changing directions that looked to be from passing in the old value twice instead of the new zoom value, commit 076d45e.

Open to any suggestions or comments.