| Programming with JViews Maps > Creating a Map Application Using the API > Using Load-on-Demand > Implementing Load-on-Demand for a New Data Source |
Implementing Load-on-Demand for a New Data Source |
INDEX
PREVIOUS
NEXT
|
To implement load-on-demand for a new data source, all you have to do is write a specific tile loader that implements the IlvTileLoader or the IlvMapTileLoader interface. Notice, however, that for the predefined map formats supplied with JViews Maps, load-on-demand has been implemented in a subclass of IlvTiledLayer that defines both the tile loader (as a private class) and the tiling parameters appropriate for the concerned format. The IlvMapTileLoader class and the predefined formats are described in Readers and Writers.
For your tile loader to be fully efficient, the following requirements should be satisfied:
The following example of a tile loader simulates the loading of two graphic objects, a rectangle and a label.
Its load() method takes the tile to be loaded as its parameter. It generates the graphic objects to be displayed within the tile and adds them to the tiled layer by calling the tile.addObject() method. When loading is complete, it calls the tile.loadComplete method to notify the listeners that the data in the tile is ready for use.
Its release() method is invoked when the tile cache releases a tile. The tile.deleteAll method clears the tile.
/** * Releases the objects on this tile. */ public void release(IlvTile tile) { tile.deleteAll(); } |
The complete source code of this example can be found in the following file:
<installdir>/jviews-maps81/codefragments/lod/srchtml/LodLoader.java
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |