Class CartesianValidator

java.lang.Object
org.elasticsearch.geometry.utils.CartesianValidator
All Implemented Interfaces:
GeometryValidator

public class CartesianValidator extends Object implements GeometryValidator
Validator for cartesian (non-geographic) coordinates. Its one job today is validateBBox(double, double, double, double): unlike geographic coordinates, cartesian coordinates have no antimeridian-crossing concept, so a rectangle's x-ordinates must be consistent (maxX cannot be less than minX), in addition to the same y-ordinate check (GeographyValidator also applies to geographic coordinates. This is deliberately a separate class from StandardValidator, even though the two currently look similar in scope: StandardValidator is CRS-agnostic and is relied on by real geographic production code paths (e.g. GeometryParser) that must tolerate antimeridian-crossing envelopes, so it cannot safely gain this check.
  • Field Details

  • Method Details

    • validateBBox

      public void validateBBox(double minX, double maxX, double maxY, double minY)
      Description copied from interface: GeometryValidator
      Validates the ordinate ordering of a rectangle/envelope, throwing IllegalArgumentException if the envelope is invalid. The default implementation only checks that maxY is not less than minY, since that is always invalid, regardless of CRS. It deliberately does not check x-ordinate ordering: geographic coordinates allow minX to legitimately exceed maxX, to represent an envelope that crosses the antimeridian, so only implementations for CRSes without that concept (e.g. CartesianValidator) need to additionally check that maxX is not less than minX.
      Specified by:
      validateBBox in interface GeometryValidator
    • validate

      public void validate(Geometry geometry)
      Description copied from interface: GeometryValidator
      Validates the geometry and throws IllegalArgumentException if the geometry is not valid
      Specified by:
      validate in interface GeometryValidator