Search in sources :

Example 6 with Envelope

use of org.locationtech.jts.geom.Envelope in project arctic-sea by 52North.

the class ReferencedEnvelopeTest method testExpandToIncludeEnvelopeToNullEnvelope.

@Test
public void testExpandToIncludeEnvelopeToNullEnvelope() throws Exception {
    final ReferencedEnvelope nullEnvelope = new ReferencedEnvelope(null, srid);
    nullEnvelope.expandToInclude(extensionEnvelope);
    assertThat(nullEnvelope.getSrid(), is(srid));
    final Envelope envelope = nullEnvelope.getEnvelope();
    assertThat(envelope.getMinX(), is(2.0));
    assertThat(envelope.getMaxX(), is(3.0));
    assertThat(envelope.getMinY(), is(2.0));
    assertThat(envelope.getMaxY(), is(3.0));
    assertThat(envelope.getArea(), is(1.0));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) Envelope(org.locationtech.jts.geom.Envelope) Test(org.junit.Test)

Example 7 with Envelope

use of org.locationtech.jts.geom.Envelope in project arctic-sea by 52North.

the class ReferencedEnvelopeTest method testExpandToIncludeEnvelope.

@Test
public void testExpandToIncludeEnvelope() throws Exception {
    originEnvelope.expandToInclude(extensionEnvelope);
    assertThat(originEnvelope.getSrid(), is(srid));
    final Envelope envelope = originEnvelope.getEnvelope();
    assertThat(envelope.getMinX(), is(0.0));
    assertThat(envelope.getMaxX(), is(3.0));
    assertThat(envelope.getMinY(), is(0.0));
    assertThat(envelope.getMaxY(), is(3.0));
    assertThat(envelope.getArea(), is(9.0));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) Envelope(org.locationtech.jts.geom.Envelope) Test(org.junit.Test)

Example 8 with Envelope

use of org.locationtech.jts.geom.Envelope in project arctic-sea by 52North.

the class ReferencedEnvelopeTest method testHashCode.

@Test
public void testHashCode() {
    final ReferencedEnvelope anEnvelope = new ReferencedEnvelope(new Envelope(1.0, 2.0, 3.0, 4.0), 52);
    final ReferencedEnvelope anotherEnvelope = new ReferencedEnvelope(null, 52);
    assertThat(anEnvelope.hashCode(), is(anEnvelope.hashCode()));
    assertThat(anEnvelope.hashCode(), is(not(anotherEnvelope.hashCode())));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) Envelope(org.locationtech.jts.geom.Envelope) Test(org.junit.Test)

Example 9 with Envelope

use of org.locationtech.jts.geom.Envelope in project arctic-sea by 52North.

the class ReferencedEnvelopeTest method testExpandToIncludeEmptyEnvelope.

@Test
public void testExpandToIncludeEmptyEnvelope() throws Exception {
    originEnvelope.expandToInclude(emptyEnvelope);
    assertThat(originEnvelope.getSrid(), is(4326));
    final Envelope envelope = originEnvelope.getEnvelope();
    assertThat(envelope.getMinX(), is(0.0));
    assertThat(envelope.getMaxX(), is(1.0));
    assertThat(envelope.getMinY(), is(0.0));
    assertThat(envelope.getMaxY(), is(1.0));
    assertThat(envelope.getArea(), is(1.0));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) Envelope(org.locationtech.jts.geom.Envelope) Test(org.junit.Test)

Example 10 with Envelope

use of org.locationtech.jts.geom.Envelope in project arctic-sea by 52North.

the class ReferencedEnvelopeTest method testExpandToIncludeReferencedEnvelope.

@Test
public void testExpandToIncludeReferencedEnvelope() throws Exception {
    originEnvelope.expandToInclude(new ReferencedEnvelope(extensionEnvelope, srid));
    assertThat(originEnvelope.getSrid(), is(srid));
    final Envelope envelope = originEnvelope.getEnvelope();
    assertThat(envelope.getMinX(), is(0.0));
    assertThat(envelope.getMaxX(), is(3.0));
    assertThat(envelope.getMinY(), is(0.0));
    assertThat(envelope.getMaxY(), is(3.0));
    assertThat(envelope.getArea(), is(9.0));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) Envelope(org.locationtech.jts.geom.Envelope) Test(org.junit.Test)

Aggregations

Envelope (org.locationtech.jts.geom.Envelope)20 ReferencedEnvelope (org.n52.shetland.util.ReferencedEnvelope)13 Test (org.junit.Test)11 Geometry (org.locationtech.jts.geom.Geometry)4 ValueGeometry (org.h2.value.ValueGeometry)3 GeometryFactory (org.locationtech.jts.geom.GeometryFactory)3 XmlObject (org.apache.xmlbeans.XmlObject)2 SpatialKey (org.h2.mvstore.rtree.SpatialKey)2 Value (org.h2.value.Value)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 BigDecimal (java.math.BigDecimal)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 BBOXType (net.opengis.fes.x20.BBOXType)1 EnvelopeType (net.opengis.swe.x101.EnvelopeType)1 Coordinate (net.opengis.swe.x101.VectorType.Coordinate)1 VersionedValue (org.h2.mvstore.db.TransactionStore.VersionedValue)1 SimpleResultSet (org.h2.tools.SimpleResultSet)1