Search in sources :

Example 56 with WKTReader

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));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) WKTReader(com.vividsolutions.jts.io.WKTReader) Test(org.junit.Test)

Example 57 with WKTReader

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));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) WKTReader(com.vividsolutions.jts.io.WKTReader) Test(org.junit.Test)

Example 58 with WKTReader

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));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) WKTReader(com.vividsolutions.jts.io.WKTReader) Test(org.junit.Test)

Example 59 with WKTReader

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));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) WKTReader(com.vividsolutions.jts.io.WKTReader) Test(org.junit.Test)

Example 60 with WKTReader

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));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) WKTReader(com.vividsolutions.jts.io.WKTReader) Test(org.junit.Test)

Aggregations

WKTReader (com.vividsolutions.jts.io.WKTReader)70 Geometry (com.vividsolutions.jts.geom.Geometry)50 Test (org.junit.Test)28 ParseException (com.vividsolutions.jts.io.ParseException)23 WKTWriter (com.vividsolutions.jts.io.WKTWriter)9 Metacard (ddf.catalog.data.Metacard)9 Coordinate (com.vividsolutions.jts.geom.Coordinate)6 IsValidOp (com.vividsolutions.jts.operation.valid.IsValidOp)6 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)6 GeometryOperator (org.codice.alliance.libs.klv.GeometryOperator)6 Context (org.codice.alliance.video.stream.mpegts.Context)6 MapLayer (au.org.emii.portal.menu.MapLayer)5 GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)4 Polygon (com.vividsolutions.jts.geom.Polygon)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Optional (java.util.Optional)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 File (java.io.File)3 Before (org.junit.Before)3