use of org.n52.shetland.util.ReferencedEnvelope in project arctic-sea by 52North.
the class ReferencedEnvelopeTest method testEquals.
@Test
public void testEquals() {
assertThat(new ReferencedEnvelope().equals(null), is(false));
assertThat(new ReferencedEnvelope().equals(new Object()), is(false));
assertThat(new ReferencedEnvelope().equals(emptyReferencedEnvelope), is(true));
assertThat(originEnvelope.equals(emptyReferencedEnvelope), is(false));
final ReferencedEnvelope otherEnvelope = new ReferencedEnvelope(extensionEnvelope, 52);
final ReferencedEnvelope myEnvelope = new ReferencedEnvelope(extensionEnvelope, 1024);
assertThat(otherEnvelope.equals(myEnvelope), is(false));
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.equals(anotherEnvelope), is(false));
assertThat(anEnvelope.equals(anEnvelope), is(true));
assertThat(anotherEnvelope.equals(anEnvelope), is(false));
}
use of org.n52.shetland.util.ReferencedEnvelope in project arctic-sea by 52North.
the class ReferencedEnvelopeTest method setUpEnvelopes.
@Before
public void setUpEnvelopes() {
extensionEnvelope = new Envelope(x21, x22, y21, y22);
originEnvelope = new ReferencedEnvelope(new Envelope(x11, x12, y11, y12), srid);
emptyReferencedEnvelope = new ReferencedEnvelope();
emptyEnvelope = new Envelope();
}
use of org.n52.shetland.util.ReferencedEnvelope in project arctic-sea by 52North.
the class SweEnvelopeTest method should_create_valid_sosSweEnvelope_from_sosEnvelope.
@Test
public void should_create_valid_sosSweEnvelope_from_sosEnvelope() {
final int srid = 52;
final double x1 = 1;
final double y1 = 2;
final double y2 = 3;
final double x2 = 4;
final BigDecimal bx1 = new BigDecimal(x1);
final BigDecimal by1 = new BigDecimal(y1);
final BigDecimal by2 = new BigDecimal(y2);
final BigDecimal bx2 = new BigDecimal(x2);
final String uom = "deg";
final ReferencedEnvelope sosEnvelope = new ReferencedEnvelope(new Envelope(x1, x2, y1, y2), srid);
final SweEnvelope sweEnvelope = new SweEnvelope(sosEnvelope, uom, false);
// srid
assertThat(sweEnvelope.getReferenceFrame(), is(Integer.toString(srid)));
// x1
final List<? extends SweCoordinate<?>> lcCoordinates = sweEnvelope.getLowerCorner().getCoordinates();
assertThat(((BigDecimal) lcCoordinates.get(0).getValue().getValue()), is(bx1));
// y1
assertThat(((BigDecimal) lcCoordinates.get(1).getValue().getValue()), is(by1));
// x2
final List<? extends SweCoordinate<?>> ucCoordinates = sweEnvelope.getUpperCorner().getCoordinates();
assertThat(((BigDecimal) ucCoordinates.get(0).getValue().getValue()), is(bx2));
// y2
assertThat(((BigDecimal) ucCoordinates.get(1).getValue().getValue()), is(by2));
// uom
assertThat(((SweQuantity) lcCoordinates.get(0).getValue()).getUom(), is(uom));
assertThat(((SweQuantity) lcCoordinates.get(1).getValue()).getUom(), is(uom));
assertThat(((SweQuantity) ucCoordinates.get(0).getValue()).getUom(), is(uom));
assertThat(((SweQuantity) ucCoordinates.get(1).getValue()).getUom(), is(uom));
// northing
assertThat(lcCoordinates.get(0).getName(), is(SweCoordinateNames.EASTING));
assertThat(ucCoordinates.get(0).getName(), is(SweCoordinateNames.EASTING));
// easting
assertThat(lcCoordinates.get(1).getName(), is(SweCoordinateNames.NORTHING));
assertThat(ucCoordinates.get(1).getName(), is(SweCoordinateNames.NORTHING));
}
use of org.n52.shetland.util.ReferencedEnvelope in project arctic-sea by 52North.
the class OmEncoderv100 method getEnvelope.
private ReferencedEnvelope getEnvelope(List<OmObservation> sosObservationCollection) {
ReferencedEnvelope sosEnvelope = new ReferencedEnvelope();
sosObservationCollection.stream().map(o -> (SamplingFeature) o.getObservationConstellation().getFeatureOfInterest()).forEach(f -> {
sosEnvelope.setSrid(f.getGeometry().getSRID());
sosEnvelope.expandToInclude(f.getGeometry().getEnvelopeInternal());
});
return sosEnvelope;
}
Aggregations