Search in sources :

Example 1 with ReferencedEnvelope

use of org.n52.shetland.util.ReferencedEnvelope in project arctic-sea by 52North.

the class ReferencedEnvelopeTest method testExpandToIncludeReferencedEnvelopeWithNull.

@Test
public void testExpandToIncludeReferencedEnvelopeWithNull() throws Exception {
    final ReferencedEnvelope e = null;
    originEnvelope.expandToInclude(e);
    assertThat(originEnvelope.isSetSrid(), is(true));
    assertThat(originEnvelope.getSrid(), is(srid));
    assertThat(originEnvelope.isSetEnvelope(), is(true));
    final Envelope envelope = originEnvelope.getEnvelope();
    assertThat(envelope.getArea(), is(1.0));
    assertThat(envelope.getMinX(), is(0.0));
    assertThat(envelope.getMaxX(), is(1.0));
    assertThat(envelope.getMinY(), is(0.0));
    assertThat(envelope.getMaxY(), 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 2 with ReferencedEnvelope

use of org.n52.shetland.util.ReferencedEnvelope 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 3 with ReferencedEnvelope

use of org.n52.shetland.util.ReferencedEnvelope in project arctic-sea by 52North.

the class ReferencedEnvelopeTest method testIsSetEnvelope.

@Test
public void testIsSetEnvelope() throws Exception {
    final ReferencedEnvelope sosEnvelope = new ReferencedEnvelope();
    sosEnvelope.setEnvelope(extensionEnvelope);
    assertThat(new ReferencedEnvelope().isSetEnvelope(), is(false));
    assertThat(sosEnvelope.isSetEnvelope(), is(true));
    sosEnvelope.setEnvelope(emptyEnvelope);
    assertThat(sosEnvelope.isSetEnvelope(), is(false));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) Test(org.junit.Test)

Example 4 with ReferencedEnvelope

use of org.n52.shetland.util.ReferencedEnvelope 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 5 with ReferencedEnvelope

use of org.n52.shetland.util.ReferencedEnvelope 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

ReferencedEnvelope (org.n52.shetland.util.ReferencedEnvelope)14 Test (org.junit.Test)9 Envelope (org.locationtech.jts.geom.Envelope)8 XmlObject (org.apache.xmlbeans.XmlObject)5 LinkedList (java.util.LinkedList)2 ObservationCollectionDocument (net.opengis.om.x10.ObservationCollectionDocument)2 ObservationCollectionType (net.opengis.om.x10.ObservationCollectionType)2 ObservationPropertyType (net.opengis.om.x10.ObservationPropertyType)2 XmlString (org.apache.xmlbeans.XmlString)2 DateTime (org.joda.time.DateTime)2 Geometry (org.locationtech.jts.geom.Geometry)2 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)2 EncodingException (org.n52.svalbard.encode.exception.EncodingException)2 Joiner (com.google.common.base.Joiner)1 Strings (com.google.common.base.Strings)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Sets (com.google.common.collect.Sets)1 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1