Interface ICityLoader

All Known Implementing Classes:
GeoJsonCityLoader, ShapefileCityLoader

public interface ICityLoader
Format-agnostic contract for loading populated-place (city) features.

Implementations exist for GeoJSON (GeoJsonCityLoader) and ESRI Shapefile (ShapefileCityLoader). Callers such as MapView2D depend only on this interface so that switching the source format requires no changes to rendering or hit-testing code.

Output contract

All load methods must return an unmodifiable list of GeoJsonCityLoader.CityFeature instances whose coordinates are in radians with longitude wrapped to (-π, π].

Error handling

Implementations must throw IOException for any I/O or parse error. Individual malformed features may be silently skipped rather than aborting the entire load, but the method must never return null.

  • Method Details

    • load

      Loads city features from the given filesystem path.

      The path may point to the primary file of a multi-file format (e.g. the .shp file of a shapefile set) or to a self-contained file (e.g. a .geojson file). Implementations are responsible for locating companion files (e.g. .dbf, .shx) relative to the supplied path.

      Parameters:
      path - path to the data file; must not be null
      Returns:
      unmodifiable list of city features; never null
      Throws:
      IOException - if the file cannot be read or parsed
    • loadFromResource

      List<GeoJsonCityLoader.CityFeature> loadFromResource(String resourcePath) throws IOException
      Loads city features from a classpath resource.

      The resource path must be absolute (begin with /). For multi-file formats this may not be supportable; implementations should throw UnsupportedOperationException with a clear message in that case.

      Parameters:
      resourcePath - absolute classpath resource path; must not be null
      Returns:
      unmodifiable list of city features; never null
      Throws:
      IOException - if the resource cannot be read or parsed
      UnsupportedOperationException - if the format does not support classpath resource loading