conformsToFeaturesCore method

bool conformsToFeaturesCore({
  1. bool? openAPI30,
  2. bool? html,
  3. bool? geoJSON,
  4. bool? gmlSF0,
  5. bool? gmlSF2,
})

Check whether a service conforms to OGC API - Features - Part 1: Core.

Optionally also check whether it supports openAPI30, html, geoJSON, gmlSF0 and/or gmlSF2.

Examples:

  // Require the `Core` conformance class. Other classes could be
  // supported or not.
  conformsToCore();

  // Require `Core` and `GeoJSON` conformance classes. Other classes
  // could be supported or not.
  conformsToCore(geoJSON: true);

  // Require `Core` and `GeoJSON` conformance classes, and require
  // NOT conforming to `HTML`. Other classes could be supported or not.
  conformsToCore(geoJSON: true, html: false);

Implementation

bool conformsToFeaturesCore({
  bool? openAPI30,
  bool? html,
  bool? geoJSON,
  bool? gmlSF0,
  bool? gmlSF2,
}) {
  var isCore = false;
  var isOpenAPI30 = false;
  var isHTML = false;
  var isGeoJSON = false;
  var isGMLSF0 = false;
  var isGMLSF2 = false;

  for (final id in classes) {
    if (!isCore && id == features1Core) {
      isCore = true;
    }
    if (!isOpenAPI30 && id == features1OpenAPI30) {
      isOpenAPI30 = true;
    }
    if (!isHTML && id == features1HTML) {
      isHTML = true;
    }
    if (!isGeoJSON && id == features1GeoJSON) {
      isGeoJSON = true;
    }
    if (!isGMLSF0 && id == features1GMLSF0) {
      isGMLSF0 = true;
    }
    if (!isGMLSF2 && id == features1GMLSF2) {
      isGMLSF2 = true;
    }
  }

  return isCore &&
      (openAPI30 == null || isOpenAPI30 == openAPI30) &&
      (html == null || isHTML == html) &&
      (geoJSON == null || isGeoJSON == geoJSON) &&
      (gmlSF0 == null || isGMLSF0 == gmlSF0) &&
      (gmlSF2 == null || isGMLSF2 == gmlSF2);
}