Using Load-On-Demand

This chapter explains how to use the load-on-demand mechanism, which lets you load into memory only the data that you want to display in a manager view and unload the data when you no longer use it. This mechanism is extremely valuable, especially when very large maps are concerned. Let us consider a database storing maps of the whole world with a scale of 1/25,000. If these maps were scanned with a resolution of 300 DPI, the required storage space would be as follows:

  • 654 kilobytes for 1 square kilometer

  • 64 megabytes for 100 square kilometers

  • Approximately 310 terabytes for the whole world

Given the volume of the data, it is crucial to have a load-on-demand mechanism that will load and display only the portion of a map of direct interest.

This chapter covers the following topics:

  • How Load-on-Demand Works introduces the load-on-demand classes and how they are related.

  • Structure and Size of the Tiling Grid describes the tiling parameters.

  • Displaying the State of Tiles explains how to use the debug view to display the state of tiles when implementing load-on-demand for a new format.

  • The following code associates an IlvManagerMagViewInteractor to the debug view. It introduces the various means you can use to control load-on-demand.

  • Managing Errors and Load-on-Demand Events describes how to manage errors and events related to load-on-demand.

  • Caching Tiles introduces the tile caching mechanism.

  • Saving a Tiled Layer presents issues related to saving tiled layers.

  • Writing a New Cache Algorithm illustrates through an example how to write a customized cache algorithm.

  • Implementing Load-on-Demand for a New Data Source explains how to implement a new tile loader.

Load-on-demand implementations for predefined map readers are described in Predefined Readers.