All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.graph_builder.module.osm.UnconnectedArea Maven / Gradle / Ivy

The newest version!
package org.opentripplanner.graph_builder.module.osm;

import java.util.stream.Collectors;
import org.locationtech.jts.geom.Geometry;
import org.opentripplanner.graph_builder.issue.api.DataImportIssue;

public record UnconnectedArea(OsmAreaGroup areaGroup) implements DataImportIssue {
  private static final String FMT = "Area %s has no connection to street network";
  private static final String HTMLFMT =
    "Area '%s' has no connection to street network";

  @Override
  public String getMessage() {
    return String.format(FMT, idList());
  }

  @Override
  public String getHTMLMessage() {
    return String.format(HTMLFMT, areaGroup.getSomeOsmObject().url(), idList());
  }

  @Override
  public Geometry getGeometry() {
    return areaGroup.union;
  }

  private String idList() {
    return areaGroup.areas
      .stream()
      .map(area -> area.parent.getId())
      .map(Object::toString)
      .collect(Collectors.joining(", "));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy