Search in sources :

Example 1 with EnvelopeType

use of net.opengis.gml.v_3_1_1.EnvelopeType in project ddf by codice.

the class RegistryPackageWebConverterTest method getFirstExtrinsicObject.

private ExtrinsicObjectType getFirstExtrinsicObject() {
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    // set default values
    extrinsicObject.setMimeType(extrinsicObject.getMimeType());
    extrinsicObject.setIsOpaque(extrinsicObject.isIsOpaque());
    extrinsicObject.setId("urn:registry:node");
    extrinsicObject.setObjectType("urn:registry:federation:node");
    extrinsicObject.getSlot().add(stHelper.create("liveDate", "2015-11-01T06:15:30-07:00", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataStartDate", "2015-11-01T13:15:30Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataEndDate", "2015-12-01T23:01:40Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("lastUpdated", "2016-01-26T17:16:34.996Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("links", "https://some/link/to/my/repo", "xs:string"));
    SlotType1 locationSlot = stHelper.create("location", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Point");
    PointType point = GML_FACTORY.createPointType();
    point.setSrsDimension(BigInteger.valueOf(2));
    point.setSrsName("urn:ogc:def:crs:EPSG::4326");
    DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    point.setPos(directPosition);
    ValueListType valueList = WRS_FACTORY.createValueListType();
    AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createPoint(point));
    valueList.getAnyValue().add(anyValue);
    locationSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(locationSlot);
    SlotType1 boundsSlot = stHelper.create("bounds", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Envelope");
    EnvelopeType bounds = GML_FACTORY.createEnvelopeType();
    bounds.setSrsName("urn:ogc:def:crs:EPSG::4326");
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    bounds.setUpperCorner(directPosition);
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(110.267472);
    directPosition.getValue().add(30.467944);
    bounds.setLowerCorner(directPosition);
    valueList = WRS_FACTORY.createValueListType();
    anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createEnvelope(bounds));
    valueList.getAnyValue().add(anyValue);
    boundsSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(boundsSlot);
    extrinsicObject.getSlot().add(stHelper.create("region", "USA", "urn:ogc:def:ebRIM-ClassificationScheme:UNSD:GlobalRegions"));
    List<String> values = new ArrayList<>();
    values.add("youtube");
    values.add("myCamera");
    extrinsicObject.getSlot().add(stHelper.create("inputDataSources", values, "xs:string"));
    values = new ArrayList<>();
    values.add("video");
    values.add("sensor");
    extrinsicObject.getSlot().add(stHelper.create("dataTypes", values, "xs:string"));
    extrinsicObject.getSlot().add(stHelper.create("securityLevel", "role=guest", "xs:string"));
    extrinsicObject.setName(istHelper.create("Node Name"));
    extrinsicObject.setDescription(istHelper.create("A little something describing this node in less than 1024 characters"));
    extrinsicObject.setVersionInfo(getVersionInfo("2.9.x"));
    ClassificationType classification = RIM_FACTORY.createClassificationType();
    classification.setId("urn:classification:id0");
    classification.setClassifiedObject("classifiedObjectId");
    extrinsicObject.getClassification().add(classification);
    return extrinsicObject;
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) ArrayList(java.util.ArrayList) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PointType(net.opengis.gml.v_3_1_1.PointType) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) ClassificationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)

Example 2 with EnvelopeType

use of net.opengis.gml.v_3_1_1.EnvelopeType in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_ReferencedEnvelope.

@Test
public void should_encode_ReferencedEnvelope() throws EncodingException {
    final int srid = 4326;
    final double y1 = 7.0;
    final double x1 = 51.0;
    final double y2 = 8.0;
    final double x2 = 52.0;
    final String uom = "test-uom";
    final String definition = "test-definition";
    final SweEnvelope sweEnvelope = new SweEnvelope(new ReferencedEnvelope(new Envelope(x1, x2, y1, y2), srid), uom, true);
    final String xAxisId = "x";
    final String yAxisId = "y";
    final String northing = "northing";
    final String easting = "easting";
    sweEnvelope.setDefinition(definition);
    final XmlObject encode = sweCommonEncoderv101.encode(sweEnvelope);
    assertThat(encode, instanceOf(EnvelopeType.class));
    final EnvelopeType xbEnvelope = (EnvelopeType) encode;
    assertThat(xbEnvelope.isSetDefinition(), is(true));
    assertThat(xbEnvelope.getDefinition(), is(definition));
    final Coordinate lcX = xbEnvelope.getLowerCorner().getVector().getCoordinateArray(0);
    assertThat(lcX.getName(), is(easting));
    assertThat(lcX.getQuantity().getAxisID(), is(xAxisId));
    assertThat(lcX.getQuantity().getUom().getCode(), is(uom));
    assertThat(lcX.getQuantity().getValue(), is(y1));
    final Coordinate lcY = xbEnvelope.getLowerCorner().getVector().getCoordinateArray(1);
    assertThat(lcY.getName(), is(northing));
    assertThat(lcY.getQuantity().getAxisID(), is(yAxisId));
    assertThat(lcY.getQuantity().getUom().getCode(), is(uom));
    assertThat(lcY.getQuantity().getValue(), is(x1));
    final Coordinate ucX = xbEnvelope.getUpperCorner().getVector().getCoordinateArray(0);
    assertThat(ucX.getName(), is(easting));
    assertThat(ucX.getQuantity().getAxisID(), is(xAxisId));
    assertThat(ucX.getQuantity().getUom().getCode(), is(uom));
    assertThat(ucX.getQuantity().getValue(), is(y2));
    final Coordinate ucY = xbEnvelope.getUpperCorner().getVector().getCoordinateArray(1);
    assertThat(ucY.getName(), is(northing));
    assertThat(ucY.getQuantity().getAxisID(), is(yAxisId));
    assertThat(ucY.getQuantity().getUom().getCode(), is(uom));
    assertThat(ucY.getQuantity().getValue(), is(x2));
    assertThat(xbEnvelope.isSetReferenceFrame(), is(true));
    assertThat(xbEnvelope.getReferenceFrame(), is("" + srid));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) EnvelopeType(net.opengis.swe.x101.EnvelopeType) SweEnvelope(org.n52.shetland.ogc.swe.SweEnvelope) Coordinate(net.opengis.swe.x101.VectorType.Coordinate) XmlObject(org.apache.xmlbeans.XmlObject) ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) SweEnvelope(org.n52.shetland.ogc.swe.SweEnvelope) Envelope(org.locationtech.jts.geom.Envelope) Test(org.junit.Test)

