Displaying the state of tiles

You can create a debug view to display the state of the tiles in a tiled layer using the following method:
As its name suggests, this debug view is particularly useful for debugging operations when implementing load-on-demand for a new cartographic format.
A tile can have three different states. It can be:
  • Empty, meaning that its objects are not loaded into memory.
  • Loaded, meaning that its objects are loaded into memory and visible.
  • Cached, meaning that its objects are loaded into memory but not visible.
The debug view is of the IlvManagerView type, and must be attached to a tiled layer. The debug view does not increment nor decrement the tile lock counters. This is the role of the tile controller. It just displays the tiles in color according to their state, as in Load-on-demand debug view.
LoadOnDemand1.gif
Load-on-demand debug view
The tiles whose lock counter is greater than 1 appear in blue. They are visible in at least one view. The tiles whose counter equals to 0 appear in yellow. They are cached. The white tiles are not loaded.
In the previous example, an IlvManagerMagViewInteractor was associated with the debug view. It is this interactor that displays a little yellow square inside the blue tile. The square shows the zone displayed by the main view.
The following is an example of code that creates a debug view for a layer.
  public static void createDebugView(IlvTiledLayer layer) {
    IlvManagerView view = new IlvManagerView(layer.getManager());
    layer.setDebugView(view);
    
    // Create a swing frame to display this debug view.
    JFrame frame = new JFrame("Debug View");
    frame.setLayout(new BorderLayout());
    frame.add(BorderLayout.CENTER, view);
    view.setAutoFitToContents(true);
    frame.setSize(200, 200);
    frame.setVisible(true);
  }
The complete source code of this example can be found in the following file: