Search in sources :

Example 1 with GeometryTransformer

use of org.geotoolkit.gml.GeometryTransformer in project geotoolkit by Geomatys.

the class ReadGeometry321Test method testCurve.

@Test
public void testCurve() throws Exception {
    final AbstractGeometry geom = read(ReadGeometry321Test.class.getResource("curve.gml"));
    final GeometryTransformer tr = new GeometryTransformer(geom);
    final Geometry result = tr.get();
    Assert.assertNotNull("Read geometry is null", result);
    Assert.assertTrue(String.format("Bad geometry type.%nExpected: %s%nBut was: %s", LineString.class, result.getClass()), LineString.class.isAssignableFrom(result.getClass()));
    final LineString col = (LineString) result;
    Envelope expectedEnvelope = new Envelope(12.98241111111111, 13.462391666666665, -87.81824444444445, -87.25221944444445);
    final Envelope actual = col.getEnvelopeInternal();
    Assert.assertEquals(expectedEnvelope.getMinX(), actual.getMinX(), 0.01);
    Assert.assertEquals(expectedEnvelope.getMinY(), actual.getMinY(), 0.01);
    Assert.assertEquals(expectedEnvelope.getMaxX(), actual.getMaxX(), 0.01);
    Assert.assertEquals(expectedEnvelope.getMaxY(), actual.getMaxY(), 0.01);
}
Also used : AbstractGeometry(org.geotoolkit.gml.xml.AbstractGeometry) Geometry(org.locationtech.jts.geom.Geometry) AbstractGeometry(org.geotoolkit.gml.xml.AbstractGeometry) LineString(org.locationtech.jts.geom.LineString) MultiLineString(org.locationtech.jts.geom.MultiLineString) GeometryTransformer(org.geotoolkit.gml.GeometryTransformer) Envelope(org.locationtech.jts.geom.Envelope) ReadGeometryTest(org.geotoolkit.gml.ReadGeometryTest) Test(org.junit.Test)

Aggregations

GeometryTransformer (org.geotoolkit.gml.GeometryTransformer)1 ReadGeometryTest (org.geotoolkit.gml.ReadGeometryTest)1 AbstractGeometry (org.geotoolkit.gml.xml.AbstractGeometry)1 Test (org.junit.Test)1 Envelope (org.locationtech.jts.geom.Envelope)1 Geometry (org.locationtech.jts.geom.Geometry)1 LineString (org.locationtech.jts.geom.LineString)1 MultiLineString (org.locationtech.jts.geom.MultiLineString)1