• Multi – map source business to map control development ideas
  • Based on Swift multi-map source business to achieve map control (I) : encapsulation map source
  • Based on Swift multi-map source business to map control implementation (two) : custom UI display
  • Based on Swift multi-map source business to map control implementation (3) : interactive event processing
  • A refactoring practice record of a piece of code

Many applications will use map control, we currently use the map scene is planning the flight path of uav. The most common is to plan an area to fly, then generate a cruise route, and finally use the photographs to model it. Once you have the model, you can get some digital information about the site.

Our map control has a lot of custom UI to show when planning the route. Here is a design diagram of our planned direct flight:

The data flow

The following shows the process for customizing the UI and map source mapping:

The overall view structure looks something like this:

defects

The advantage of this approach is that the implementation of the custom UI is isolated from the specific map SDK, and the custom UI can be reused when the local map source is switched. However, there is an inherent drawback to this scheme: the local graph is constantly responsive to user interaction, and custom UI drawing can be a bit sluggish.

If the UI is added to the map via the map SDK, the custom UI is drawn in the same frame as the map rendering. Therefore, in any frame, the position of the custom UI and the map always correspond, which makes the transformation of the graph smooth from the user’s point of view. But in our chosen scheme, there are two steps before the custom UI transformation: receiving the notification of the map area change and recalculating the graph’s plane coordinates on the map. Assuming the phone has no performance issues, the native layer of the map is drawn at 60Hz. The map’s layers are drawn 60 times per second as the user makes continuous zooming. Users feel smooth. The frequency of external notification of map area changes will be less than 60Hz due to performance considerations, so the rendering frequency of custom UI will be less than 60Hz even if the recalculation of graphics coordinates and drawing can be completed in 1/60 of a second. The experience for the user is that the custom UI doesn’t follow so much when moving continuously.

Whether a custom UI drawing delay is acceptable or not depends on your scenario. However, according to my test results, although the performance will be worse, most scenarios will not affect the use of users.