Views
Maps Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvMapLoader Class Reference

A convenience class to load map files into an IlvManager. More...

#include <ilviews/maps/format/maploader.h>

Public Member Functions

 IlvMapLoader (IlvManager *manager)
 Initializes an IlvMapLoader that will load map files into the specified manager. If an IlvMapInfo is attached to the manager, and if the objects are read from a georeferenced map file (from which it is possible to know the projection used), the graphic objects will be automatically projected using the manager's projection. More...
 
virtual IlUInt load (const char *fileName, IlvMapsError &status)
 Loads the map file specified as argument. More...
 
virtual IlUInt load (IlvMapFeatureIterator *iterator, IlvFeatureRenderer *renderer, IlvMapsError &status)
 Loads the map features using the specified feature iterator and translates them into graphic objects using the specified map renderer. Once translated, these objects are added to the manager this map loader is attached to. More...
 
virtual IlUInt load (IlvMapFeatureIterator *iterator, IlvMapsError &status)
 Loads the map features using the specified feature iterator. More...
 
virtual IlvMapFeatureIteratormakeFeatureIterator (const char *filename)
 Instantiates a feature iterator from file name. More...
 
void setDefaultSourceProjection (IlvProjection *projection)
 Sets the source projection. More...
 

Detailed Description

A convenience class to load map files into an IlvManager.

Library: ilvmaps

This class allows map files to be loaded automatically into a manager. For instance, this class can load map files, automatically detecting their format, or load all the graphics from a feature iterator.

Constructor & Destructor Documentation

◆ IlvMapLoader()

IlvMapLoader::IlvMapLoader ( IlvManager manager)

Initializes an IlvMapLoader that will load map files into the specified manager. If an IlvMapInfo is attached to the manager, and if the objects are read from a georeferenced map file (from which it is possible to know the projection used), the graphic objects will be automatically projected using the manager's projection.

Parameters
managerThe manager to which the graphic objects will be added.
See also
IlvMapInfo

Member Function Documentation

◆ load() [1/3]

virtual IlUInt IlvMapLoader::load ( const char *  fileName,
IlvMapsError &  status 
)
virtual

Loads the map file specified as argument.

This method tries to determine the format of the map and instantiates the appropriate feature iterator. It translates the features returned by the feature iterator to graphic objects using the default feature renderer of the feature iterator. The graphic objects are then added to the manager. This method returns the number of features read.

Parameters
fileNameThe name of the file to be loaded.
statusReturns the status of the processing (IlvMaps::NoError() if no error occurs).
Returns
The number of features read.

◆ load() [2/3]

virtual IlUInt IlvMapLoader::load ( IlvMapFeatureIterator iterator,
IlvFeatureRenderer renderer,
IlvMapsError &  status 
)
virtual

Loads the map features using the specified feature iterator and translates them into graphic objects using the specified map renderer. Once translated, these objects are added to the manager this map loader is attached to.

Parameters
iteratorThe feature iterator.
rendererThe map renderer.
statusReturns the status of the processing (IlvMaps::NoError() if no error occurs).
Returns
The number of features read.

◆ load() [3/3]

virtual IlUInt IlvMapLoader::load ( IlvMapFeatureIterator iterator,
IlvMapsError &  status 
)
virtual

Loads the map features using the specified feature iterator.

The map features are translated to graphic objects using the default feature renderer of the feature iterator. These objects are then added to the manager. This method returns the number of features read.

Parameters
iteratorThe feature iterator.
statusReturns the status of the processing (IlvMaps::NoError() if no error occurs).
Returns
The number of features read.

◆ makeFeatureIterator()

virtual IlvMapFeatureIterator* IlvMapLoader::makeFeatureIterator ( const char *  filename)
virtual

Instantiates a feature iterator from file name.

Tries to instantiate a map reader to read the data from the specified file. This method is used by the IlvMapLoader::load() method. Subclassing the IlvMapLoader and overloading this method is a way to add support to user-defined map readers for the IlvMapLoader::load() method.

Parameters
filenameThe name of the map file.
Returns
An IlvMapFeatureIterator or null if the map format could not be determined.

◆ setDefaultSourceProjection()

void IlvMapLoader::setDefaultSourceProjection ( IlvProjection projection)

Sets the source projection.

Use this method to affect the source projection to read a file that is not georeferenced but for which you know the projection used.

Parameters
projectionThe new source projection. The map loader locks the new projection.