use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class LinestringGeometrySubsamplerTest method testBelowCount.
@Test
public void testBelowCount() throws ParseException {
String wkt = generate(999);
Geometry geometry = new WKTReader().read(wkt);
LinestringGeometrySubsampler linestringGeometrySubsampler = new LinestringGeometrySubsampler();
GeometryOperator.Context context = new GeometryOperator.Context();
context.setSubsampleCount(1000);
Geometry actual = linestringGeometrySubsampler.apply(geometry, context);
assertThat(actual.getCoordinates().length, is(999));
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class LinestringGeometrySubsamplerTest method testAboveCount.
@Test
public void testAboveCount() throws ParseException {
String wkt = generate(1001);
Geometry geometry = new WKTReader().read(wkt);
LinestringGeometrySubsampler linestringGeometrySubsampler = new LinestringGeometrySubsampler();
GeometryOperator.Context context = new GeometryOperator.Context();
context.setSubsampleCount(1000);
Geometry actual = linestringGeometrySubsampler.apply(geometry, context);
assertThat(actual.getCoordinates().length, is(1000));
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class ConvertSubpolygonsToEnvelopesTest method testSingleSubpolygon.
@Test
public void testSingleSubpolygon() throws ParseException {
String wkt = "POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))";
WKTReader wktReader = new WKTReader();
Geometry geometry = wktReader.read(wkt);
ConvertSubpolygonsToEnvelopes convertSubpolygonsToEnvelopes = new ConvertSubpolygonsToEnvelopes();
Geometry actual = convertSubpolygonsToEnvelopes.apply(geometry, new GeometryOperator.Context());
assertThat(actual, is(geometry));
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class GeometryReducerTest method testSingleSubpolygon.
@Test
public void testSingleSubpolygon() throws ParseException {
String wkt = "POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))";
WKTReader wktReader = new WKTReader();
Geometry geometry = wktReader.read(wkt);
GeometryReducer reducer = new GeometryReducer();
Geometry actual = reducer.apply(geometry, context);
assertThat(actual, is(geometry));
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class NormalizeGeometryTest method testApply.
@Test
public void testApply() throws ParseException {
Geometry geometry = new WKTReader().read("LINESTRING( 0 0, 1 1, 2 2)");
Geometry normalizedGeometry = geometry.norm();
assertThat(normalizeGeometry.apply(geometry, new GeometryOperator.Context()), is(normalizedGeometry));
}
Aggregations