Thursday, March 7, 2019

WhirlyGlobe-Maply 3.0 Status Report #2

I'm two months into the 3.0 effort.  It's going well!

I covered all of this last time, but here's the plan.  We have an Android version and an iOS version.  The iOS version is always better and it's been hard to update the Android version.  To fix this, I need a unified C++ core used on both platforms.

So the first step was a separate C++ core on iOS.  And it's done!

The Port No One Wants

The newly merged C++ core is the Port No One Wants on iOS.  It does nothing new and it's buggy. But it's an important step on the way to a unified toolkit.  And there are bug fixes from Android that can benefit iOS, even it mostly goes the other way.

The big news is it works!  WhirlyGlobe-Maply 3.0 for iOS is now 50% common C++ core.  I was hoping for more, but damn those Mapbox style parsers are wordy.  And I want to leave that in ObjC so users can modify it themselves.

It wasn't all C++ core, though.  I've moved the QuadPaging logic, what you use to load things other than images, over to the new Sampler/Loader architecture.  Man, that fixes a lot of problems.

To Android and Beyond!

Now I'm working on the Android version.  The common C++ core compiled easily and it's on to the JNI interface.  If you're not familiar, this is the C++ interface to Java and it is pretty "meh".

I'm slogging through that logic now and it's slow going.  Thankfully Android Studio has gotten better with native code.  But honestly, it was a pretty low bar.

The goal is feature parity between the platforms and I think we'll get pretty close.

Unwinding Technical Debt

You accrete a bunch of technical debt in 8 years (!) and now is the time to clean it up.  Here's a very boring list of some of it.

  • MaplyShader and the low level OpenGL ES programs now unified into one representation.
  • Texture loading for tiles now consolidated in one object which works in one place.
  • Elevation callbacks removed to be replaced with something more logical.
  • The entire RemoteSource infrastructure removed in favor of something simpler and more flexible.  Yeah, this will cause problems.  See the next section.
  • Cut the AutoTester app back to just the essentials.  Much easier for users to read.
  • Got rid of the DynamicDrawableAtlas.  Android never liked it.
  • Gestures now live at the Component level with no duplicates lower down.
  • ActiveModels only exist at one level in the toolkit.
  • Generators are now gone, replaced with ActiveModels where needed.
  • Component Objects are now a concept in the core toolkit, not just the high level.
  • Paging controllers handle arbitrary visual objects as well as images.  Really nice for vector maps.
  • Rather than passing around View objects, we use ViewState objects.  Fixes some threading problems.
  • Managers no longer being fetched by string.  Not sure why I never did that.
  • More logic moved into the BaseInfo descriptors.  Render target, that sort of thing.
  • Moved locking logic over to C++11 constructs.  Much cleaner.
  • Passing around references to CoordSystems, fixing a few recurrent shutdown problems.
  • Moved vector subdivision logic into a unified module.
You read this far?  Weirdo.

There was a lot of trivia to clean up in 8 years.  Now it all kind of makes sense.  Except OpenGL ES.  I'll be reorganizing that when I get to Metal.

(Not Going To) Sunset Version 2.6

I'm breaking things in Version 3.0.  The new version will work better, but it won't be 100% compatible with 2.6. 

The big issue is the move from the QuadImages and QuadPaging layers to the new Sampler/Loader approach.  I'll cover that more in its own blog post (with pictures!) but for now let's just say it's better and I'm not going to make it backward compatible.

In that spirit, I'm going to continue supporting 2.6 for both iOS and Android into the future.  This will include bug fixes and updates for new platform versions.

Android, Android, and more Android

The next few weeks is all about Android.  I'll continue hooking up C++ through JNI to the existing Java.  Then I'll start on the new interfaces and loading logic that Android never had.

Lastly, it's on to testing and feature parity.  I honestly forget what's in the Android version and I'm kind of excited to have a full feature spreadsheet comparing the two.