Search in sources :

Example 1 with CoordinateNaNError

use of com.revolsys.geometry.operation.valid.CoordinateNaNError in project com.revolsys.open by revolsys.

the class IsValidTest method testNaNCoordinate.

public void testNaNCoordinate() throws Exception {
    final Point badCoord = new PointDoubleXY(1.0, Double.NaN);
    final Point[] pts = { new PointDoubleXY(0.0, 0.0), badCoord };
    final Geometry line = this.geometryFactory.lineString(pts);
    final IsValidOp isValidOp = new IsValidOp(line);
    final boolean valid = isValidOp.isValid();
    final GeometryValidationError err = isValidOp.getValidationError();
    final Point errCoord = err.getErrorPoint();
    assertTrue(err instanceof CoordinateNaNError);
    assertTrue(Double.isNaN(errCoord.getY()));
    assertEquals(false, valid);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometryValidationError(com.revolsys.geometry.operation.valid.GeometryValidationError) CoordinateNaNError(com.revolsys.geometry.operation.valid.CoordinateNaNError) IsValidOp(com.revolsys.geometry.operation.valid.IsValidOp) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Aggregations

Geometry (com.revolsys.geometry.model.Geometry)1 Point (com.revolsys.geometry.model.Point)1 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)1 CoordinateNaNError (com.revolsys.geometry.operation.valid.CoordinateNaNError)1 GeometryValidationError (com.revolsys.geometry.operation.valid.GeometryValidationError)1 IsValidOp (com.revolsys.geometry.operation.valid.IsValidOp)1