Class GeoJsonCountryLoader.CountryFeature

java.lang.Object
edu.cnu.mdi.mapping.loader.GeoJsonCountryLoader.CountryFeature
Enclosing class:
GeoJsonCountryLoader

public static final class GeoJsonCountryLoader.CountryFeature extends Object
Immutable representation of a single country feature consisting of an administrative name, an ISO-3166-1 alpha-3 code, and one or more polygon rings expressed as lists of geographic points in radians.

A country may have multiple polygon rings because:

  • The GeoJSON geometry type is MultiPolygon (e.g. France with its overseas territories).
  • A Polygon has interior holes (the outer ring plus one or more inner rings are all stored).

The list returned by getPolygons() is unmodifiable. Each inner ring list is modifiable but callers should treat them as read-only.

  • Constructor Details

    • CountryFeature

      public CountryFeature(String adminName, String isoA3, List<List<Point2D.Double>> polygons)
      Constructs a new country feature. The supplied polygon list is defensively copied and wrapped in an unmodifiable view.
      Parameters:
      adminName - administrative name (e.g. "United States of America"); must not be null
      isoA3 - ISO 3166-1 alpha-3 code (e.g. "USA"); must not be null
      polygons - polygon rings in radians (longitude, latitude order); must not be null
  • Method Details

    • getAdminName

      public String getAdminName()
      Returns the administrative (display) name of the country.
      Returns:
      country name; never null
    • getIsoA3

      public String getIsoA3()
      Returns the ISO 3166-1 alpha-3 country code.
      Returns:
      three-letter ISO code; never null
    • getPolygons

      public List<List<Point2D.Double>> getPolygons()
      Returns the unmodifiable list of polygon rings. Each ring is a list of Point2D.Double instances with x = λ (longitude, radians) and y = φ (latitude, radians).

      A ring with fewer than 3 points is degenerate and renderers may safely skip it.

      Returns:
      unmodifiable list of polygon rings
    • toString

      public String toString()
      Overrides:
      toString in class Object