Example 3 with EnvelopeType

use of net.opengis.gml.v_3_1_1.EnvelopeType in project ddf by codice.

the class WfsFilterDelegateTest method testDisjointAsNotBBox.

@Test
public void testDisjointAsNotBBox() {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LonLatCoordinateStrategy());
    FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getLogicOps().getValue(), is(instanceOf(UnaryLogicOpType.class)));
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertThat(type.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    BBOXType bboxType = (BBOXType) type.getSpatialOps().getValue();
    EnvelopeType envelope = bboxType.getEnvelope().getValue();
    DirectPositionType lowerCorner = envelope.getLowerCorner();
    assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
    assertThat(lowerCorner.getValue(), is(asList(10.0, -10.0)));
    DirectPositionType upperCorner = envelope.getUpperCorner();
    assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
    assertThat(upperCorner.getValue(), is(asList(40.0, 30.0)));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_1_1_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_1_1_0.FilterType) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Test(org.junit.Test)

Example 4 with EnvelopeType

use of net.opengis.gml.v_3_1_1.EnvelopeType in project ddf by codice.

the class WfsFilterDelegateTest method testBoundingBoxLonLatOrder.

@Test
public void testBoundingBoxLonLatOrder() {
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LonLatCoordinateStrategy());
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    final BBOXType bboxType = (BBOXType) filter.getSpatialOps().getValue();
    final EnvelopeType envelope = bboxType.getEnvelope().getValue();
    final DirectPositionType lowerCorner = envelope.getLowerCorner();
    assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
    assertThat(lowerCorner.getValue(), is(asList(10.0, -10.0)));
    final DirectPositionType upperCorner = envelope.getUpperCorner();
    assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
    assertThat(upperCorner.getValue(), is(asList(40.0, 30.0)));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Test(org.junit.Test)

Example 5 with EnvelopeType

use of net.opengis.gml.v_3_1_1.EnvelopeType in project ddf by codice.

the class WfsFilterDelegateTest method testBoundingBoxLatLonOrder.

@Test
public void testBoundingBoxLatLonOrder() {
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LatLonCoordinateStrategy());
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    final BBOXType bboxType = (BBOXType) filter.getSpatialOps().getValue();
    final EnvelopeType envelope = bboxType.getEnvelope().getValue();
    final DirectPositionType lowerCorner = envelope.getLowerCorner();
    assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
    assertThat(lowerCorner.getValue(), is(asList(-10.0, 10.0)));
    final DirectPositionType upperCorner = envelope.getUpperCorner();
    assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
    assertThat(upperCorner.getValue(), is(asList(30.0, 40.0)));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Test(org.junit.Test)

Aggregations

EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)11 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)8 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)6 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)4 PointType (net.opengis.gml.v_3_1_1.PointType)4 Test (org.junit.Test)4 Map (java.util.Map)3 EnvelopeType (net.opengis.swe.x101.EnvelopeType)3 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)3 Envelope (org.locationtech.jts.geom.Envelope)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 ValueListType (net.opengis.cat.wrs.v_1_0_2.ValueListType)2 ValueListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)2 MapUtils (org.apache.commons.collections.MapUtils)2 StringUtils (org.apache.commons.lang.StringUtils)2 XmlObject (org.apache.xmlbeans.XmlObject)2