use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class GeometryUtilityTest method setup.
@Before
public void setup() {
wktReader = new WKTReader();
wktWriter = new WKTWriter();
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class LinestringGeometrySubsamplerTest method testNonLineString.
@Test
public void testNonLineString() throws ParseException {
String wkt = "POLYGON (( 0 0, 1 1, 2 2, 0 0))";
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, is(geometry));
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class LinestringGeometrySubsamplerTest method testNullSubsampleCount.
@Test(expected = IllegalStateException.class)
public void testNullSubsampleCount() throws ParseException {
String wkt = generate(1001);
Geometry geometry = new WKTReader().read(wkt);
LinestringGeometrySubsampler linestringGeometrySubsampler = new LinestringGeometrySubsampler();
GeometryOperator.Context context = new GeometryOperator.Context();
context.setSubsampleCount(null);
linestringGeometrySubsampler.apply(geometry, context);
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class ConvertSubpolygonsToEnvelopesTest method testTwoSubpolygons.
@Test
public void testTwoSubpolygons() throws ParseException {
String wkt = "MULTIPOLYGON (((0 0, 2 10, 10 20, 20 20, 20 0, 0 0)),((0 40, 2 50, 10 60, 20 60, 20 40, 0 40)))";
WKTReader wktReader = new WKTReader();
Geometry geometry = wktReader.read(wkt);
ConvertSubpolygonsToEnvelopes convertSubpolygonsToEnvelopes = new ConvertSubpolygonsToEnvelopes();
Geometry actual = convertSubpolygonsToEnvelopes.apply(geometry, new GeometryOperator.Context());
Geometry expected = wktReader.read("MULTIPOLYGON (((0 0, 0 20, 20 20, 20 0, 0 0)), ((0 40, 0 60, 20 60, 20 40, 0 40)))");
assertThat(actual, is(expected));
}
use of com.vividsolutions.jts.io.WKTReader in project alliance by codice.
the class GeometryReducerTest method testTwoSubpolygons.
@Test
public void testTwoSubpolygons() throws ParseException {
String wkt = "MULTIPOLYGON (((0 0, 2 10, 10 20, 20 20, 20 0, 0 0)),((0 40, 2 50, 10 60, 20 60, 20 40, 0 40)))";
WKTReader wktReader = new WKTReader();
Geometry geometry = wktReader.read(wkt);
GeometryReducer reducer = new GeometryReducer();
Geometry actual = reducer.apply(geometry, context);
Geometry expected = wktReader.read(wkt);
assertThat(actual, is(expected));
}
Aggregations