Options > Maps > Predefined Readers > The S57 Map Reader > Classes for reading S57 format
Classes for reading S57 format
The class for reading S57 formats is the IlvS57Loader. This class is a subclass of the IlvMapFeatureIterator and returns one IlvMapFeature object for each S57 feature (S57 FRID record).
The following code shows how to use IlvS57Loader class to read a S57 catalog file and to use the IlvS57Renderer class to transform the map features to graphic objects.
IlvDisplay* display = ...;
IlvGraphic* graphic;
IlvManager* m = ...;
const IlvFeatureAttributeProperty* ap;
IlvMapInfo* mapInfo = ...;
Const char* filename = "catalog.030";
IlvMapsError status = IlvMaps::NoError();
 
IlvS57Loader reader(display);
reader.setFilename(filename);
IlvFeatureRenderer* renderer =
reader.getDefaultFeatureRenderer(display);
 
 
for (const IlvMapFeature* f = reader.getNextFeature(status);
status == IlvMaps::NoError() && f ;
f = reader.getNextFeature(status)) {
graphic = renderer->makeGraphic(*f, *mapInfo, status);
if (graphic) {
ap = f->getAttributes();
m->addObject(graphic);
if (ap)
graphic->setNamedProperty(ap->copy());
}
}
Published date: 05/24/2022
Last modified date: 02/24/2022