Interface ICityLoader
- All Known Implementing Classes:
GeoJsonCityLoader,ShapefileCityLoader
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 Summary
Modifier and TypeMethodDescriptionLoads city features from the given filesystem path.loadFromResource(String resourcePath) Loads city features from a classpath resource.
-
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
.shpfile of a shapefile set) or to a self-contained file (e.g. a.geojsonfile). 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 benull- Returns:
- unmodifiable list of city features; never
null - Throws:
IOException- if the file cannot be read or parsed
-
loadFromResource
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 throwUnsupportedOperationExceptionwith a clear message in that case.- Parameters:
resourcePath- absolute classpath resource path; must not benull- Returns:
- unmodifiable list of city features; never
null - Throws:
IOException- if the resource cannot be read or parsedUnsupportedOperationException- if the format does not support classpath resource loading
-