Using the IlvS57Reader class to create vector data

To read S57 features using the IlvS57Reader object:
  1. Create an IlvS57Reader instance from the path of the S57 cell or catalog. Note that if the file name ends with 000, it will point to a single S57 cell. If it ends with 030, it will point to a S57 catalog that merges many S57 cells:
    String s57path = "C:/S57/sxx.000";
    IlvS57Reader S57Reader = new IlvS57Reader(s57path);
    
  2. You can also limit what is read to features specified by particular object codes (for more information about S57 Object codes, refer to the S57 format specification). For example, to read only roads you can use:
    S57Reader.setFeatureClassFilter
       (new IlvFeatureClassInformation("Roads","116"));
    
  3. Create a default renderer:
    IlvFeatureRenderer renderer = new IlvDefaultFeatureRenderer();
    
  4. Iterate over the features, render them with an appropriate IlvFeatureRenderer, and assign them to a manager:
    IlvMapFeature feature = S57Reader.getNextFeature();
    while(feature != null) {
      // Render map feature into graphic object
      IlvGraphic graphic = renderer.makeGraphic(feature,null);
      // Add this object on the first layer of the manager
      manager.addObject(graphic, 0, false);
      feature = S57Reader.getNextFeature();
    }