Options > Maps > Predefined Readers > The Image File Reader > The IlvImageReader Class
The IlvImageReader Class
This class is a subclass of the IlvMapFeatureIterator abstract class and returns only one IlvMapFeature object, which is the image stored in the file. The geometry of this map feature is of type IlvMapImage. The map feature has no attribute. To use this reader you have to provide a file name and the coordinates of this image.
IlvMapsError status;
// The image is known to be at 77 degrees 30 seconds east
// and 10 degrees north for the upper-left corner.
// Lower-right corner is at 82 degrees 30 seconds east
// and 5 degrees north.
IlvCoordinate ul(77.5, 10);
IlvCoordinate lr(82.5, 5);
IlvImageReader* reader = new IlvImageReader(display, fileName, ul, lr);
status = reader->getInitStatus();
if(status != IlvMaps::NoError())
return status;
IlvMapFeature* feature = (IlvMapFeature*)reader->getNextFeature(status);
if(status != IlvMaps::NoError())
return status;
IlvFeatureRenderer* renderer = reader->getDefaultFeatureRenderer(display);
// Image is known to be in the geographic projection.
IlvGeographicProjection* projection = new IlvGeographicProjection();
IlvMapInfo* mapInfo = new IlvMapInfo(projection);
feature->setProjection(projection);
IlvGraphic* g = renderer->makeGraphic(*feature, *mapInfo, status);
if(status != IlvMaps::NoError())
return status;
IlvManager* manager = new IlvManager(display);
manager->addObject(g, IlFalse);
return IlvMaps::NoError();
Published date: 05/24/2022
Last modified date: 02/24/2022